Date: Thu, 29 Nov 2001 23:26:20 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Luigi Rizzo <rizzo@aciri.org> Cc: <net@FreeBSD.ORG> Subject: Re: Revised polling code for STABLE Message-ID: <20011129222256.W1389-100000@gamplex.bde.org> In-Reply-To: <20011126115704.L88153@iguana.aciri.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Mon, 26 Nov 2001, Luigi Rizzo wrote:
>
> > [Bcc to -stable in case someone is interested there]
> >
> > Attached you can find the latest version of the polling code
> > for STABLE (which is useful to make boxes much more robust
> > to attacks and have much better responsiveness under [over]load).
> > ...
> Index: sys/i386/i386/swtch.s
> ===================================================================
> RCS file: /home/xorpc/u2/freebsd/src/sys/i386/i386/swtch.s,v
> retrieving revision 1.89.2.4
> diff -u -r1.89.2.4 swtch.s
> --- sys/i386/i386/swtch.s 2001/07/26 02:29:10 1.89.2.4
> +++ sys/i386/i386/swtch.s 2001/10/26 21:54:19
> @@ -246,6 +246,17 @@
> call _procrunnable
> testl %eax,%eax
> CROSSJUMP(jnz, sw1a, jz)
> +#ifdef XORP_ETHER_POLLING
> + incl _idle_done
> + pushl _poll_burst
> + call _ether_poll
> + addl $4,%esp
> + sti
> + nop
> + cli
> + testl %eax, %eax
> + jnz idle_loop
> +#endif
> call _vm_page_zero_idle
> testl %eax, %eax
> jnz idle_loop
This has some serious bugs:
(1) ether_poll() is called with interrupts disabled. This breaks fast
interrupt handlers. ether_poll() uses splimp() so it is apparently
not intended to run with priority higher than splhigh().
(2) The sti/cli stuff belongs in ether_poll(), and the test of the return
code of ether_poll() only works because ether_poll() always returns 1.
vm_page_zero_idle() and the hlt instruction are never reached and the
system spins calling ether_poll() from idle until a process becomes
runnable. ether_poll() needs quite different handling than
vm_page_zero_idle() since it can reasonably find something to do
whenever an interface is up, while vm_page_zero_idle() soon runs out
of things to do if it is called a lot.
> Index: sys/kern/kern_clock.c
It shouldn't be necessary to touch this file. Everything involving
"ether" certainly doesn't belong here. Everything related to periodic
polling can be done, probably more efficiently, using schedsoft*() or
timeout(). E.g., schedsoftnet() arranges for netisrs to be checked
for at the next clock interrupt. But this can now be done almost as
well (probably better in -current) using an ordinary timeout.
Bruce
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011129222256.W1389-100000>
