cvs commit: src/sys/net bpf.c

John Baldwin jhb at freebsd.org
Wed May 28 19:38:36 UTC 2008


On Tuesday 27 May 2008 11:00:18 am Christian S.J. Peron wrote:
> John
> 
> Sorry for the delay.  I don't think there was a reason.  I just
> took a look at the change and i think it should be safe to be MFCed

So I just thought of one problem with these changes.  They don't lock Giant 
around ifnet routines for non-MPSAFE ifnet drivers.  I'll probably just leave 
6.x alone for this reason.  This might should be fixed in 7?  Specifically, 
I'm thinking that you should be doing something like this for 7:

	if (ifp->if_flags & IFF_NEEDSGIANT)
		mtx_lock(&Giant);
	ifp->if_output(...);
	if (ifp->if_flags * IFF_NEEDSGIANT)
		mtx_unlock(&Giant);

The patch in this commit just did NET_LOCK_GIANT/NET_UNLOCK_GIANT.  For 6.x 
you would have to do both the IFF_NEEDSGIANT check and the NET_LOCK_GIANT 
stuff.

> On Wed, May 07, 2008 at 04:17:57PM -0400, John Baldwin wrote:
> > On Thursday 14 June 2007 10:53:51 pm Christian S.J. Peron wrote:
> > > csjp        2007-06-15 02:53:51 UTC
> > > 
> > >   FreeBSD src repository
> > > 
> > >   Modified files:
> > >     sys/net              bpf.c 
> > >   Log:
> > >   - Conditionally pickup Giant around the network interface
> > >     ioctl routines if we are running with !mpsafenet
> > >   - Change un-conditional Giant acquisition around ifpromisc
> > >     to occur only if we are running with !mpsafenet
> > >   
> > >   With these locking bits in place, we can now remove the Giant
> > >   requirement from BPF, so drop the D_NEEDGIANT device flag.
> > >   This change removes Giant acquisitions around BPF device
> > >   handlers (read, write, ioctl etc).
> > >   
> > >   MFC after:      1 month
> > >   Discussed with: rwatson
> > 
> > Would it be ok to MFC this to 6.x?  (Looks like it was just never MFC'd, 
was 
> > curious if a reason came up why it couldn't be MFC'd?)
> > 
> > -- 
> > John Baldwin
> 



-- 
John Baldwin


More information about the cvs-src mailing list