cvs commit: src/sys/pci if_xl.c

Robert Watson rwatson at FreeBSD.org
Thu Jul 14 14:45:56 GMT 2005


On Thu, 14 Jul 2005, Andrew Gallatin wrote:

> Gleb Smirnoff [glebius at FreeBSD.org] wrote:
>> glebius     2005-07-13 14:06:13 UTC
>>
>>   FreeBSD src repository
>>
>>   Modified files:
>>     sys/pci              if_xl.c
>>   Log:
>>   NET_LOCK_GIANT() when entering network code.
>
> Do other drivers do this?  It looks like at least em, fxp and my 
> out-of-tree commercial driver have the same "bug".
>
> I would argue that any fiddling with Giant should go into the various 
> if_input routines instead.

This only applies in cases debug.mpsafenet=0, and where Giant isn't 
already held by virtue of the calling context.  For most network 
interface, almost all entry "into" the stack occurs from the device's 
interrupt handler, and we already twiddle the aquisition of Giant there 
via INTR_TYPE_NET / INTR_MPSAFE.  Because this occurs from a task queue, 
the driver has to manually acquire Giant, since the task queue code 
doesn't know that the driver requires Giant (due to entering the network 
stack in compatibility mode).

Hopefully, NET_LOCK_GIANT() will be an increasingly edge case, as 
relatively few network stack components still require Giant.  It exists 
only to support debug.mpsafenet=0, which is no longer the default.

Robert N M Watson


More information about the cvs-src mailing list