Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-17 Thread Benjamin Herrenschmidt
On Wed, 2007-10-17 at 08:31 -0700, Stephen Hemminger wrote: > Please don't use double underscore, for this function name. There is no > reason to not make it a normal API call. > > The sky2 fix I am working on will use napi_synchronize as well. Allright. A compiler barrier in the !SMP case makes

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-17 Thread Stephen Hemminger
Please don't use double underscore, for this function name. There is no reason to not make it a normal API call. The sky2 fix I am working on will use napi_synchronize as well. --- a/include/linux/netdevice.h 2007-10-16 16:48:20.0 -0700 +++ b/include/linux/netdevice.h 2007-10-17 08:29:55.

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread Benjamin Herrenschmidt
\ > > Note: unfortunately, Jeff already picked up the EMAC patch without > > waiting for this to be sorted out (oops...). So if you agree with > > this patch, it would be nice to have it go in quickly or maybe via > > Jeff's tree to avoid breakage ? Not terribly important tho. > > > Sorry, I thou

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread Jeff Garzik
Benjamin Herrenschmidt wrote: > net: Add __napi_synchronize() to sync with napi poll > > The EMAC driver which needs to handle multiple devices with one > NAPI instance implements its own per-channel disable bit. However, > when setting such a bit, it needs to synchronize with the poller > (that i

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread Benjamin Herrenschmidt
net: Add __napi_synchronize() to sync with napi poll The EMAC driver which needs to handle multiple devices with one NAPI instance implements its own per-channel disable bit. However, when setting such a bit, it needs to synchronize with the poller (that is make sure that any pending poller instan

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread Benjamin Herrenschmidt
napi: use non-interruptible sleep in napi_disable The current napi_disable() uses msleep_interruptible() but doesn't (and can't) exit in case there's a signal, thus ending up doing a hot spin without a cpu_relax. Use uninterruptible sleep instead. Signed-off-by: Benjamin Herrenschmidt <[EMAIL PRO

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread Benjamin Herrenschmidt
> So this is really just like synchronize_irq()? Using msleep is bogus > because you want to spin, you are only waiting for a softirq on the other > cpu to finish. If you wait for a whole millisecond and sleep that > is far longer than the napi routine should take. > > You could even optimize it

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread Stephen Hemminger
On Tue, 16 Oct 2007 15:49:52 +1000 Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > net: Add __napi_sycnhronize() to sync with napi poll > > The EMAC driver which needs to handle multiple devices with one > NAPI instance implements its own per-channel disable bit. However, > when setting such

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread David Miller
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Date: Tue, 16 Oct 2007 17:37:03 +1000 > > On Tue, 2007-10-16 at 14:06 +0800, Herbert Xu wrote: > > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > > > > > Note: I use msleep_interruptible(1); just like napi_disable(). However > > > I'm not to

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-16 Thread Benjamin Herrenschmidt
On Tue, 2007-10-16 at 14:06 +0800, Herbert Xu wrote: > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > > > Note: I use msleep_interruptible(1); just like napi_disable(). However > > I'm not too happy that the "hot" loop that results of a pending signal > > here will spin without even a cpu_r

Re: [PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-15 Thread Herbert Xu
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > Note: I use msleep_interruptible(1); just like napi_disable(). However > I'm not too happy that the "hot" loop that results of a pending signal > here will spin without even a cpu_relax ... what do you guys think would > be the best way to handl

[PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-15 Thread Benjamin Herrenschmidt
net: Add __napi_sycnhronize() to sync with napi poll The EMAC driver which needs to handle multiple devices with one NAPI instance implements its own per-channel disable bit. However, when setting such a bit, it needs to synchronize with the poller (that is make sure that any pending poller instan

[PATCH/RFC] net: Add __napi_sycnhronize() to sync with napi poll

2007-10-15 Thread Benjamin Herrenschmidt
net: Add __napi_sycnhronize() to sync with napi poll The EMAC driver which needs to handle multiple devices with one NAPI instance implements its own per-channel disable bit. However, when setting such a bit, it needs to synchronize with the poller (that is make sure that any pending poller instan