cvs commit: src/sys/dev/bge if_bge.c
John Polstra
jdp at polstra.com
Sat Dec 23 10:58:07 PST 2006
On 22-Dec-2006 Scott Long wrote:
> In any case, the driver lock must not be held when calling if_input
> because there are many ways the codepath can loop from there back into
> if_start of the same driver or another driver. There is no way around
> this without doing big decoupling steps that will impact common
> performance cases.
Agreed.
> That said, dropping and regrabbing the driver lock in the rxeof
> routine of any driver is bad. It may be safe to do, but it
> incurs horrible performance penalties. It essentially allows the
> time-critical, high priority RX path to be constantly preempted by
> the lower priority if_start or if_ioctl paths. Even without this
> preemption and priority inversion, you're doing an excessive number
> of expensive lock ops in the fast path.
We currently make this a lot worse than it needs to be by handing off
the received packets one at a time, unlocking and relocking for every
packet. It would be better if the driver's receive interrupt handler
would harvest all of the incoming packets and queue them locally.
Then, at the end, hand off the linked list of packets to the network
stack wholesale, unlocking and relocking only once. (Actually, the
list could probably be handed off at the very end of the interrupt
service routine, after the driver has already dropped its lock.) We
wouldn't even need a new primitive, if ether_input() and the other
if_input() functions were enhanced to deal with a possible list of
packets instead of just a single one.
John
More information about the cvs-src
mailing list