[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170227141403.714490f7@xeon-e3>
Date: Mon, 27 Feb 2017 14:14:03 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 net] net: solve a NAPI race
On Mon, 27 Feb 2017 12:18:31 -0800
Eric Dumazet <eric.dumazet@...il.com> wrote:
> thread 1 thread 2 (could be on same cpu)
>
> // busy polling or napi_watchdog()
> napi_schedule();
> ...
> napi->poll()
>
> device polling:
> read 2 packets from ring buffer
> Additional 3rd packet is available.
> device hard irq
>
> // does nothing because NAPI_STATE_SCHED bit is owned by thread 1
> napi_schedule();
>
> napi_complete_done(napi, 2);
> rearm_irq();
The original design (as Davem mentioned) was that IRQ's must be disabled
during device polling. If that was true, then the race above
would be impossible. Also NAPI assumes interrupts are level triggered.
Powered by blists - more mailing lists