Index: compat/linux/linux_socket.c =================================================================== RCS file: /home/ncvs/src/sys/compat/linux/linux_socket.c,v retrieving revision 1.73 diff -u -r1.73 linux_socket.c --- compat/linux/linux_socket.c 14 Apr 2007 10:35:09 -0000 1.73 +++ compat/linux/linux_socket.c 1 Jun 2007 10:53:18 -0000 @@ -670,7 +670,6 @@ * socket and use the file descriptor reference instead of * creating a new one. */ - NET_LOCK_GIANT(); error = fgetsock(td, linux_args.s, &so, &fflag); if (error == 0) { error = EISCONN; @@ -683,7 +682,6 @@ } fputsock(so); } - NET_UNLOCK_GIANT(); return (error); } Index: contrib/pf/net/if_pfsync.c =================================================================== RCS file: /home/ncvs/src/sys/contrib/pf/net/if_pfsync.c,v retrieving revision 1.35 diff -u -r1.35 if_pfsync.c --- contrib/pf/net/if_pfsync.c 3 Jul 2007 12:16:07 -0000 1.35 +++ contrib/pf/net/if_pfsync.c 4 Jul 2007 12:21:07 -0000 @@ -282,12 +282,12 @@ ifp->if_hdrlen = PFSYNC_HDRLEN; pfsync_setmtu(pfsyncif, ETHERMTU); #ifdef __FreeBSD__ - callout_init(&pfsyncif->sc_tmo, NET_CALLOUT_MPSAFE); + callout_init(&pfsyncif->sc_tmo, CALLOUT_MPSAFE); #ifdef PFSYNC_TDB - callout_init(&pfsyncif->sc_tdb_tmo, NET_CALLOUT_MPSAFE); + callout_init(&pfsyncif->sc_tdb_tmo, CALLOUT_MPSAFE); #endif - callout_init(&pfsyncif->sc_bulk_tmo, NET_CALLOUT_MPSAFE); - callout_init(&pfsyncif->sc_bulkfail_tmo, NET_CALLOUT_MPSAFE); + callout_init(&pfsyncif->sc_bulk_tmo, CALLOUT_MPSAFE); + callout_init(&pfsyncif->sc_bulkfail_tmo, CALLOUT_MPSAFE); #else timeout_set(&pfsyncif->sc_tmo, pfsync_timeout, pfsyncif); timeout_set(&pfsyncif->sc_tdb_tmo, pfsync_tdb_timeout, pfsyncif); Index: dev/ath/if_ath.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ath/if_ath.c,v retrieving revision 1.172 diff -u -r1.172 if_ath.c --- dev/ath/if_ath.c 24 Jun 2007 01:57:20 -0000 1.172 +++ dev/ath/if_ath.c 2 Jul 2007 20:37:35 -0000 @@ -888,11 +888,9 @@ * truly a bmiss we'll get another interrupt soon and that'll * be dispatched up for processing. */ - if (tsf - lastrx > bmisstimeout) { - NET_LOCK_GIANT(); + if (tsf - lastrx > bmisstimeout) ieee80211_beacon_miss(ic); - NET_UNLOCK_GIANT(); - } else + else sc->sc_stats.ast_bmiss_phantom++; } } @@ -3447,8 +3445,6 @@ int16_t nf; u_int64_t tsf; - NET_LOCK_GIANT(); /* XXX */ - DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending); ngood = 0; nf = ath_hal_getchannoise(ah, &sc->sc_curchan); @@ -3714,8 +3710,6 @@ if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0 && !IFQ_IS_EMPTY(&ifp->if_snd)) ath_start(ifp); - - NET_UNLOCK_GIANT(); /* XXX */ #undef PA2DESC } Index: dev/ath/ath_rate/amrr/amrr.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ath/ath_rate/amrr/amrr.c,v retrieving revision 1.13 diff -u -r1.13 amrr.c --- dev/ath/ath_rate/amrr/amrr.c 11 Jun 2007 03:36:50 -0000 1.13 +++ dev/ath/ath_rate/amrr/amrr.c 28 Jun 2007 13:31:20 -0000 @@ -504,7 +504,7 @@ if (asc == NULL) return NULL; asc->arc.arc_space = sizeof(struct amrr_node); - callout_init(&asc->timer, debug_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init(&asc->timer, CALLOUT_MPSAFE); ath_rate_sysctlattach(sc); return &asc->arc; Index: dev/ath/ath_rate/onoe/onoe.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ath/ath_rate/onoe/onoe.c,v retrieving revision 1.14 diff -u -r1.14 onoe.c --- dev/ath/ath_rate/onoe/onoe.c 11 Jun 2007 03:36:50 -0000 1.14 +++ dev/ath/ath_rate/onoe/onoe.c 28 Jun 2007 13:31:20 -0000 @@ -478,7 +478,7 @@ if (osc == NULL) return NULL; osc->arc.arc_space = sizeof(struct onoe_node); - callout_init(&osc->timer, debug_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init(&osc->timer, CALLOUT_MPSAFE); ath_rate_sysctlattach(sc); return &osc->arc; Index: dev/ce/if_ce.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ce/if_ce.c,v retrieving revision 1.8 diff -u -r1.8 if_ce.c --- dev/ce/if_ce.c 25 Mar 2007 20:21:31 -0000 1.8 +++ dev/ce/if_ce.c 16 Jul 2007 08:33:42 -0000 @@ -127,35 +127,10 @@ #define callout_drain callout_stop #endif -#if __FreeBSD_version >= 504000 #define CE_LOCK_NAME "ceX" - -static int ce_mpsafenet = 1; -TUNABLE_INT("debug.ce.mpsafenet", &ce_mpsafenet); -SYSCTL_NODE(_debug, OID_AUTO, ce, CTLFLAG_RD, 0, "Cronyx Tau32-PCI Adapters"); -SYSCTL_INT(_debug_ce, OID_AUTO, mpsafenet, CTLFLAG_RD, &ce_mpsafenet, 0, - "Enable/disable MPSAFE network support for Cronyx Tau32-PCI Adapters"); - -#define CE_LOCK(_bd) do { \ - if (ce_mpsafenet) \ - mtx_lock (&(_bd)->ce_mtx); \ - } while (0) -#define CE_UNLOCK(_bd) do { \ - if (ce_mpsafenet) \ - mtx_unlock (&(_bd)->ce_mtx); \ - } while (0) - -#define CE_LOCK_ASSERT(_bd) do { \ - if (ce_mpsafenet) \ - mtx_assert (&(_bd)->ce_mtx, MA_OWNED); \ - } while (0) -#else -static int ce_mpsafenet = 0; - -#define CE_LOCK(_bd) do {} while (0 && (_bd) && ce_mpsafenet) -#define CE_UNLOCK(_bd) do {} while (0 && (_bd) && ce_mpsafenet) -#define CE_LOCK_ASSERT(_bd) do {} while (0 && (_bd) && ce_mpsafenet) -#endif +#define CE_LOCK(_bd) mtx_lock (&(_bd)->ce_mtx); +#define CE_UNLOCK(_bd) mtx_unlock (&(_bd)->ce_mtx); +#define CE_LOCK_ASSERT(_bd) mtx_assert (&(_bd)->ce_mtx, MA_OWNED); #define CDEV_MAJOR 185 @@ -317,7 +292,6 @@ .d_close = ce_close, .d_ioctl = ce_ioctl, .d_name = "ce", - .d_flags = D_NEEDGIANT, }; #endif @@ -650,13 +624,13 @@ return (ENXIO); } #if __FreeBSD_version >= 500000 - callout_init (&led_timo[unit], ce_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&led_timo[unit], CALLOUT_MPSAFE); #else callout_init (&led_timo[unit]); #endif error = bus_setup_intr (dev, bd->ce_irq, #if __FreeBSD_version >= 500013 - INTR_TYPE_NET|(ce_mpsafenet?INTR_MPSAFE:0), + INTR_TYPE_NET|INTR_MPSAFE, #else INTR_TYPE_NET, #endif @@ -710,8 +684,7 @@ } #if __FreeBSD_version >= 500000 NG_NODE_SET_PRIVATE (d->node, d); - callout_init (&d->timeout_handle, - ce_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&d->timeout_handle, CALLOUT_MPSAFE); #else d->node->private = d; #endif @@ -755,10 +728,6 @@ #endif d->ifp->if_mtu = PP_MTU; d->ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; -#if __FreeBSD_version >= 502125 - if (!ce_mpsafenet) - d->ifp->if_flags |= IFF_NEEDSGIANT; -#endif d->ifp->if_ioctl = ce_sioctl; d->ifp->if_start = ce_ifstart; d->ifp->if_watchdog = ce_ifwatchdog; @@ -2604,17 +2573,6 @@ #if __FreeBSD_version < 500000 dev = makedev (CDEV_MAJOR, 0); #endif -#if __FreeBSD_version >= 501114 - if (!debug_mpsafenet && ce_mpsafenet) { - printf ("WORNING! Network stack is not MPSAFE. " - "Turning off debug.ce.mpsafenet.\n"); - ce_mpsafenet = 0; - } -#endif -#if __FreeBSD_version >= 502103 - if (ce_mpsafenet) - ce_cdevsw.d_flags &= ~D_NEEDGIANT; -#endif switch (type) { case MOD_LOAD: @@ -2635,7 +2593,7 @@ cdevsw_add (&ce_cdevsw); #endif #if __FreeBSD_version >= 500000 - callout_init (&timeout_handle, ce_mpsafenet?CALLOUT_MPSAFE:0); + callout_init (&timeout_handle, CALLOUT_MPSAFE); #else callout_init (&timeout_handle); #endif Index: dev/cp/if_cp.c =================================================================== RCS file: /home/ncvs/src/sys/dev/cp/if_cp.c,v retrieving revision 1.33 diff -u -r1.33 if_cp.c --- dev/cp/if_cp.c 21 Mar 2007 03:38:35 -0000 1.33 +++ dev/cp/if_cp.c 14 Jul 2007 22:58:16 -0000 @@ -79,25 +79,9 @@ printf ("%s: ", d->name); printf s;}}) #define CP_LOCK_NAME "cpX" -static int cp_mpsafenet = 1; -TUNABLE_INT("debug.cp.mpsafenet", &cp_mpsafenet); -SYSCTL_NODE(_debug, OID_AUTO, cp, CTLFLAG_RD, 0, "Cronyx Tau-PCI Adapters"); -SYSCTL_INT(_debug_cp, OID_AUTO, mpsafenet, CTLFLAG_RD, &cp_mpsafenet, 0, - "Enable/disable MPSAFE network support for Cronyx Tau-PCI Adapters"); - -#define CP_LOCK(_bd) do { \ - if (cp_mpsafenet) \ - mtx_lock (&(_bd)->cp_mtx); \ - } while (0) -#define CP_UNLOCK(_bd) do { \ - if (cp_mpsafenet) \ - mtx_unlock (&(_bd)->cp_mtx); \ - } while (0) - -#define CP_LOCK_ASSERT(_bd) do { \ - if (cp_mpsafenet) \ - mtx_assert (&(_bd)->cp_mtx, MA_OWNED); \ - } while (0) +#define CP_LOCK(_bd) mtx_lock (&(_bd)->cp_mtx); +#define CP_UNLOCK(_bd) mtx_unlock (&(_bd)->cp_mtx); +#define CP_LOCK_ASSERT(_bd) mtx_assert (&(_bd)->cp_mtx, MA_OWNED); static int cp_probe __P((device_t)); static int cp_attach __P((device_t)); @@ -194,7 +178,6 @@ .d_close = cp_close, .d_ioctl = cp_ioctl, .d_name = "cp", - .d_flags = D_NEEDGIANT, }; /* @@ -478,9 +461,9 @@ splx (s); return (ENXIO); } - callout_init (&led_timo[unit], cp_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&led_timo[unit], CALLOUT_MPSAFE); error = bus_setup_intr (dev, bd->cp_irq, - INTR_TYPE_NET|(cp_mpsafenet?INTR_MPSAFE:0), + INTR_TYPE_NET|INTR_MPSAFE, NULL, cp_intr, bd, &bd->cp_intrhand); if (error) { cp_destroy = 1; @@ -525,8 +508,7 @@ d->hi_queue.ifq_maxlen = IFQ_MAXLEN; mtx_init (&d->queue.ifq_mtx, "cp_queue", NULL, MTX_DEF); mtx_init (&d->hi_queue.ifq_mtx, "cp_queue_hi", NULL, MTX_DEF); - callout_init (&d->timeout_handle, - cp_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&d->timeout_handle, CALLOUT_MPSAFE); #else /*NETGRAPH*/ d->ifp = if_alloc(IFT_PPP); if (d->ifp == NULL) { @@ -537,8 +519,6 @@ if_initname (d->ifp, "cp", b->num * NCHAN + c->num); d->ifp->if_mtu = PP_MTU; d->ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; - if (!cp_mpsafenet) - d->ifp->if_flags |= IFF_NEEDSGIANT; d->ifp->if_ioctl = cp_sioctl; d->ifp->if_start = cp_ifstart; d->ifp->if_watchdog = cp_ifwatchdog; @@ -2265,14 +2245,6 @@ { static int load_count = 0; - if (!debug_mpsafenet && cp_mpsafenet) { - printf ("WORNING! Network stack is not MPSAFE. " - "Turning off debug.cp.mpsafenet.\n"); - cp_mpsafenet = 0; - } - if (cp_mpsafenet) - cp_cdevsw.d_flags &= ~D_NEEDGIANT; - switch (type) { case MOD_LOAD: #ifdef NETGRAPH @@ -2280,7 +2252,7 @@ printf ("Failed to register ng_cp\n"); #endif ++load_count; - callout_init (&timeout_handle, cp_mpsafenet?CALLOUT_MPSAFE:0); + callout_init (&timeout_handle, CALLOUT_MPSAFE); callout_reset (&timeout_handle, hz*5, cp_timeout, 0); break; case MOD_UNLOAD: Index: dev/ctau/if_ct.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ctau/if_ct.c,v retrieving revision 1.33 diff -u -r1.33 if_ct.c --- dev/ctau/if_ct.c 21 Mar 2007 03:38:35 -0000 1.33 +++ dev/ctau/if_ct.c 14 Jul 2007 22:59:57 -0000 @@ -79,24 +79,9 @@ #define CT_LOCK_NAME "ctX" -static int ct_mpsafenet = 1; -TUNABLE_INT("debug.ctau.mpsafenet", &ct_mpsafenet); -SYSCTL_NODE(_debug, OID_AUTO, ctau, CTLFLAG_RD, 0, "Cronyx Tau-ISA Adapters"); -SYSCTL_INT(_debug_ctau, OID_AUTO, mpsafenet, CTLFLAG_RD, &ct_mpsafenet, 0, - "Enable/disable MPSAFE network support for Cronyx Tau-ISA Adapters"); - -#define CT_LOCK(_bd) do { \ - if (ct_mpsafenet) \ - mtx_lock (&(_bd)->ct_mtx); \ - } while (0) -#define CT_UNLOCK(_bd) do { \ - if (ct_mpsafenet) \ - mtx_unlock (&(_bd)->ct_mtx); \ - } while (0) -#define CT_LOCK_ASSERT(_bd) do { \ - if (ct_mpsafenet) \ - mtx_assert (&(_bd)->ct_mtx, MA_OWNED); \ - } while (0) +#define CT_LOCK(_bd) mtx_lock (&(_bd)->ct_mtx); +#define CT_UNLOCK(_bd) mtx_unlock (&(_bd)->ct_mtx); +#define CT_LOCK_ASSERT(_bd) mtx_assert (&(_bd)->ct_mtx, MA_OWNED); static void ct_identify __P((driver_t *, device_t)); static int ct_probe __P((device_t)); @@ -195,7 +180,6 @@ .d_close = ct_close, .d_ioctl = ct_ioctl, .d_name = "ct", - .d_flags = D_NEEDGIANT, }; /* @@ -678,10 +662,10 @@ return ENXIO; } - callout_init (&led_timo[unit], ct_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&led_timo[unit], CALLOUT_MPSAFE); s = splimp (); if (bus_setup_intr (dev, bd->irq_res, - INTR_TYPE_NET|(ct_mpsafenet?INTR_MPSAFE:0), + INTR_TYPE_NET|INTR_MPSAFE, NULL, ct_intr, bd, &bd->intrhand)) { printf ("ct%d: Can't setup irq %ld\n", unit, irq); bd->board = 0; @@ -741,8 +725,7 @@ d->hi_queue.ifq_maxlen = IFQ_MAXLEN; mtx_init (&d->queue.ifq_mtx, "ct_queue", NULL, MTX_DEF); mtx_init (&d->hi_queue.ifq_mtx, "ct_queue_hi", NULL, MTX_DEF); - callout_init (&d->timeout_handle, - ct_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&d->timeout_handle, CALLOUT_MPSAFE); #else /*NETGRAPH*/ d->ifp = if_alloc(IFT_PPP); if (d->ifp == NULL) { @@ -757,8 +740,6 @@ if_initname (d->ifp, "ct", b->num * NCHAN + c->num); d->ifp->if_mtu = PP_MTU; d->ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; - if (!ct_mpsafenet) - d->ifp->if_flags |= IFF_NEEDSGIANT; d->ifp->if_ioctl = ct_sioctl; d->ifp->if_start = ct_ifstart; d->ifp->if_watchdog = ct_ifwatchdog; @@ -2206,14 +2187,6 @@ { static int load_count = 0; - if (!debug_mpsafenet && ct_mpsafenet) { - printf ("WORNING! Network stack is not MPSAFE. " - "Turning off debug.ct.mpsafenet.\n"); - ct_mpsafenet = 0; - } - if (ct_mpsafenet) - ct_cdevsw.d_flags &= ~D_NEEDGIANT; - switch (type) { case MOD_LOAD: #ifdef NETGRAPH @@ -2221,7 +2194,7 @@ printf ("Failed to register ng_ct\n"); #endif ++load_count; - callout_init (&timeout_handle, ct_mpsafenet?CALLOUT_MPSAFE:0); + callout_init (&timeout_handle, CALLOUT_MPSAFE); callout_reset (&timeout_handle, hz*5, ct_timeout, 0); break; case MOD_UNLOAD: Index: dev/cx/if_cx.c =================================================================== RCS file: /home/ncvs/src/sys/dev/cx/if_cx.c,v retrieving revision 1.56 diff -u -r1.56 if_cx.c --- dev/cx/if_cx.c 21 Mar 2007 03:38:35 -0000 1.56 +++ dev/cx/if_cx.c 16 Jul 2007 08:33:56 -0000 @@ -83,24 +83,9 @@ #define CX_LOCK_NAME "cxX" -static int cx_mpsafenet = 1; -TUNABLE_INT("debug.cx.mpsafenet", &cx_mpsafenet); -SYSCTL_NODE(_debug, OID_AUTO, cx, CTLFLAG_RD, 0, "Cronyx Sigma Adapters"); -SYSCTL_INT(_debug_cx, OID_AUTO, mpsafenet, CTLFLAG_RD, &cx_mpsafenet, 0, - "Enable/disable MPSAFE network support for Cronyx Sigma Adapters"); - -#define CX_LOCK(_bd) do { \ - if (cx_mpsafenet) \ - mtx_lock (&(_bd)->cx_mtx); \ - } while (0) -#define CX_UNLOCK(_bd) do { \ - if (cx_mpsafenet) \ - mtx_unlock (&(_bd)->cx_mtx); \ - } while (0) -#define CX_LOCK_ASSERT(_bd) do { \ - if (cx_mpsafenet) \ - mtx_assert (&(_bd)->cx_mtx, MA_OWNED); \ - } while (0) +#define CX_LOCK(_bd) mtx_lock (&(_bd)->cx_mtx); +#define CX_UNLOCK(_bd) mtx_unlock (&(_bd)->cx_mtx); +#define CX_LOCK_ASSERT(_bd) mtx_assert (&(_bd)->cx_mtx, MA_OWNED); typedef struct _async_q { int beg; @@ -239,7 +224,7 @@ .d_close = cx_close, .d_ioctl = cx_ioctl, .d_name = "cx", - .d_flags = D_TTY | D_NEEDGIANT, + .d_flags = D_TTY, }; static int MY_SOFT_INTR; @@ -776,10 +761,10 @@ return ENXIO; } b->sys = bd; - callout_init (&led_timo[b->num], cx_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&led_timo[b->num], CALLOUT_MPSAFE); s = splhigh (); if (bus_setup_intr (dev, bd->irq_res, - INTR_TYPE_NET|(cx_mpsafenet?INTR_MPSAFE:0), + INTR_TYPE_NET|INTR_MPSAFE, NULL, cx_intr, bd, &bd->intrhand)) { printf ("cx%d: Can't setup irq %ld\n", unit, irq); bd->board = 0; @@ -849,8 +834,7 @@ d->hi_queue.ifq_maxlen = IFQ_MAXLEN; mtx_init (&d->lo_queue.ifq_mtx, "cx_queue_lo", NULL, MTX_DEF); mtx_init (&d->hi_queue.ifq_mtx, "cx_queue_hi", NULL, MTX_DEF); - callout_init (&d->timeout_handle, - cx_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&d->timeout_handle, CALLOUT_MPSAFE); #else /*NETGRAPH*/ d->ifp = if_alloc(IFT_PPP); if (d->ifp == NULL) { @@ -865,8 +849,6 @@ if_initname (d->ifp, "cx", b->num * NCHAN + c->num); d->ifp->if_mtu = PP_MTU; d->ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; - if (!cx_mpsafenet) - d->ifp->if_flags |= IFF_NEEDSGIANT; d->ifp->if_ioctl = cx_sioctl; d->ifp->if_start = cx_ifstart; d->ifp->if_watchdog = cx_ifwatchdog; @@ -901,8 +883,7 @@ ttycreate(d->tty, TS_CALLOUT, "x%r%r", b->num, c->num); d->devt = make_dev (&cx_cdevsw, b->num*NCHAN + c->num + 64, UID_ROOT, GID_WHEEL, 0600, "cx%d", b->num*NCHAN + c->num); d->devt->si_drv1 = d; - callout_init (&d->dcd_timeout_handle, - cx_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init (&d->dcd_timeout_handle, CALLOUT_MPSAFE); } splx (s); @@ -2523,14 +2504,6 @@ { static int load_count = 0; - if (!debug_mpsafenet && cx_mpsafenet) { - printf ("WORNING! Network stack is not MPSAFE. " - "Turning off debug.cx.mpsafenet.\n"); - cx_mpsafenet = 0; - } - if (cx_mpsafenet) - cx_cdevsw.d_flags &= ~D_NEEDGIANT; - switch (type) { case MOD_LOAD: #ifdef NETGRAPH @@ -2539,11 +2512,11 @@ #endif ++load_count; - callout_init (&timeout_handle, cx_mpsafenet?CALLOUT_MPSAFE:0); + callout_init (&timeout_handle, CALLOUT_MPSAFE); callout_reset (&timeout_handle, hz*5, cx_timeout, 0); /* Software interrupt. */ swi_add(&tty_intr_event, "cx", cx_softintr, NULL, SWI_TTY, - (cx_mpsafenet?INTR_MPSAFE:0), &cx_fast_ih); + INTR_MPSAFE, &cx_fast_ih); break; case MOD_UNLOAD: if (load_count == 1) { Index: dev/em/if_em.c =================================================================== RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v retrieving revision 1.181 diff -u -r1.181 if_em.c --- dev/em/if_em.c 31 May 2007 23:36:21 -0000 1.181 +++ dev/em/if_em.c 2 Jun 2007 10:45:23 -0000 @@ -1474,7 +1474,6 @@ struct adapter *adapter = context; struct ifnet *ifp; - NET_LOCK_GIANT(); ifp = adapter->ifp; /* @@ -1493,7 +1492,6 @@ } em_enable_intr(adapter); - NET_UNLOCK_GIANT(); } /********************************************************************* Index: dev/streams/streams.c =================================================================== RCS file: /home/ncvs/src/sys/dev/streams/streams.c,v retrieving revision 1.55 diff -u -r1.55 streams.c --- dev/streams/streams.c 4 Apr 2007 09:11:31 -0000 1.55 +++ dev/streams/streams.c 1 Jun 2007 10:53:46 -0000 @@ -244,9 +244,7 @@ return error; /* An extra reference on `fp' has been held for us by falloc(). */ - NET_LOCK_GIANT(); error = socreate(family, &so, type, protocol, td->td_ucred, td); - NET_UNLOCK_GIANT(); if (error) { fdclose(fdp, fp, fd, td); fdrop(fp, td); Index: kern/kern_descrip.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v retrieving revision 1.312 diff -u -r1.312 kern_descrip.c --- kern/kern_descrip.c 3 Jul 2007 21:26:06 -0000 1.312 +++ kern/kern_descrip.c 15 Jul 2007 21:41:59 -0000 @@ -2098,8 +2098,6 @@ struct file *fp; int error; - NET_ASSERT_GIANT(); - *spp = NULL; if (fflagp != NULL) *fflagp = 0; @@ -2129,7 +2127,6 @@ fputsock(struct socket *so) { - NET_ASSERT_GIANT(); ACCEPT_LOCK(); SOCK_LOCK(so); sorele(so); Index: kern/kern_poll.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_poll.c,v retrieving revision 1.30 diff -u -r1.30 kern_poll.c --- kern/kern_poll.c 5 Jun 2007 00:00:54 -0000 1.30 +++ kern/kern_poll.c 5 Jun 2007 23:41:30 -0000 @@ -329,7 +329,6 @@ { int i; - NET_LOCK_GIANT(); mtx_lock(&poll_mtx); if (count > poll_each_burst) @@ -339,7 +338,6 @@ pr[i].handler(pr[i].ifp, POLL_ONLY, count); mtx_unlock(&poll_mtx); - NET_UNLOCK_GIANT(); } /* @@ -366,8 +364,6 @@ struct timeval t; int kern_load; - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); phase = 5; if (residual_burst > 0) { @@ -417,8 +413,6 @@ int i, cycles; enum poll_cmd arg = POLL_ONLY; - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); phase = 3; if (residual_burst == 0) { /* first call in this tick */ @@ -456,8 +450,6 @@ KASSERT(h != NULL, ("%s: handler is NULL", __func__)); KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); - NET_ASSERT_GIANT(); - mtx_lock(&poll_mtx); if (poll_handlers >= POLL_LIST_LEN) { /* @@ -504,7 +496,6 @@ KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); - NET_ASSERT_GIANT(); mtx_lock(&poll_mtx); for (i = 0 ; i < poll_handlers ; i++) @@ -547,7 +538,6 @@ polling = val; - NET_LOCK_GIANT(); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &ifnet, if_link) { if (ifp->if_capabilities & IFCAP_POLLING) { @@ -565,7 +555,6 @@ } } IFNET_RUNLOCK(); - NET_UNLOCK_GIANT(); log(LOG_ERR, "kern.polling.enable is deprecated. Use ifconfig(8)"); Index: kern/subr_bus.c =================================================================== RCS file: /home/ncvs/src/sys/kern/subr_bus.c,v retrieving revision 1.200 diff -u -r1.200 subr_bus.c --- kern/subr_bus.c 23 May 2007 17:28:21 -0000 1.200 +++ kern/subr_bus.c 1 Jun 2007 10:51:27 -0000 @@ -3464,9 +3464,6 @@ int error; if (dev->parent != NULL) { - if ((flags &~ INTR_ENTROPY) == (INTR_TYPE_NET | INTR_MPSAFE) && - !debug_mpsafenet) - flags &= ~INTR_MPSAFE; error = BUS_SETUP_INTR(dev->parent, dev, r, flags, filter, handler, arg, cookiep); if (error == 0) { Index: kern/sys_socket.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sys_socket.c,v retrieving revision 1.72 diff -u -r1.72 sys_socket.c --- kern/sys_socket.c 4 Mar 2007 17:50:46 -0000 1.72 +++ kern/sys_socket.c 14 Jul 2007 23:05:23 -0000 @@ -75,18 +75,14 @@ struct socket *so = fp->f_data; int error; - NET_LOCK_GIANT(); #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_receive(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif error = soreceive(so, 0, uio, 0, 0, 0); - NET_UNLOCK_GIANT(); return (error); } @@ -98,15 +94,12 @@ struct socket *so = fp->f_data; int error; - NET_LOCK_GIANT(); #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_send(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif error = sosend(so, 0, uio, 0, 0, 0, uio->uio_td); if (error == EPIPE && (so->so_options & SO_NOSIGPIPE) == 0) { @@ -114,7 +107,6 @@ psignal(uio->uio_td->td_proc, SIGPIPE); PROC_UNLOCK(uio->uio_td->td_proc); } - NET_UNLOCK_GIANT(); return (error); } @@ -125,9 +117,7 @@ struct socket *so = fp->f_data; int error = 0; - NET_LOCK_GIANT(); switch (cmd) { - case FIONBIO: SOCK_LOCK(so); if (*(int *)data) @@ -207,7 +197,6 @@ (so, cmd, data, 0, td)); break; } - NET_UNLOCK_GIANT(); return(error); } @@ -218,18 +207,14 @@ struct socket *so = fp->f_data; int error; - NET_LOCK_GIANT(); #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_poll(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif error = sopoll(so, events, fp->f_cred, td); - NET_UNLOCK_GIANT(); return (error); } @@ -243,15 +228,12 @@ bzero((caddr_t)ub, sizeof (*ub)); ub->st_mode = S_IFSOCK; - NET_LOCK_GIANT(); #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_stat(active_cred, so); SOCK_UNLOCK(so); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } #endif /* * If SBS_CANTRCVMORE is set, but there's still data left in the @@ -270,7 +252,6 @@ ub->st_uid = so->so_cred->cr_uid; ub->st_gid = so->so_cred->cr_gid; error = (*so->so_proto->pr_usrreqs->pru_sense)(so, ub); - NET_UNLOCK_GIANT(); return (error); } @@ -287,13 +268,10 @@ int error = 0; struct socket *so; - NET_LOCK_GIANT(); so = fp->f_data; fp->f_ops = &badfileops; fp->f_data = NULL; - if (so) error = soclose(so); - NET_UNLOCK_GIANT(); return (error); } Index: kern/uipc_domain.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_domain.c,v retrieving revision 1.49 diff -u -r1.49 uipc_domain.c --- kern/uipc_domain.c 16 May 2007 20:41:07 -0000 1.49 +++ kern/uipc_domain.c 15 Jul 2007 21:42:11 -0000 @@ -211,13 +211,8 @@ if (max_linkhdr < 16) /* XXX */ max_linkhdr = 16; - if (debug_mpsafenet) { - callout_init(&pffast_callout, CALLOUT_MPSAFE); - callout_init(&pfslow_callout, CALLOUT_MPSAFE); - } else { - callout_init(&pffast_callout, 0); - callout_init(&pfslow_callout, 0); - } + callout_init(&pffast_callout, CALLOUT_MPSAFE); + callout_init(&pfslow_callout, CALLOUT_MPSAFE); mtx_lock(&dom_mtx); KASSERT(domain_init_status == 0, ("domaininit called too late!")); @@ -458,8 +453,6 @@ struct domain *dp; struct protosw *pr; - NET_ASSERT_GIANT(); - for (dp = domains; dp; dp = dp->dom_next) for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_slowtimo) @@ -473,8 +466,6 @@ struct domain *dp; struct protosw *pr; - NET_ASSERT_GIANT(); - for (dp = domains; dp; dp = dp->dom_next) for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_fasttimo) Index: kern/uipc_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.257 diff -u -r1.257 uipc_syscalls.c --- kern/uipc_syscalls.c 2 Jul 2007 12:50:53 -0000 1.257 +++ kern/uipc_syscalls.c 2 Jul 2007 18:28:58 -0000 @@ -175,10 +175,8 @@ if (error) return (error); /* An extra reference on `fp' has been held for us by falloc(). */ - NET_LOCK_GIANT(); error = socreate(uap->domain, &so, uap->type, uap->protocol, td->td_ucred, td); - NET_UNLOCK_GIANT(); if (error) { fdclose(fdp, fp, fd, td); } else { @@ -225,25 +223,18 @@ struct file *fp; int error; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) - goto done2; + return (error); so = fp->f_data; #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_bind(td->td_ucred, so, sa); SOCK_UNLOCK(so); - if (error) - goto done1; -#endif - error = sobind(so, sa, td); -#ifdef MAC -done1: + if (error == 0) #endif + error = sobind(so, sa, td); fdrop(fp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -260,7 +251,6 @@ struct file *fp; int error; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, uap->s, &fp, NULL); if (error == 0) { so = fp->f_data; @@ -268,17 +258,12 @@ SOCK_LOCK(so); error = mac_check_socket_listen(td->td_ucred, so); SOCK_UNLOCK(so); - if (error) - goto done; -#endif - error = solisten(so, uap->backlog, td); -#ifdef MAC -done: + if (error == 0) #endif + error = solisten(so, uap->backlog, td); fdrop(fp, td); } - NET_UNLOCK_GIANT(); - return(error); + return (error); } /* @@ -357,10 +342,9 @@ } fdp = td->td_proc->p_fd; - NET_LOCK_GIANT(); error = getsock(fdp, s, &headfp, &fflag); if (error) - goto done2; + return (error); head = headfp->f_data; if ((head->so_options & SO_ACCEPTCONN) == 0) { error = EINVAL; @@ -491,8 +475,6 @@ if (nfp != NULL) fdrop(nfp, td); fdrop(headfp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -550,10 +532,9 @@ int error; int interrupted = 0; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) - goto done2; + return (error); so = fp->f_data; if (so->so_state & SS_ISCONNECTING) { error = EALREADY; @@ -595,8 +576,6 @@ error = EINTR; done1: fdrop(fp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -623,11 +602,10 @@ return (error); #endif - NET_LOCK_GIANT(); error = socreate(uap->domain, &so1, uap->type, uap->protocol, td->td_ucred, td); if (error) - goto done2; + return (error); error = socreate(uap->domain, &so2, uap->type, uap->protocol, td->td_ucred, td); if (error) @@ -670,7 +648,7 @@ goto free4; fdrop(fp1, td); fdrop(fp2, td); - goto done2; + return (0); free4: fdclose(fdp, fp2, sv[1], td); fdrop(fp2, td); @@ -683,8 +661,6 @@ free1: if (so1 != NULL) (void)soclose(so1); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -770,7 +746,6 @@ struct uio *ktruio = NULL; #endif - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); if (error) goto bad2; @@ -827,7 +802,6 @@ bad: fdrop(fp, td); bad2: - NET_UNLOCK_GIANT(); return (error); } @@ -968,12 +942,9 @@ if(controlp != NULL) *controlp = 0; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); - if (error) { - NET_UNLOCK_GIANT(); + if (error) return (error); - } so = fp->f_data; #ifdef MAC @@ -982,7 +953,6 @@ SOCK_UNLOCK(so); if (error) { fdrop(fp, td); - NET_UNLOCK_GIANT(); return (error); } #endif @@ -998,7 +968,6 @@ for (i = 0; i < mp->msg_iovlen; i++, iov++) { if ((auio.uio_resid += iov->iov_len) < 0) { fdrop(fp, td); - NET_UNLOCK_GIANT(); return (EINVAL); } } @@ -1094,7 +1063,6 @@ } out: fdrop(fp, td); - NET_UNLOCK_GIANT(); if (fromsa) FREE(fromsa, M_SONAME); @@ -1148,7 +1116,7 @@ error = copyin(uap->fromlenaddr, &msg.msg_namelen, sizeof (msg.msg_namelen)); if (error) - goto done2; + return (error); } else { msg.msg_namelen = 0; } @@ -1160,8 +1128,7 @@ msg.msg_control = 0; msg.msg_flags = uap->flags; error = recvit(td, uap->s, &msg, uap->fromlenaddr); -done2: - return(error); + return (error); } #ifdef COMPAT_OLDSOCK @@ -1285,14 +1252,12 @@ struct file *fp; int error; - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, uap->s, &fp, NULL); if (error == 0) { so = fp->f_data; error = soshutdown(so, uap->how); fdrop(fp, td); } - NET_UNLOCK_GIANT(); return (error); } @@ -1349,15 +1314,13 @@ panic("kern_setsockopt called with bad valseg"); } - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); if (error == 0) { so = fp->f_data; error = sosetopt(so, &sopt); fdrop(fp, td); } - NET_UNLOCK_GIANT(); - return(error); + return (error); } /* ARGSUSED */ @@ -1429,7 +1392,6 @@ panic("kern_getsockopt called with bad valseg"); } - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, s, &fp, NULL); if (error == 0) { so = fp->f_data; @@ -1437,7 +1399,6 @@ *valsize = sopt.sopt_valsize; fdrop(fp, td); } - NET_UNLOCK_GIANT(); return (error); } @@ -1492,7 +1453,6 @@ if (*alen < 0) return (EINVAL); - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) goto done; @@ -1513,7 +1473,6 @@ *sa = NULL; } done: - NET_UNLOCK_GIANT(); return (error); } @@ -1588,10 +1547,9 @@ if (*alen < 0) return (EINVAL); - NET_LOCK_GIANT(); error = getsock(td->td_proc->p_fd, fd, &fp, NULL); if (error) - goto done2; + return (error); so = fp->f_data; if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) { error = ENOTCONN; @@ -1613,8 +1571,6 @@ } done1: fdrop(fp, td); -done2: - NET_UNLOCK_GIANT(); return (error); } @@ -1823,8 +1779,6 @@ int error, hdrlen = 0, mnw = 0; int vfslocked; - NET_LOCK_GIANT(); - /* * The file descriptor must be a regular file and have a * backing VM object. @@ -2242,8 +2196,6 @@ if (m) m_freem(m); - NET_UNLOCK_GIANT(); - if (error == ERESTART) error = EINTR; @@ -2275,10 +2227,12 @@ fdp = td->td_proc->p_fd; error = fgetsock(td, uap->sd, &head, &fflag); if (error) - goto done2; + return (error); error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); - if (error) - goto done2; + if (error) { + fputsock(head); + return (error); + } /* * At this point we know we do have a assoc to pull * we proceed to get the fd setup. This may block @@ -2341,7 +2295,6 @@ if (nfp != NULL) fdrop(nfp, td); fputsock(head); -done2: return (error); #else /* SCTP */ return (EOPNOTSUPP); Index: net/bpf.c =================================================================== RCS file: /home/ncvs/src/sys/net/bpf.c,v retrieving revision 1.178 diff -u -r1.178 bpf.c --- net/bpf.c 17 Jun 2007 21:51:43 -0000 1.178 +++ net/bpf.c 14 Jul 2007 23:04:45 -0000 @@ -405,7 +405,7 @@ mac_create_bpfdesc(td->td_ucred, d); #endif mtx_init(&d->bd_mtx, devtoname(dev), "bpf cdev lock", MTX_DEF); - callout_init(&d->bd_callout, NET_CALLOUT_MPSAFE); + callout_init(&d->bd_callout, CALLOUT_MPSAFE); knlist_init(&d->bd_sel.si_note, &d->bd_mtx, NULL, NULL, NULL); return (0); @@ -645,16 +645,11 @@ BPFD_UNLOCK(d); #endif - NET_LOCK_GIANT(); error = (*ifp->if_output)(ifp, m, &dst, NULL); - NET_UNLOCK_GIANT(); - if (mc != NULL) { - if (error == 0) { - NET_LOCK_GIANT(); + if (error == 0) (*ifp->if_input)(ifp, mc); - NET_UNLOCK_GIANT(); - } else + else m_freem(mc); } @@ -776,10 +771,8 @@ if (d->bd_bif == NULL) error = EINVAL; else { - NET_LOCK_GIANT(); ifp = d->bd_bif->bif_ifp; error = (*ifp->if_ioctl)(ifp, cmd, addr); - NET_UNLOCK_GIANT(); } break; } @@ -837,9 +830,7 @@ break; } if (d->bd_promisc == 0) { - NET_LOCK_GIANT(); error = ifpromisc(d->bd_bif->bif_ifp, 1); - NET_UNLOCK_GIANT(); if (error == 0) d->bd_promisc = 1; } Index: net/bpfdesc.h =================================================================== RCS file: /home/ncvs/src/sys/net/bpfdesc.h,v retrieving revision 1.37 diff -u -r1.37 bpfdesc.h --- net/bpfdesc.h 26 Feb 2007 22:24:14 -0000 1.37 +++ net/bpfdesc.h 15 Jul 2007 21:42:25 -0000 @@ -102,10 +102,7 @@ #define BPFD_LOCK(bd) mtx_lock(&(bd)->bd_mtx) #define BPFD_UNLOCK(bd) mtx_unlock(&(bd)->bd_mtx) -#define BPFD_LOCK_ASSERT(bd) do { \ - mtx_assert(&(bd)->bd_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define BPFD_LOCK_ASSERT(bd) mtx_assert(&(bd)->bd_mtx, MA_OWNED) /* Test whether a BPF is ready for read(). */ #define bpf_ready(bd) \ Index: net/if.c =================================================================== RCS file: /home/ncvs/src/sys/net/if.c,v retrieving revision 1.272 diff -u -r1.272 if.c --- net/if.c 16 May 2007 19:59:01 -0000 1.272 +++ net/if.c 15 Jul 2007 21:42:42 -0000 @@ -2694,9 +2694,7 @@ if_start(struct ifnet *ifp) { - NET_ASSERT_GIANT(); - - if ((ifp->if_flags & IFF_NEEDSGIANT) != 0 && debug_mpsafenet != 0) { + if ((ifp->if_flags & IFF_NEEDSGIANT) != 0) { if (mtx_owned(&Giant)) (*(ifp)->if_start)(ifp); else @@ -2711,11 +2709,6 @@ { struct ifnet *ifp; - /* - * This code must be entered with Giant, and should never run if - * we're not running with debug.mpsafenet. - */ - KASSERT(debug_mpsafenet != 0, ("if_start_deferred: debug.mpsafenet")); GIANT_REQUIRED; ifp = context; Index: net/if_ethersubr.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v retrieving revision 1.234 diff -u -r1.234 if_ethersubr.c --- net/if_ethersubr.c 3 Jul 2007 12:46:06 -0000 1.234 +++ net/if_ethersubr.c 3 Jul 2007 23:09:07 -0000 @@ -922,7 +922,7 @@ break; if (i != ifp->if_addrlen) if_printf(ifp, "Ethernet address: %6D\n", lla, ":"); - if (debug_mpsafenet && (ifp->if_flags & IFF_NEEDSGIANT) != 0) + if ((ifp->if_flags & IFF_NEEDSGIANT) != 0) if_printf(ifp, "if_start running deferred for Giant\n"); } Index: net/netisr.c =================================================================== RCS file: /home/ncvs/src/sys/net/netisr.c,v retrieving revision 1.18 diff -u -r1.18 netisr.c --- net/netisr.c 28 Nov 2006 11:19:36 -0000 1.18 +++ net/netisr.c 1 Jun 2007 10:48:48 -0000 @@ -56,24 +56,6 @@ #include #include -/* - * debug_mpsafenet controls network subsystem-wide use of the Giant lock, - * from system calls down to interrupt handlers. It can be changed only via - * a tunable at boot, not at run-time, due to the complexity of unwinding. - * The compiled default is set via a kernel option; right now, the default - * unless otherwise specified is to run the network stack without Giant. - */ -#ifdef NET_WITH_GIANT -int debug_mpsafenet = 0; -#else -int debug_mpsafenet = 1; -#endif -int debug_mpsafenet_toolatetotwiddle = 0; - -TUNABLE_INT("debug.mpsafenet", &debug_mpsafenet); -SYSCTL_INT(_debug, OID_AUTO, mpsafenet, CTLFLAG_RD, &debug_mpsafenet, 0, - "Enable/disable MPSAFE network support"); - volatile unsigned int netisr; /* scheduling bits for network */ struct netisr { @@ -84,78 +66,6 @@ static void *net_ih; -/* - * Not all network code is currently capable of running MPSAFE; however, - * most of it is. Since those sections that are not are generally optional - * components not shipped with default kernels, we provide a basic way to - * determine whether MPSAFE operation is permitted: based on a default of - * yes, we permit non-MPSAFE components to use a registration call to - * identify that they require Giant. If the system is early in the boot - * process still, then we change the debug_mpsafenet setting to choose a - * non-MPSAFE execution mode (degraded). If it's too late for that (since - * the setting cannot be changed at run time), we generate a console warning - * that the configuration may be unsafe. - */ -static int mpsafe_warn_count; - -/* - * Function call implementing registration of a non-MPSAFE network component. - */ -void -net_warn_not_mpsafe(const char *component) -{ - - /* - * If we're running with Giant over the network stack, there is no - * problem. - */ - if (!debug_mpsafenet) - return; - - /* - * If it's not too late to change the MPSAFE setting for the network - * stack, do so now. This effectively suppresses warnings by - * components registering later. - */ - if (!debug_mpsafenet_toolatetotwiddle) { - debug_mpsafenet = 0; - printf("WARNING: debug.mpsafenet forced to 0 as %s requires " - "Giant\n", component); - return; - } - - /* - * We must run without Giant, so generate a console warning with some - * information with what to do about it. The system may be operating - * unsafely, however. - */ - printf("WARNING: Network stack Giant-free, but %s requires Giant.\n", - component); - if (mpsafe_warn_count == 0) - printf(" Consider adding 'options NET_WITH_GIANT' or " - "setting debug.mpsafenet=0\n"); - mpsafe_warn_count++; -} - -/* - * This sysinit is run after any pre-loaded or compiled-in components have - * announced that they require Giant, but before any modules loaded at - * run-time. - */ -static void -net_mpsafe_toolate(void *arg) -{ - - debug_mpsafenet_toolatetotwiddle = 1; - - if (!debug_mpsafenet) - printf("WARNING: MPSAFE network stack disabled, expect " - "reduced performance.\n"); -} - -SYSINIT(net_mpsafe_toolate, SI_SUB_SETTINGS, SI_ORDER_ANY, net_mpsafe_toolate, - NULL); - void legacy_setsoftnet(void) { @@ -170,7 +80,7 @@ ("bad isr %d", num)); netisrs[num].ni_handler = handler; netisrs[num].ni_queue = inq; - if ((flags & NETISR_MPSAFE) && !debug_mpsafenet) + if (flags & NETISR_MPSAFE) flags &= ~NETISR_MPSAFE; netisrs[num].ni_flags = flags; } Index: netatalk/aarp.c =================================================================== RCS file: /home/ncvs/src/sys/netatalk/aarp.c,v retrieving revision 1.42 diff -u -r1.42 aarp.c --- netatalk/aarp.c 12 Jan 2007 12:25:12 -0000 1.42 +++ netatalk/aarp.c 8 Jul 2007 20:48:07 -0000 @@ -117,8 +117,7 @@ 0x00, 0x00, 0x00, }; -static struct callout_handle aarptimer_ch = - CALLOUT_HANDLE_INITIALIZER(&aarptimer_ch); +static struct callout aarp_callout; static void aarptimer(void *ignored) @@ -126,9 +125,9 @@ struct aarptab *aat; int i; - aarptimer_ch = timeout(aarptimer, NULL, AARPT_AGE * hz); aat = aarptab; AARPTAB_LOCK(); + callout_reset(&aarp_callout, AARPT_AGE * hz, aarptimer, NULL); for (i = 0; i < AARPTAB_SIZE; i++, aat++) { if (aat->aat_flags == 0 || (aat->aat_flags & ATF_PERM)) continue; @@ -533,7 +532,8 @@ AARPTAB_LOCK_ASSERT(); if (first) { first = 0; - aarptimer_ch = timeout(aarptimer, (caddr_t)0, hz); + callout_init(&aarp_callout, CALLOUT_MPSAFE); + callout_reset(&aarp_callout, hz, aarptimer, NULL); } aat = &aarptab[AARPTAB_HASH(*addr) * AARPTAB_BSIZ]; for (n = 0; n < AARPTAB_BSIZ; n++, aat++) { @@ -660,14 +660,17 @@ aa->aa_probcnt--; } +/* + * XXXRW: aarp_clean is unused? + */ void aarp_clean(void) { struct aarptab *aat; int i; - untimeout(aarptimer, 0, aarptimer_ch); AARPTAB_LOCK(); + callout_stop(&aarp_callout); for (i = 0, aat = aarptab; i < AARPTAB_SIZE; i++, aat++) { if (aat->aat_hold) { m_freem(aat->aat_hold); Index: netgraph/netgraph.h =================================================================== RCS file: /home/ncvs/src/sys/netgraph/netgraph.h,v retrieving revision 1.67 diff -u -r1.67 netgraph.h --- netgraph/netgraph.h 17 Oct 2006 10:59:39 -0000 1.67 +++ netgraph/netgraph.h 1 Jun 2007 11:00:19 -0000 @@ -1097,7 +1097,7 @@ int ng_uncallout(struct callout *c, node_p node); int ng_callout(struct callout *c, node_p node, hook_p hook, int ticks, ng_item_fn *fn, void * arg1, int arg2); -#define ng_callout_init(c) callout_init(c, NET_CALLOUT_MPSAFE) +#define ng_callout_init(c) callout_init(c, CALLOUT_MPSAFE) /* Flags for netgraph functions. */ #define NG_NOFLAGS 0x00000000 /* no special options */ Index: netgraph/netflow/netflow.c =================================================================== RCS file: /home/ncvs/src/sys/netgraph/netflow/netflow.c,v retrieving revision 1.24 diff -u -r1.24 netflow.c --- netgraph/netflow/netflow.c 11 Oct 2006 13:28:37 -0000 1.24 +++ netgraph/netflow/netflow.c 1 Jun 2007 10:55:58 -0000 @@ -616,7 +616,6 @@ header->count = htons(header->count); if (priv->export != NULL) - /* Should also NET_LOCK_GIANT(). */ NG_FWD_ITEM_HOOK_FLAGS(error, item, priv->export, flags); return (error); Index: netinet/in_pcb.h =================================================================== RCS file: /home/ncvs/src/sys/netinet/in_pcb.h,v retrieving revision 1.99 diff -u -r1.99 in_pcb.h --- netinet/in_pcb.h 1 Jul 2007 11:38:27 -0000 1.99 +++ netinet/in_pcb.h 15 Jul 2007 21:43:24 -0000 @@ -269,10 +269,7 @@ #define INP_LOCK_DESTROY(inp) mtx_destroy(&(inp)->inp_mtx) #define INP_LOCK(inp) mtx_lock(&(inp)->inp_mtx) #define INP_UNLOCK(inp) mtx_unlock(&(inp)->inp_mtx) -#define INP_LOCK_ASSERT(inp) do { \ - mtx_assert(&(inp)->inp_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define INP_LOCK_ASSERT(inp) mtx_assert(&(inp)->inp_mtx, MA_OWNED); #define INP_UNLOCK_ASSERT(inp) mtx_assert(&(inp)->inp_mtx, MA_NOTOWNED) #define INP_INFO_LOCK_INIT(ipi, d) \ @@ -282,17 +279,9 @@ #define INP_INFO_WLOCK(ipi) mtx_lock(&(ipi)->ipi_mtx) #define INP_INFO_RUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx) #define INP_INFO_WUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx) -#define INP_INFO_RLOCK_ASSERT(ipi) do { \ - mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define INP_INFO_WLOCK_ASSERT(ipi) do { \ - mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define INP_INFO_UNLOCK_ASSERT(ipi) do { \ - mtx_assert(&(ipi)->ipi_mtx, MA_NOTOWNED); \ -} while (0) +#define INP_INFO_RLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_OWNED) +#define INP_INFO_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_OWNED) +#define INP_INFO_UNLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_mtx, MA_NOTOWNED) #define INP_PCBHASH(faddr, lport, fport, mask) \ (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) Index: netinet/ip_carp.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.50 diff -u -r1.50 ip_carp.c --- netinet/ip_carp.c 12 Jun 2007 16:24:53 -0000 1.50 +++ netinet/ip_carp.c 28 Jun 2007 13:32:25 -0000 @@ -384,9 +384,9 @@ sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS; sc->sc_imo.imo_multicast_vif = -1; - callout_init(&sc->sc_ad_tmo, NET_CALLOUT_MPSAFE); - callout_init(&sc->sc_md_tmo, NET_CALLOUT_MPSAFE); - callout_init(&sc->sc_md6_tmo, NET_CALLOUT_MPSAFE); + callout_init(&sc->sc_ad_tmo, CALLOUT_MPSAFE); + callout_init(&sc->sc_md_tmo, CALLOUT_MPSAFE); + callout_init(&sc->sc_md6_tmo, CALLOUT_MPSAFE); ifp->if_softc = sc; if_initname(ifp, CARP_IFNAME, unit); Index: netinet/ip_dummynet.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_dummynet.c,v retrieving revision 1.107 diff -u -r1.107 ip_dummynet.c --- netinet/ip_dummynet.c 17 Jun 2007 00:33:34 -0000 1.107 +++ netinet/ip_dummynet.c 28 Jun 2007 13:32:25 -0000 @@ -203,10 +203,7 @@ #define DUMMYNET_LOCK_DESTROY() mtx_destroy(&dummynet_mtx) #define DUMMYNET_LOCK() mtx_lock(&dummynet_mtx) #define DUMMYNET_UNLOCK() mtx_unlock(&dummynet_mtx) -#define DUMMYNET_LOCK_ASSERT() do { \ - mtx_assert(&dummynet_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define DUMMYNET_LOCK_ASSERT() mtx_assert(&dummynet_mtx, MA_OWNED) static int config_pipe(struct dn_pipe *p); static int ip_dn_ctl(struct sockopt *sopt); @@ -738,7 +735,6 @@ void *p; /* generic parameter to handler */ int i; - NET_LOCK_GIANT(); DUMMYNET_LOCK(); heaps[0] = &ready_heap; /* fixed-rate queues */ @@ -825,8 +821,6 @@ dummynet_send(head); callout_reset(&dn_timeout, 1, dummynet, NULL); - - NET_UNLOCK_GIANT(); } static void @@ -2141,7 +2135,7 @@ taskqueue_thread_enqueue, &dn_tq); taskqueue_start_threads(&dn_tq, 1, PI_NET, "dummynet"); - callout_init(&dn_timeout, NET_CALLOUT_MPSAFE); + callout_init(&dn_timeout, CALLOUT_MPSAFE); callout_reset(&dn_timeout, 1, dummynet, NULL); /* Initialize curr_time adjustment mechanics. */ Index: netinet/ip_fw2.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_fw2.c,v retrieving revision 1.169 diff -u -r1.169 ip_fw2.c --- netinet/ip_fw2.c 3 Jul 2007 12:46:06 -0000 1.169 +++ netinet/ip_fw2.c 15 Jul 2007 21:43:46 -0000 @@ -147,10 +147,8 @@ #define IPFW_LOCK_INIT(_chain) \ rw_init(&(_chain)->rwmtx, "IPFW static rules") #define IPFW_LOCK_DESTROY(_chain) rw_destroy(&(_chain)->rwmtx) -#define IPFW_WLOCK_ASSERT(_chain) do { \ - rw_assert(&(_chain)->rwmtx, RA_WLOCKED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define IPFW_WLOCK_ASSERT(_chain) \ + rw_assert(&(_chain)->rwmtx, RA_WLOCKED); #define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx) #define IPFW_RUNLOCK(p) rw_runlock(&(p)->rwmtx) @@ -4937,7 +4935,7 @@ sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); IPFW_DYN_LOCK_INIT(); - callout_init(&ipfw_timeout, NET_CALLOUT_MPSAFE); + callout_init(&ipfw_timeout, CALLOUT_MPSAFE); bzero(&default_rule, sizeof default_rule); Index: netinet/ip_mroute.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_mroute.c,v retrieving revision 1.135 diff -u -r1.135 ip_mroute.c --- netinet/ip_mroute.c 10 May 2007 15:58:47 -0000 1.135 +++ netinet/ip_mroute.c 15 Jul 2007 21:44:11 -0000 @@ -149,10 +149,7 @@ static struct mtx mrouter_mtx; #define MROUTER_LOCK() mtx_lock(&mrouter_mtx) #define MROUTER_UNLOCK() mtx_unlock(&mrouter_mtx) -#define MROUTER_LOCK_ASSERT() do { \ - mtx_assert(&mrouter_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define MROUTER_LOCK_ASSERT() mtx_assert(&mrouter_mtx, MA_OWNED) #define MROUTER_LOCK_INIT() \ mtx_init(&mrouter_mtx, "IPv4 multicast forwarding", NULL, MTX_DEF) #define MROUTER_LOCK_DESTROY() mtx_destroy(&mrouter_mtx) @@ -160,10 +157,7 @@ static struct mtx mfc_mtx; #define MFC_LOCK() mtx_lock(&mfc_mtx) #define MFC_UNLOCK() mtx_unlock(&mfc_mtx) -#define MFC_LOCK_ASSERT() do { \ - mtx_assert(&mfc_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) +#define MFC_LOCK_ASSERT() mtx_assert(&mfc_mtx, MA_OWNED) #define MFC_LOCK_INIT() mtx_init(&mfc_mtx, "mroute mfc table", NULL, MTX_DEF) #define MFC_LOCK_DESTROY() mtx_destroy(&mfc_mtx) @@ -639,12 +633,12 @@ pim_assert = 0; mrt_api_config = 0; - callout_init(&expire_upcalls_ch, NET_CALLOUT_MPSAFE); + callout_init(&expire_upcalls_ch, CALLOUT_MPSAFE); bw_upcalls_n = 0; bzero((caddr_t)bw_meter_timers, sizeof(bw_meter_timers)); - callout_init(&bw_upcalls_ch, NET_CALLOUT_MPSAFE); - callout_init(&bw_meter_ch, NET_CALLOUT_MPSAFE); + callout_init(&bw_upcalls_ch, CALLOUT_MPSAFE); + callout_init(&bw_meter_ch, CALLOUT_MPSAFE); } static void Index: netinet/sctp_input.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/sctp_input.c,v retrieving revision 1.50 diff -u -r1.50 sctp_input.c --- netinet/sctp_input.c 14 Jul 2007 09:36:27 -0000 1.50 +++ netinet/sctp_input.c 14 Jul 2007 14:31:53 -0000 @@ -2170,11 +2170,9 @@ * We do this to keep the sockets side happy durin * the sonewcon ONLY. */ - NET_LOCK_GIANT(); SCTP_TCB_UNLOCK((*stcb)); so = sonewconn(oso, 0 ); - NET_UNLOCK_GIANT(); SCTP_INP_WLOCK((*stcb)->sctp_ep); SCTP_TCB_LOCK((*stcb)); SCTP_INP_WUNLOCK((*stcb)->sctp_ep); Index: netinet/tcp_subr.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/tcp_subr.c,v retrieving revision 1.291 diff -u -r1.291 tcp_subr.c --- netinet/tcp_subr.c 5 Jul 2007 06:04:46 -0000 1.291 +++ netinet/tcp_subr.c 8 Jul 2007 20:43:06 -0000 @@ -591,12 +591,8 @@ tcp_mssdflt; /* Set up our timeouts. */ - if (NET_CALLOUT_MPSAFE) - callout_init_mtx(&tp->t_timers->tt_timer, &inp->inp_mtx, - CALLOUT_RETURNUNLOCKED); - else - callout_init_mtx(&tp->t_timers->tt_timer, &inp->inp_mtx, - (CALLOUT_RETURNUNLOCKED|CALLOUT_NETGIANT)); + callout_init_mtx(&tp->t_timers->tt_timer, &inp->inp_mtx, + CALLOUT_RETURNUNLOCKED); if (tcp_do_rfc1323) tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP); Index: netinet/tcp_syncache.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/tcp_syncache.c,v retrieving revision 1.123 diff -u -r1.123 tcp_syncache.c --- netinet/tcp_syncache.c 3 Jul 2007 12:13:43 -0000 1.123 +++ netinet/tcp_syncache.c 15 Jul 2007 21:44:29 -0000 @@ -559,7 +559,6 @@ struct tcpcb *tp; char *s; - NET_ASSERT_GIANT(); INP_INFO_WLOCK_ASSERT(&tcbinfo); /* Index: netipsec/xform_ah.c =================================================================== RCS file: /home/ncvs/src/sys/netipsec/xform_ah.c,v retrieving revision 1.14 diff -u -r1.14 xform_ah.c --- netipsec/xform_ah.c 1 Jul 2007 11:38:29 -0000 1.14 +++ netipsec/xform_ah.c 1 Jul 2007 12:48:51 -0000 @@ -735,8 +735,6 @@ caddr_t ptr; int authsize; - NET_LOCK_GIANT(); - crd = crp->crp_desc; tc = (struct tdb_crypto *) crp->crp_opaque; @@ -767,11 +765,8 @@ if (sav->tdb_cryptoid != 0) sav->tdb_cryptoid = crp->crp_sid; - if (crp->crp_etype == EAGAIN) { - error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); - return error; - } + if (crp->crp_etype == EAGAIN) + return crypto_dispatch(crp); ahstat.ahs_noxform++; DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype)); @@ -863,7 +858,6 @@ IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag); KEY_FREESAV(&sav); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -874,7 +868,6 @@ free(tc, M_XDATA); if (crp != NULL) crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } @@ -1125,8 +1118,6 @@ caddr_t ptr; int err; - NET_LOCK_GIANT(); - tc = (struct tdb_crypto *) crp->crp_opaque; IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); skip = tc->tc_skip; @@ -1153,9 +1144,7 @@ if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); - return error; + return crypto_dispatch(crp); } ahstat.ahs_noxform++; @@ -1201,7 +1190,6 @@ err = ipsec_process_done(m, isr); KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - NET_UNLOCK_GIANT(); return err; bad: if (sav) @@ -1211,7 +1199,6 @@ m_freem(m); free(tc, M_XDATA); crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } Index: netipsec/xform_esp.c =================================================================== RCS file: /home/ncvs/src/sys/netipsec/xform_esp.c,v retrieving revision 1.19 diff -u -r1.19 xform_esp.c --- netipsec/xform_esp.c 9 May 2007 19:37:02 -0000 1.19 +++ netipsec/xform_esp.c 1 Jun 2007 10:57:13 -0000 @@ -462,8 +462,6 @@ struct secasindex *saidx; caddr_t ptr; - NET_LOCK_GIANT(); - crd = crp->crp_desc; IPSEC_ASSERT(crd != NULL, ("null crypto descriptor!")); @@ -500,9 +498,7 @@ if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); - error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); - return error; + return crypto_dispatch(crp); } espstat.esps_noxform++; @@ -631,7 +627,6 @@ IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag); KEY_FREESAV(&sav); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -642,7 +637,6 @@ free(tc, M_XDATA); if (crp != NULL) crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } @@ -896,8 +890,6 @@ struct mbuf *m; int err, error; - NET_LOCK_GIANT(); - tc = (struct tdb_crypto *) crp->crp_opaque; IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); m = (struct mbuf *) crp->crp_buf; @@ -925,9 +917,7 @@ if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); - return error; + return crypto_dispatch(crp); } espstat.esps_noxform++; @@ -973,7 +963,6 @@ err = ipsec_process_done(m, isr); KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - NET_UNLOCK_GIANT(); return err; bad: if (sav) @@ -983,7 +972,6 @@ m_freem(m); free(tc, M_XDATA); crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } Index: netipsec/xform_ipcomp.c =================================================================== RCS file: /home/ncvs/src/sys/netipsec/xform_ipcomp.c,v retrieving revision 1.10 diff -u -r1.10 xform_ipcomp.c --- netipsec/xform_ipcomp.c 23 Mar 2006 23:26:34 -0000 1.10 +++ netipsec/xform_ipcomp.c 1 Jun 2007 10:57:35 -0000 @@ -219,8 +219,6 @@ u_int8_t nproto; caddr_t addr; - NET_LOCK_GIANT(); - crd = crp->crp_desc; tc = (struct tdb_crypto *) crp->crp_opaque; @@ -251,9 +249,7 @@ if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); - error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); - return error; + return crypto_dispatch(crp); } ipcompstat.ipcomps_noxform++; @@ -306,7 +302,6 @@ IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, NULL); KEY_FREESAV(&sav); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -317,7 +312,6 @@ free(tc, M_XDATA); if (crp) crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } @@ -499,8 +493,6 @@ struct mbuf *m; int error, skip, rlen; - NET_LOCK_GIANT(); - tc = (struct tdb_crypto *) crp->crp_opaque; IPSEC_ASSERT(tc != NULL, ("null opaque data area!")); m = (struct mbuf *) crp->crp_buf; @@ -527,9 +519,7 @@ if (crp->crp_etype == EAGAIN) { KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - error = crypto_dispatch(crp); - NET_UNLOCK_GIANT(); - return error; + return crypto_dispatch(crp); } ipcompstat.ipcomps_noxform++; DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype)); @@ -582,7 +572,6 @@ error = ipsec_process_done(m, isr); KEY_FREESAV(&sav); IPSECREQUEST_UNLOCK(isr); - NET_UNLOCK_GIANT(); return error; bad: if (sav) @@ -592,7 +581,6 @@ m_freem(m); free(tc, M_XDATA); crypto_freereq(crp); - NET_UNLOCK_GIANT(); return error; } Index: nfsclient/bootp_subr.c =================================================================== RCS file: /home/ncvs/src/sys/nfsclient/bootp_subr.c,v retrieving revision 1.69 diff -u -r1.69 bootp_subr.c --- nfsclient/bootp_subr.c 27 Feb 2007 17:23:29 -0000 1.69 +++ nfsclient/bootp_subr.c 15 Jul 2007 21:44:44 -0000 @@ -590,8 +590,6 @@ int retry; const char *s; - NET_ASSERT_GIANT(); - /* * Create socket and set its recieve timeout. */ @@ -982,8 +980,6 @@ struct ifaddr *ifa; struct sockaddr_dl *sdl; - NET_ASSERT_GIANT(); - error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td); if (error != 0) panic("nfs_boot: socreate, error=%d", error); Index: nfsclient/krpc_subr.c =================================================================== RCS file: /home/ncvs/src/sys/nfsclient/krpc_subr.c,v retrieving revision 1.29 diff -u -r1.29 krpc_subr.c --- nfsclient/krpc_subr.c 16 Mar 2005 08:13:08 -0000 1.29 +++ nfsclient/krpc_subr.c 15 Jul 2007 21:44:55 -0000 @@ -215,8 +215,6 @@ nam = mhead = NULL; from = NULL; - NET_ASSERT_GIANT(); - /* * Create socket and set its recieve timeout. */ Index: nfsclient/nfs_socket.c =================================================================== RCS file: /home/ncvs/src/sys/nfsclient/nfs_socket.c,v retrieving revision 1.153 diff -u -r1.153 nfs_socket.c --- nfsclient/nfs_socket.c 18 May 2007 19:34:54 -0000 1.153 +++ nfsclient/nfs_socket.c 1 Jun 2007 10:57:51 -0000 @@ -265,8 +265,6 @@ struct sockaddr *saddr; struct thread *td = &thread0; /* only used for socreate and sobind */ - NET_LOCK_GIANT(); - if (nmp->nm_sotype == SOCK_STREAM) { mtx_lock(&nmp->nm_mtx); nmp->nm_nfstcpstate.flags |= NFS_TCP_EXPECT_RPCMARKER; @@ -458,12 +456,10 @@ nmp->nm_sent = 0; nmp->nm_timeouts = 0; mtx_unlock(&nmp->nm_mtx); - NET_UNLOCK_GIANT(); return (0); bad: nfs_disconnect(nmp); - NET_UNLOCK_GIANT(); return (error); } @@ -531,8 +527,6 @@ { struct socket *so; - NET_ASSERT_GIANT(); - mtx_lock(&nmp->nm_mtx); if (nmp->nm_so) { so = nmp->nm_so; @@ -573,8 +567,6 @@ struct sockaddr *sendnam; int error, error2, soflags, flags; - NET_LOCK_GIANT(); - KASSERT(rep, ("nfs_send: called with rep == NULL")); error = nfs_sigintr(rep->r_nmp, rep, rep->r_td); @@ -645,7 +637,6 @@ error = 0; } out: - NET_UNLOCK_GIANT(); return (error); } @@ -656,8 +647,6 @@ register struct mbuf *m; int error = 0, sotype, slpflag; - NET_LOCK_GIANT(); - sotype = rep->r_nmp->nm_sotype; /* * For reliable protocols, lock against other senders/receivers @@ -758,7 +747,6 @@ } } out: - NET_UNLOCK_GIANT(); return (error); } @@ -1475,7 +1463,6 @@ rep->r_flags |= R_PIN_REQ; mtx_unlock(&rep->r_mtx); mtx_unlock(&nfs_reqq_mtx); - NET_LOCK_GIANT(); if ((nmp->nm_flag & NFSMNT_NOCONN) == 0) error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, curthread); @@ -1483,7 +1470,6 @@ error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, nmp->nm_nam, NULL, curthread); - NET_UNLOCK_GIANT(); mtx_lock(&nfs_reqq_mtx); mtx_lock(&nmp->nm_mtx); mtx_lock(&rep->r_mtx); Index: nfsclient/nfs_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/nfsclient/nfs_vfsops.c,v retrieving revision 1.192 diff -u -r1.192 nfs_vfsops.c --- nfsclient/nfs_vfsops.c 23 Mar 2007 08:52:36 -0000 1.192 +++ nfsclient/nfs_vfsops.c 15 Jul 2007 21:45:03 -0000 @@ -408,8 +408,6 @@ char buf[128]; char *cp; - NET_ASSERT_GIANT(); - #if defined(BOOTP_NFSROOT) && defined(BOOTP) bootpc_init(); /* use bootp to get nfs_diskless filled in */ #elif defined(NFS_ROOT) Index: nfsserver/nfs_srvsock.c =================================================================== RCS file: /home/ncvs/src/sys/nfsserver/nfs_srvsock.c,v retrieving revision 1.103 diff -u -r1.103 nfs_srvsock.c --- nfsserver/nfs_srvsock.c 15 Apr 2007 15:50:50 -0000 1.103 +++ nfsserver/nfs_srvsock.c 15 Jul 2007 21:45:22 -0000 @@ -413,12 +413,6 @@ struct uio auio; int flags, error; - /* - * XXXRW: For now, assert Giant here since the NFS server upcall - * will perform socket operations requiring Giant in a non-mpsafe - * kernel. - */ - NET_ASSERT_GIANT(); NFSD_UNLOCK_ASSERT(); /* XXXRW: Unlocked read. */ @@ -761,7 +755,6 @@ struct sockaddr *sendnam; int error, soflags, flags; - NET_ASSERT_GIANT(); NFSD_UNLOCK_ASSERT(); soflags = so->so_proto->pr_flags; Index: nfsserver/nfs_srvsubs.c =================================================================== RCS file: /home/ncvs/src/sys/nfsserver/nfs_srvsubs.c,v retrieving revision 1.147 diff -u -r1.147 nfs_srvsubs.c --- nfsserver/nfs_srvsubs.c 2 Apr 2007 13:53:26 -0000 1.147 +++ nfsserver/nfs_srvsubs.c 1 Jun 2007 10:57:57 -0000 @@ -526,7 +526,6 @@ static int registered; int error = 0; - NET_LOCK_GIANT(); switch (type) { case MOD_LOAD: mtx_init(&nfsd_mtx, "nfsd_mtx", NULL, MTX_DEF); @@ -549,10 +548,7 @@ nfsrv_initcache(); /* Init the server request cache */ NFSD_LOCK(); nfsrv_init(0); /* Init server data structures */ - if (debug_mpsafenet) - callout_init(&nfsrv_callout, CALLOUT_MPSAFE); - else - callout_init(&nfsrv_callout, 0); + callout_init(&nfsrv_callout, CALLOUT_MPSAFE); NFSD_UNLOCK(); nfsrv_timer(0); @@ -580,7 +576,6 @@ error = EOPNOTSUPP; break; } - NET_UNLOCK_GIANT(); return error; } static moduledata_t nfsserver_mod = { Index: nfsserver/nfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/nfsserver/nfs_syscalls.c,v retrieving revision 1.114 diff -u -r1.114 nfs_syscalls.c --- nfsserver/nfs_syscalls.c 22 Apr 2007 15:31:21 -0000 1.114 +++ nfsserver/nfs_syscalls.c 1 Jun 2007 10:58:10 -0000 @@ -134,7 +134,6 @@ error = priv_check(td, PRIV_NFS_DAEMON); if (error) return (error); - NET_LOCK_GIANT(); NFSD_LOCK(); while (nfssvc_sockhead_flag & SLP_INIT) { nfssvc_sockhead_flag |= SLP_WANTINIT; @@ -175,7 +174,6 @@ if (error == EINTR || error == ERESTART) error = 0; done2: - NET_UNLOCK_GIANT(); return (error); } @@ -190,8 +188,6 @@ struct socket *so; int error, s; - NET_ASSERT_GIANT(); - so = fp->f_data; #if 0 /* @@ -305,8 +301,6 @@ int procrastinate; u_quad_t cur_usec; - NET_ASSERT_GIANT(); - #ifndef nolint cacherep = RC_DOIT; writes_todo = 0; @@ -561,16 +555,8 @@ nfsd->nfsd_slp = NULL; nfsrv_slpderef(slp); } - KASSERT(!(debug_mpsafenet == 0 && !mtx_owned(&Giant)), - ("nfssvc_nfsd(): debug.mpsafenet=0 && !Giant")); - KASSERT(!(debug_mpsafenet == 1 && mtx_owned(&Giant)), - ("nfssvc_nfsd(): debug.mpsafenet=1 && Giant")); } done: - KASSERT(!(debug_mpsafenet == 0 && !mtx_owned(&Giant)), - ("nfssvc_nfsd(): debug.mpsafenet=0 && !Giant")); - KASSERT(!(debug_mpsafenet == 1 && mtx_owned(&Giant)), - ("nfssvc_nfsd(): debug.mpsafenet=1 && Giant")); TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain); splx(s); free((caddr_t)nfsd, M_NFSD); @@ -596,7 +582,6 @@ struct nfsrv_rec *rec; int s; - NET_ASSERT_GIANT(); NFSD_LOCK_ASSERT(); /* @@ -709,7 +694,6 @@ { struct nfssvc_sock *slp, *nslp; - NET_ASSERT_GIANT(); NFSD_LOCK_ASSERT(); if (nfssvc_sockhead_flag & SLP_INIT) Index: pci/if_xl.c =================================================================== RCS file: /home/ncvs/src/sys/pci/if_xl.c,v retrieving revision 1.209 diff -u -r1.209 if_xl.c --- pci/if_xl.c 23 Feb 2007 12:19:03 -0000 1.209 +++ pci/if_xl.c 1 Jun 2007 10:55:42 -0000 @@ -2102,12 +2102,10 @@ { struct xl_softc *sc = (struct xl_softc *)arg; - NET_LOCK_GIANT(); XL_LOCK(sc); if (sc->xl_ifp->if_drv_flags & IFF_DRV_RUNNING) xl_rxeof(sc); XL_UNLOCK(sc); - NET_UNLOCK_GIANT(); } /* Index: rpc/rpcclnt.c =================================================================== RCS file: /home/ncvs/src/sys/rpc/rpcclnt.c,v retrieving revision 1.19 diff -u -r1.19 rpcclnt.c --- rpc/rpcclnt.c 16 Jun 2007 05:42:26 -0000 1.19 +++ rpc/rpcclnt.c 28 Jun 2007 13:32:33 -0000 @@ -365,11 +365,8 @@ saddr = rpc->rc_name; - NET_LOCK_GIANT(); error = socreate(saddr->sa_family, &rpc->rc_so, rpc->rc_sotype, rpc->rc_soproto, td->td_ucred, td); - NET_UNLOCK_GIANT(); - if (error) { RPCDEBUG("error %d in socreate()", error); RPC_RETURN(error); @@ -627,10 +624,8 @@ if (rpc->rc_so) { so = rpc->rc_so; rpc->rc_so = NULL; - NET_LOCK_GIANT(); soshutdown(so, 2); soclose(so); - NET_UNLOCK_GIANT(); } } @@ -708,10 +703,7 @@ * to be conditionally acquired earlier for the stack so has to avoid * lock order reversals with any locks held over rpcclnt_send(). */ - NET_LOCK_GIANT(); error = sosend(so, sendnam, NULL, top, NULL, flags, td); - NET_UNLOCK_GIANT(); - if (error) { if (rep) { log(LOG_INFO, "rpc send error %d for service %s\n", error, @@ -838,9 +830,7 @@ #endif do { rcvflg = MSG_WAITALL; - NET_LOCK_GIANT(); error = soreceive(so, NULL, &auio, NULL, NULL, &rcvflg); - NET_UNLOCK_GIANT(); if (error == EWOULDBLOCK && rep) { if (rep->r_flags & R_SOFTTERM) RPC_RETURN(EINTR); @@ -873,9 +863,7 @@ auio.uio_resid = len; do { rcvflg = MSG_WAITALL; - NET_LOCK_GIANT(); error = soreceive(so, NULL, &auio, mp, NULL, &rcvflg); - NET_UNLOCK_GIANT(); } while (error == EWOULDBLOCK || error == EINTR || error == ERESTART); if (!error && auio.uio_resid > 0) { @@ -901,9 +889,7 @@ #endif do { rcvflg = 0; - NET_LOCK_GIANT(); error = soreceive(so, NULL, &auio, mp, &control, &rcvflg); - NET_UNLOCK_GIANT(); if (control) m_freem(control); if (error == EWOULDBLOCK && rep) { @@ -949,9 +935,7 @@ do { rcvflg = 0; - NET_LOCK_GIANT(); error = soreceive(so, getnam, &auio, mp, NULL, &rcvflg); - NET_UNLOCK_GIANT(); RPCDEBUG("soreceive returns %d", error); if (error == EWOULDBLOCK && (rep->r_flags & R_SOFTTERM)) { RPCDEBUG("wouldblock && softerm -> EINTR"); Index: security/mac/mac_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/security/mac/mac_syscalls.c,v retrieving revision 1.131 diff -u -r1.131 mac_syscalls.c --- security/mac/mac_syscalls.c 4 Mar 2007 22:36:48 -0000 1.131 +++ security/mac/mac_syscalls.c 1 Jun 2007 10:58:35 -0000 @@ -278,11 +278,9 @@ case DTYPE_SOCKET: so = fp->f_data; intlabel = mac_socket_label_alloc(M_WAITOK); - NET_LOCK_GIANT(); SOCK_LOCK(so); mac_copy_socket_label(so->so_label, intlabel); SOCK_UNLOCK(so); - NET_UNLOCK_GIANT(); error = mac_externalize_socket_label(intlabel, elements, buffer, mac.m_buflen); mac_socket_label_free(intlabel); @@ -476,10 +474,8 @@ error = mac_internalize_socket_label(intlabel, buffer); if (error == 0) { so = fp->f_data; - NET_LOCK_GIANT(); error = mac_socket_label_set(td->td_ucred, so, intlabel); - NET_UNLOCK_GIANT(); } mac_socket_label_free(intlabel); break; Index: sys/kernel.h =================================================================== RCS file: /home/ncvs/src/sys/sys/kernel.h,v retrieving revision 1.135 diff -u -r1.135 kernel.h --- sys/kernel.h 9 Apr 2007 22:29:13 -0000 1.135 +++ sys/kernel.h 1 Jun 2007 10:47:09 -0000 @@ -343,11 +343,6 @@ #define TUNABLE_STR_FETCH(path, var, size) \ getenv_string((path), (var), (size)) -void net_warn_not_mpsafe(const char *component); -#define NET_NEEDS_GIANT(component) \ - SYSINIT(__CONCAT(__net_warn_not_mpsafe_, __LINE__), \ - SI_SUB_SETTINGS, SI_ORDER_SECOND, net_warn_not_mpsafe, component); - struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links; void (*ich_func)(void *arg); Index: sys/mutex.h =================================================================== RCS file: /home/ncvs/src/sys/sys/mutex.h,v retrieving revision 1.97 diff -u -r1.97 mutex.h --- sys/mutex.h 6 Jun 2007 03:40:47 -0000 1.97 +++ sys/mutex.h 28 Jun 2007 13:32:39 -0000 @@ -397,37 +397,6 @@ return (_val); \ } while (0) -/* - * Network MPSAFE temporary workarounds. When debug_mpsafenet - * is 1 the network is assumed to operate without Giant on the - * input path and protocols that require Giant must collect it - * on entry. When 0 Giant is grabbed in the network interface - * ISR's and in the netisr path and there is no need to grab - * the Giant lock. Note that, unlike PICKUP_GIANT() and - * DROP_GIANT(), these macros directly wrap mutex operations - * without special recursion handling. - * - * This mechanism is intended as temporary until everything of - * importance is properly locked. Note: the semantics for - * NET_{LOCK,UNLOCK}_GIANT() are not the same as DROP_GIANT() - * and PICKUP_GIANT(), as they are plain mutex operations - * without a recursion counter. - */ -extern int debug_mpsafenet; /* defined in net/netisr.c */ -#define NET_LOCK_GIANT() do { \ - if (!debug_mpsafenet) \ - mtx_lock(&Giant); \ -} while (0) -#define NET_UNLOCK_GIANT() do { \ - if (!debug_mpsafenet) \ - mtx_unlock(&Giant); \ -} while (0) -#define NET_ASSERT_GIANT() do { \ - if (!debug_mpsafenet) \ - mtx_assert(&Giant, MA_OWNED); \ -} while (0) -#define NET_CALLOUT_MPSAFE (debug_mpsafenet ? CALLOUT_MPSAFE : 0) - struct mtx_args { struct mtx *ma_mtx; const char *ma_desc;