kernel: Remove numerous #include <sys/thread2.h>. Most of them were added when we converted spl*() calls to crit_enter()/crit_exit(), almost 14 years ago. We can now remove a good chunk of them again for where crit_*() are no longer used. I had to adjust some files that were relying on thread2.h or headers that it includes coming in via other headers that it was removed from.
kernel - Adjust device D_MPSAFE_* flags * Replace all device D_MPSAFE_* flags with just D_MPSAFE - Mark CAM's "da" and "cd" devices D_MPSAFE - Mark dm (device mapper) D_MPSAFE - Mark memio MPSAFE - Mark the disk subsystem D_MPSAFE - Mark the crypto device D_MPSAFE * Devices marked D_MPSAFE now call their strategy functions without the mp lock. * Do a pass on devfs and mark it MNTK_ALL_MPSAFE. devfs was essentially already MPSAFE but the D_MPSAFE checks have been moved out of devfs and into the dev_d*() API wrappers.
kernel - Move mplock to machine-independent C * Remove the per-platform mplock code and move it all into machine-independent code: sys/mplock2.h and kern/kern_mplock.c. * Inline the critical path. * When a conflict occurs kern_mplock.c will KTR log the file and line number of both the holder and conflicting acquirer. Set debug.ktr.giant_enable=-1 to enable conflict logging.
kernel - adjust falloc and arguments to dupfdopen, fsetfd, fdcheckstd * Make changes to the pointer type passed (proc, lwp, filedesc) to numerous routines. * falloc() needs access to td_ucred (it was previously using p_ucred which is not MPSAFE). * Adjust fsetfd() to make it conform to the other fsetfd*() procedures. * Related changes to fdcheckstd() and dupfdopen().