diff options
author | jhb <jhb@FreeBSD.org> | 2006-07-06 21:39:39 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-07-06 21:39:39 +0000 |
commit | 5e008b18de65dc6ae72e0505274c495397e396a8 (patch) | |
tree | 8638b76f6f19569b99225764fadbed6d06e1ca1f | |
parent | 1e5e29d1c88fe515a78e244cdee843bc14a8ea69 (diff) | |
download | FreeBSD-src-5e008b18de65dc6ae72e0505274c495397e396a8.zip FreeBSD-src-5e008b18de65dc6ae72e0505274c495397e396a8.tar.gz |
- Explicitly acquire Giant around SYSINIT's and SYSUNINIT's since they are
not all known to be MPSAFE yet.
- Actually remove Giant from the kernel linker by taking it out of the
KLD_LOCK() and KLD_UNLOCK() macros.
Pointy hat to: jhb (2)
-rw-r--r-- | sys/kern/kern_linker.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index c35cd10..5182803 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -62,10 +62,13 @@ __FBSDID("$FreeBSD$"); int kld_debug = 0; #endif -#define KLD_LOCK() do { sx_xlock(&kld_sx); mtx_lock(&Giant); } while (0) -#define KLD_UNLOCK() do { mtx_unlock(&Giant); sx_xunlock(&kld_sx); } while (0) +#define KLD_LOCK() sx_xlock(&kld_sx) +#define KLD_UNLOCK() sx_xunlock(&kld_sx) #define KLD_LOCKED() sx_xlocked(&kld_sx) -#define KLD_LOCK_ASSERT() do { if (!cold) sx_assert(&kld_sx, SX_XLOCKED); } while (0) +#define KLD_LOCK_ASSERT() do { \ + if (!cold) \ + sx_assert(&kld_sx, SX_XLOCKED); \ +} while (0) /* * static char *linker_search_path(const char *name, struct mod_depend @@ -212,6 +215,7 @@ linker_file_sysinit(linker_file_t lf) * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. */ + mtx_lock(&Giant); for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s) */ @@ -219,6 +223,7 @@ linker_file_sysinit(linker_file_t lf) /* Call function */ (*((*sipp)->func)) ((*sipp)->udata); } + mtx_unlock(&Giant); } static void @@ -256,6 +261,7 @@ linker_file_sysuninit(linker_file_t lf) * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. */ + mtx_lock(&Giant); for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s) */ @@ -263,6 +269,7 @@ linker_file_sysuninit(linker_file_t lf) /* Call function */ (*((*sipp)->func)) ((*sipp)->udata); } + mtx_unlock(&Giant); } static void |