Date: Sat, 23 Dec 2006 10:27:13 -0800 (PST) From: John Polstra <jdp@polstra.com> To: Scott Long <scottl@samsco.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/bge if_bge.c Message-ID: <XFMail.20061223102713.jdp@polstra.com> In-Reply-To: <458BF314.3000702@samsco.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20061223102713.jdp>