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.34 diff -u -r1.34 if_pfsync.c --- contrib/pf/net/if_pfsync.c 14 Apr 2007 01:01:46 -0000 1.34 +++ contrib/pf/net/if_pfsync.c 1 Jun 2007 11:00:10 -0000 @@ -266,10 +266,10 @@ ifp->if_baudrate = IF_Mbps(100); ifp->if_softc = sc; pfsync_setmtu(sc, MCLBYTES); - callout_init(&sc->sc_tmo, NET_CALLOUT_MPSAFE); - callout_init(&sc->sc_bulk_tmo, NET_CALLOUT_MPSAFE); - callout_init(&sc->sc_bulkfail_tmo, NET_CALLOUT_MPSAFE); - callout_init(&sc->sc_send_tmo, NET_CALLOUT_MPSAFE); + callout_init(&sc->sc_tmo, CALLOUT_MPSAFE); + callout_init(&sc->sc_bulk_tmo, CALLOUT_MPSAFE); + callout_init(&sc->sc_bulkfail_tmo, CALLOUT_MPSAFE); + callout_init(&sc->sc_send_tmo, CALLOUT_MPSAFE); sc->sc_ifq.ifq_maxlen = ifqmaxlen; mtx_init(&sc->sc_ifq.ifq_mtx, ifp->if_xname, "pfsync send queue", MTX_DEF); Index: contrib/pf/net/pf_ioctl.c =================================================================== RCS file: /home/ncvs/src/sys/contrib/pf/net/pf_ioctl.c,v retrieving revision 1.27 diff -u -r1.27 pf_ioctl.c --- contrib/pf/net/pf_ioctl.c 1 Jan 2007 16:51:11 -0000 1.27 +++ contrib/pf/net/pf_ioctl.c 1 Jun 2007 11:00:13 -0000 @@ -358,7 +358,7 @@ my_timeout[PFTM_SRC_NODE] = PFTM_SRC_NODE_VAL; my_timeout[PFTM_TS_DIFF] = PFTM_TS_DIFF_VAL; - callout_init(&pf_expire_to, NET_CALLOUT_MPSAFE); + callout_init(&pf_expire_to, CALLOUT_MPSAFE); callout_reset(&pf_expire_to, my_timeout[PFTM_INTERVAL] * hz, pf_purge_timeout, &pf_expire_to); Index: dev/ath/if_ath.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ath/if_ath.c,v retrieving revision 1.168 diff -u -r1.168 if_ath.c --- dev/ath/if_ath.c 29 May 2007 16:13:59 -0000 1.168 +++ dev/ath/if_ath.c 1 Jun 2007 10:53:31 -0000 @@ -378,7 +378,7 @@ if_printf(ifp, "failed to allocate descriptors: %d\n", error); goto bad; } - callout_init(&sc->sc_scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init(&sc->sc_scan_ch, CALLOUT_MPSAFE); callout_init(&sc->sc_cal_ch, CALLOUT_MPSAFE); callout_init(&sc->sc_dfs_ch, CALLOUT_MPSAFE); @@ -877,11 +877,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++; } } @@ -2938,8 +2936,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); @@ -3175,8 +3171,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.12 diff -u -r1.12 amrr.c --- dev/ath/ath_rate/amrr/amrr.c 13 Dec 2006 19:34:34 -0000 1.12 +++ dev/ath/ath_rate/amrr/amrr.c 1 Jun 2007 10:49:34 -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.12 diff -u -r1.12 onoe.c --- dev/ath/ath_rate/onoe/onoe.c 13 Dec 2006 19:34:35 -0000 1.12 +++ dev/ath/ath_rate/onoe/onoe.c 1 Jun 2007 10:49:39 -0000 @@ -485,7 +485,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 1 Jun 2007 10:50:42 -0000 @@ -2604,7 +2604,7 @@ #if __FreeBSD_version < 500000 dev = makedev (CDEV_MAJOR, 0); #endif -#if __FreeBSD_version >= 501114 +#if __FreeBSD_version >= 501114 && __FreeBSD_version < 700000 if (!debug_mpsafenet && ce_mpsafenet) { printf ("WORNING! Network stack is not MPSAFE. " "Turning off debug.ce.mpsafenet.\n"); 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 1 Jun 2007 10:50:13 -0000 @@ -2265,11 +2265,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; 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 1 Jun 2007 10:50:18 -0000 @@ -2206,11 +2206,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; 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 1 Jun 2007 10:50:21 -0000 @@ -2523,11 +2523,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; Index: dev/em/if_em.c =================================================================== RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v retrieving revision 1.180 diff -u -r1.180 if_em.c --- dev/em/if_em.c 30 May 2007 23:32:21 -0000 1.180 +++ dev/em/if_em.c 1 Jun 2007 10:53:38 -0000 @@ -1488,7 +1488,6 @@ struct adapter *adapter = context; struct ifnet *ifp; - NET_LOCK_GIANT(); ifp = adapter->ifp; /* @@ -1507,7 +1506,6 @@ } em_enable_intr(adapter); - NET_UNLOCK_GIANT(); } /********************************************************************* Index: dev/ral/rt2560.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ral/rt2560.c,v retrieving revision 1.11 diff -u -r1.11 rt2560.c --- dev/ral/rt2560.c 19 Apr 2007 13:09:57 -0000 1.11 +++ dev/ral/rt2560.c 1 Jun 2007 10:50:48 -0000 @@ -195,7 +195,7 @@ MTX_DEF | MTX_RECURSE); callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); - callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init(&sc->scan_ch, CALLOUT_MPSAFE); callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE); /* retrieve RT2560 rev. no */ Index: dev/ral/rt2661.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ral/rt2661.c,v retrieving revision 1.11 diff -u -r1.11 rt2661.c --- dev/ral/rt2661.c 11 Mar 2007 22:43:35 -0000 1.11 +++ dev/ral/rt2661.c 1 Jun 2007 10:50:53 -0000 @@ -198,7 +198,7 @@ MTX_DEF | MTX_RECURSE); callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); - callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init(&sc->scan_ch, CALLOUT_MPSAFE); callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE); /* wait for NIC to initialize */ 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: dev/usb/if_rum.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/if_rum.c,v retrieving revision 1.3 diff -u -r1.3 if_rum.c --- dev/usb/if_rum.c 6 May 2007 21:06:08 -0000 1.3 +++ dev/usb/if_rum.c 1 Jun 2007 10:51:03 -0000 @@ -430,7 +430,7 @@ usb_init_task(&sc->sc_task, rum_task, sc); callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); - callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init(&sc->scan_ch, CALLOUT_MPSAFE); callout_init(&sc->amrr_ch, 0); Index: dev/usb/if_ural.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/if_ural.c,v retrieving revision 1.54 diff -u -r1.54 if_ural.c --- dev/usb/if_ural.c 29 May 2007 20:05:13 -0000 1.54 +++ dev/usb/if_ural.c 1 Jun 2007 10:50:58 -0000 @@ -411,7 +411,7 @@ usb_init_task(&sc->sc_task, ural_task, sc); callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); - callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0); + callout_init(&sc->scan_ch, CALLOUT_MPSAFE); callout_init(&sc->amrr_ch, 0); /* retrieve RT2570 rev. no */ Index: kern/kern_poll.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_poll.c,v retrieving revision 1.28 diff -u -r1.28 kern_poll.c --- kern/kern_poll.c 6 Dec 2006 06:34:55 -0000 1.28 +++ kern/kern_poll.c 1 Jun 2007 10:54:08 -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 1 Jun 2007 10:54:47 -0000 @@ -75,7 +75,6 @@ struct socket *so = fp->f_data; int error; - NET_LOCK_GIANT(); #ifdef MAC SOCK_LOCK(so); error = mac_check_socket_receive(active_cred, so); @@ -86,7 +85,6 @@ } #endif error = soreceive(so, 0, uio, 0, 0, 0); - NET_UNLOCK_GIANT(); return (error); } @@ -98,15 +96,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 +109,6 @@ psignal(uio->uio_td->td_proc, SIGPIPE); PROC_UNLOCK(uio->uio_td->td_proc); } - NET_UNLOCK_GIANT(); return (error); } @@ -125,9 +119,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 +199,6 @@ (so, cmd, data, 0, td)); break; } - NET_UNLOCK_GIANT(); return(error); } @@ -218,18 +209,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 +230,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 +254,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 +270,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 1 Jun 2007 10:51:37 -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!")); Index: kern/uipc_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.256 diff -u -r1.256 uipc_syscalls.c --- kern/uipc_syscalls.c 19 May 2007 20:50:59 -0000 1.256 +++ kern/uipc_syscalls.c 1 Jun 2007 11:10:50 -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.176 diff -u -r1.176 bpf.c --- net/bpf.c 26 Feb 2007 22:24:14 -0000 1.176 +++ net/bpf.c 1 Jun 2007 11:00:17 -0000 @@ -406,7 +406,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); @@ -644,16 +644,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); } 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 1 Jun 2007 10:52:17 -0000 @@ -2696,7 +2696,7 @@ 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 +2711,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.229 diff -u -r1.229 if_ethersubr.c --- net/if_ethersubr.c 29 May 2007 12:40:45 -0000 1.229 +++ net/if_ethersubr.c 1 Jun 2007 10:52:28 -0000 @@ -917,7 +917,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: 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/ip_carp.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.48 diff -u -r1.48 ip_carp.c --- netinet/ip_carp.c 2 Feb 2007 09:39:09 -0000 1.48 +++ netinet/ip_carp.c 1 Jun 2007 11:00:27 -0000 @@ -383,9 +383,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.106 diff -u -r1.106 ip_dummynet.c --- netinet/ip_dummynet.c 10 May 2007 15:58:47 -0000 1.106 +++ netinet/ip_dummynet.c 1 Jun 2007 11:00:30 -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.165 diff -u -r1.165 ip_fw2.c --- netinet/ip_fw2.c 10 May 2007 15:58:47 -0000 1.165 +++ netinet/ip_fw2.c 1 Jun 2007 11:00:34 -0000 @@ -4904,7 +4904,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 1 Jun 2007 11:00:39 -0000 @@ -639,12 +639,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.32 diff -u -r1.32 sctp_input.c --- netinet/sctp_input.c 30 May 2007 22:34:21 -0000 1.32 +++ netinet/sctp_input.c 1 Jun 2007 10:56:27 -0000 @@ -2096,11 +2096,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.286 diff -u -r1.286 tcp_subr.c --- netinet/tcp_subr.c 27 May 2007 17:02:54 -0000 1.286 +++ netinet/tcp_subr.c 1 Jun 2007 11:00:56 -0000 @@ -600,12 +600,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: netipsec/xform_ah.c =================================================================== RCS file: /home/ncvs/src/sys/netipsec/xform_ah.c,v retrieving revision 1.13 diff -u -r1.13 xform_ah.c --- netipsec/xform_ah.c 17 May 2006 18:30:28 -0000 1.13 +++ netipsec/xform_ah.c 1 Jun 2007 10:56:54 -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/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: 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.18 diff -u -r1.18 rpcclnt.c --- rpc/rpcclnt.c 25 Mar 2007 21:44:24 -0000 1.18 +++ rpc/rpcclnt.c 1 Jun 2007 10:58:29 -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.95 diff -u -r1.95 mutex.h --- sys/mutex.h 11 Apr 2007 13:44:55 -0000 1.95 +++ sys/mutex.h 1 Jun 2007 10:52:58 -0000 @@ -388,37 +388,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;