On 21.11.2012 09:04, Luigi Rizzo wrote:
On Tue, Nov 20, 2012 at 11:32 PM, Andre Oppermann <an...@freebsd.org> wrote:
On 21.11.2012 03:16, khatfi...@socllc.net wrote:
I may be misstating.
Specifically under high burst floods either routed or being dropped by pf
we would see the system
go unresponsive to user-level applications / SSH for example.
The system would still function but it was inaccessible. To clarify as
well this was any number
of floods or attacks to any ports, the behavior remained. (These were not
SSH ports being hit)
I'm working on a hybrid interrupt/polling with live-lock prevention
scheme in my svn branch. It works with a combination of disabling
interrupts in interrupt context and then having an ithread loop over
the RX DMA queue until it reaches the hardware and is done. Only
then interrupts are re-enabled again. On a busy system it may never
go back to interrupt. To prevent live-lock the ithread gives up the
CPU after a normal quantum to let other threads/processes run as well.
After that it gets immediately re-scheduled again with a sufficient
high priority not get starved out by userspace.
very cool. this seems similar to NAPI.
I've heard about NAPI but haven't looked at it. So I'm not sure how it
works internally. In this case no special logic or kernel API support
is required. Every driver can be converted and immediately use it.
The only adjustment i'd suggest to your scheme, if possible, is to add
some control (as it existed in the old polling architecture) to make sure
that userspace is not starved by the ithreads and other kernel tasks
(otherwise you can have livelock, as it happens with NAPI).
I am afraid that simple priorities do not work, you either need some
kind of fair scheduler, or put some hard limit on the cpu fraction used
by the kernel tasks when there are userspace processes around.
That's the quantum stuff I talked about. When the ithread has used up
its CPU quantum it gives up the CPU but schedules itself again at the
same time. Also contrary to its name the ithread does not run in
interrupt context but as a normal kernel thread with elevated priority.
I have to thank Attilio though for a detailed explanation of what is
going on behind the scenes in the interrupt and scheduler code to get
a grip at the optimal approach for network drivers. The bus_setup_intr(9)
and ithread documentation is very poor and misleading at the moment.
I intend to fix that soon.
--
Andre
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"