diff options
author | andre <andre@FreeBSD.org> | 2007-05-11 20:52:47 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2007-05-11 20:52:47 +0000 |
commit | 14d6d7db44ab4d0393510d32ce6e0df269dd27e6 (patch) | |
tree | 503b36d9340c08dafb82fe89daaf7d1e4cc1fa5f /sys/kern/kern_timeout.c | |
parent | a968d55db329f3cf22701c6c0cebc11db78c7e96 (diff) | |
download | FreeBSD-src-14d6d7db44ab4d0393510d32ce6e0df269dd27e6.zip FreeBSD-src-14d6d7db44ab4d0393510d32ce6e0df269dd27e6.tar.gz |
Make the TCP timer callout obtain Giant if the network stack is marked
as non-mpsafe.
This change is to be removed when all protocols are mp-safe.
Diffstat (limited to 'sys/kern/kern_timeout.c')
-rw-r--r-- | sys/kern/kern_timeout.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 8891508..e3441c2 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -237,6 +237,13 @@ softclock(void *dummy) curr_cancelled = 0; mtx_unlock_spin(&callout_lock); if (c_mtx != NULL) { + if (c_flags & CALLOUT_NETGIANT) { + mtx_lock(&Giant); + gcalls++; + CTR3(KTR_CALLOUT, "netgiant" + " %p func %p arg %p", + c, c_func, c_arg); + } mtx_lock(c_mtx); /* * The callout may have been cancelled @@ -291,6 +298,8 @@ softclock(void *dummy) #endif if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0) mtx_unlock(c_mtx); + if (c_flags & CALLOUT_NETGIANT) + mtx_unlock(&Giant); skip: mtx_lock_spin(&callout_lock); curr_callout = NULL; @@ -584,12 +593,12 @@ callout_init_mtx(c, mtx, flags) { bzero(c, sizeof *c); c->c_mtx = mtx; - KASSERT((flags & ~CALLOUT_RETURNUNLOCKED) == 0, + KASSERT((flags & ~(CALLOUT_RETURNUNLOCKED|CALLOUT_NETGIANT)) == 0, ("callout_init_mtx: bad flags %d", flags)); /* CALLOUT_RETURNUNLOCKED makes no sense without a mutex. */ KASSERT(mtx != NULL || (flags & CALLOUT_RETURNUNLOCKED) == 0, ("callout_init_mtx: CALLOUT_RETURNUNLOCKED with no mutex")); - c->c_flags = flags & CALLOUT_RETURNUNLOCKED; + c->c_flags = flags & (CALLOUT_RETURNUNLOCKED|CALLOUT_NETGIANT); } #ifdef APM_FIXUP_CALLTODO |