Netdev List
 help / color / mirror / Atom feed
* Re: NAPI wait before enabling irq's [was Re: [Cbe-oss-dev] Spider DMA wrongness]
  2006-12-14 20:54   ` NAPI wait before enabling irq's [was Re: [Cbe-oss-dev] Spider DMA wrongness] Linas Vepstas
@ 2006-12-14 20:51     ` akepner
  2006-12-14 22:49       ` Linas Vepstas
  0 siblings, 1 reply; 3+ messages in thread
From: akepner @ 2006-12-14 20:51 UTC (permalink / raw)
  To: Linas Vepstas
  Cc: Benjamin Herrenschmidt, James K Lewis, Arnd Bergmann,
	cbe-oss-dev@ozlabs.org, cbe-oss-dev-bounces+jklewis=us.ibm.com,
	Christoph Hellwig, netdev

On Thu, 14 Dec 2006, Linas Vepstas wrote:

> On Wed, Nov 08, 2006 at 07:38:12AM +1100, Benjamin Herrenschmidt wrote:
>>
>> What about Linas patches to do interrupt mitigation with NAPI polling ?
>> That didn't end up working ?
>
> It seems to be "working as designed", which is different than "working
> as naively expected".
>
> For large packets:
> -- a packet comes in
> -- rx interrupt generated
> -- rx interrupts turned off
> -- tcp poll function runs, receives packet
> -- completes all work before next packet has arrived,
>   so interupts are turned back on.
> -- go to start
>
> This results in a high number of interrupts, and a high cpu usage.
> We were able to prove that napi works by stalling in the poll function
> just long enough to allow the next packet to arrive.  In this case,
> napi works great, and number of irqs is vastly reduced.
> ....

This sounds awfully familiar. We went through the same
with the tg3 driver on Altix. In that case we succeeded
getting interrupt coalescence added to the driver, which
ended up working pretty well for us. See the thread
beginning with:

http://oss.sgi.com/archives/netdev/2005-05/msg00497.html

if you're interested.

As for the "stalling NAPI" idea, Jamal did a bit of work
with that idea and wrote it up in:

www.kernel.org/pub/linux/kernel/people/hadi/docs/UKUUG2005.pdf

-- 
Arthur



^ permalink raw reply	[flat|nested] 3+ messages in thread

* NAPI wait before enabling irq's [was Re: [Cbe-oss-dev] Spider DMA wrongness]
       [not found] ` <1162931892.28571.497.camel@localhost.localdomain>
@ 2006-12-14 20:54   ` Linas Vepstas
  2006-12-14 20:51     ` akepner
  0 siblings, 1 reply; 3+ messages in thread
From: Linas Vepstas @ 2006-12-14 20:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: James K Lewis, Arnd Bergmann, cbe-oss-dev@ozlabs.org,
	cbe-oss-dev-bounces+jklewis=us.ibm.com, Christoph Hellwig, netdev

On Wed, Nov 08, 2006 at 07:38:12AM +1100, Benjamin Herrenschmidt wrote:
> 
> What about Linas patches to do interrupt mitigation with NAPI polling ?
> That didn't end up working ?

It seems to be "working as designed", which is different than "working
as naively expected".

For large packets: 
-- a packet comes in
-- rx interrupt generated
-- rx interrupts turned off
-- tcp poll function runs, receives packet
-- completes all work before next packet has arrived, 
   so interupts are turned back on.
-- go to start

This results in a high number of interrupts, and a high cpu usage.
We were able to prove that napi works by stalling in the poll function
just long enough to allow the next packet to arrive.  In this case, 
napi works great, and number of irqs is vastly reduced. 

Unfortunately, I could not figure out any simple way of turning this
into acceptable code.  I can't just wait a little bit before turning 
on interrupts.  Some network apps, such as netpipe, want to receive 
something before sending the next thing. Without the interrupt, the
packet just sits there, and the OS doesn't realize (until milliseconds
later) that there's a packet that can be handled.  This is a variant
of the so-called "rotting packet" discussed in the napi docs.

What is needed is for the tcp stack to wait for 
  1500Bytes / (1Gbit/sec) = 12 microsecs
and then poll again. If there are *still* no new packets, then and
only then do we re-enable interrupts. This would require a new napi.
Presuming the network stack folks find it even remotely acceptable.

--linas


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: NAPI wait before enabling irq's [was Re: [Cbe-oss-dev] Spider DMA wrongness]
  2006-12-14 20:51     ` akepner
@ 2006-12-14 22:49       ` Linas Vepstas
  0 siblings, 0 replies; 3+ messages in thread
From: Linas Vepstas @ 2006-12-14 22:49 UTC (permalink / raw)
  To: akepner, Ishizaki Kou
  Cc: Benjamin Herrenschmidt, James K Lewis, Arnd Bergmann,
	cbe-oss-dev@ozlabs.org, cbe-oss-dev-bounces+jklewis=us.ibm.com,
	Christoph Hellwig, netdev

On Thu, Dec 14, 2006 at 12:51:14PM -0800, akepner@sgi.com wrote:
> On Thu, 14 Dec 2006, Linas Vepstas wrote:
> 
> >On Wed, Nov 08, 2006 at 07:38:12AM +1100, Benjamin Herrenschmidt wrote:
> >>
> >>What about Linas patches to do interrupt mitigation with NAPI polling ?
> >>That didn't end up working ?
> >
> >It seems to be "working as designed", which is different than "working
> >as naively expected".
> >
> >For large packets:
> >-- a packet comes in
> >-- rx interrupt generated
> >-- rx interrupts turned off
> >-- tcp poll function runs, receives packet
> >-- completes all work before next packet has arrived,
> >  so interupts are turned back on.
> >-- go to start
> >
> >This results in a high number of interrupts, and a high cpu usage.
> >We were able to prove that napi works by stalling in the poll function
> >just long enough to allow the next packet to arrive.  In this case,
> >napi works great, and number of irqs is vastly reduced.
> >....
> 
> This sounds awfully familiar. We went through the same
> with the tg3 driver on Altix. In that case we succeeded
> getting interrupt coalescence added to the driver, which
> ended up working pretty well for us. See the thread
> beginning with:
> 
> http://oss.sgi.com/archives/netdev/2005-05/msg00497.html
> 
> if you're interested.

I'm interested. The tg3 seems to have "hardware coalescing",
which, from what I can tell, is a way of delaying an RX
interrupt for some number of microseconds?  I assume there's 
nothing more to it than that?

The spider has some suggestively named registers and functions,
hinting that it can similarly delay an RX interupt, but the 
docs are opaque and mysteriously worded, so I cannot really tell.

Perhaps Ishizaki Kou can clue us in? 

> As for the "stalling NAPI" idea, Jamal did a bit of work
> with that idea and wrote it up in:
> 
> www.kernel.org/pub/linux/kernel/people/hadi/docs/UKUUG2005.pdf

Reading now ... 

--linas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-14 22:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <OFBF8BBD4B.0E5AEA34-ON8725721F.005D5313-8625721F.005EAC5D@us.ibm.com>
     [not found] ` <1162931892.28571.497.camel@localhost.localdomain>
2006-12-14 20:54   ` NAPI wait before enabling irq's [was Re: [Cbe-oss-dev] Spider DMA wrongness] Linas Vepstas
2006-12-14 20:51     ` akepner
2006-12-14 22:49       ` Linas Vepstas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox