* [PATCH 3/4] forcedeth: napi schedule lock fix
@ 2009-01-09 21:03 Ayaz Abdulla
2009-01-10 7:13 ` David Miller
2009-01-27 16:28 ` Vitaliy Gusev
0 siblings, 2 replies; 3+ messages in thread
From: Ayaz Abdulla @ 2009-01-09 21:03 UTC (permalink / raw)
To: Manfred Spraul, Jeff Garzik, Andrew Morton, nedev
[-- Attachment #1: Type: text/plain, Size: 285 bytes --]
This patch fixes a potential race condition between scheduling napi and
completing napi poll. The call to netif_rx_schedule should be under
protection of the lock (as is the completion), otherwise, interrupts
could be masked off.
Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>
[-- Attachment #2: patch-forcedeth-napi-lock --]
[-- Type: text/plain, Size: 750 bytes --]
--- old/drivers/net/forcedeth.c 2009-01-09 15:11:55.000000000 -0800
+++ new/drivers/net/forcedeth.c 2009-01-09 15:17:27.000000000 -0800
@@ -3407,10 +3407,10 @@
#ifdef CONFIG_FORCEDETH_NAPI
if (events & NVREG_IRQ_RX_ALL) {
+ spin_lock(&np->lock);
netif_rx_schedule(dev, &np->napi);
/* Disable furthur receive irq's */
- spin_lock(&np->lock);
np->irqmask &= ~NVREG_IRQ_RX_ALL;
if (np->msi_flags & NV_MSI_X_ENABLED)
@@ -3524,10 +3524,10 @@
#ifdef CONFIG_FORCEDETH_NAPI
if (events & NVREG_IRQ_RX_ALL) {
+ spin_lock(&np->lock);
netif_rx_schedule(dev, &np->napi);
/* Disable furthur receive irq's */
- spin_lock(&np->lock);
np->irqmask &= ~NVREG_IRQ_RX_ALL;
if (np->msi_flags & NV_MSI_X_ENABLED)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/4] forcedeth: napi schedule lock fix
2009-01-09 21:03 [PATCH 3/4] forcedeth: napi schedule lock fix Ayaz Abdulla
@ 2009-01-10 7:13 ` David Miller
2009-01-27 16:28 ` Vitaliy Gusev
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2009-01-10 7:13 UTC (permalink / raw)
To: aabdulla; +Cc: manfred, jgarzik, akpm, netdev
From: Ayaz Abdulla <aabdulla@nvidia.com>
Date: Fri, 09 Jan 2009 16:03:49 -0500
> This patch fixes a potential race condition between scheduling napi and completing napi poll. The call to netif_rx_schedule should be under protection of the lock (as is the completion), otherwise, interrupts could be masked off.
>
> Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>
Another patch I had to apply by hand.
The 'dev' argument was removed from the netif_*() NAPI interfaces
and then were converted to napi_*() in the net-2.6 tree.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/4] forcedeth: napi schedule lock fix
2009-01-09 21:03 [PATCH 3/4] forcedeth: napi schedule lock fix Ayaz Abdulla
2009-01-10 7:13 ` David Miller
@ 2009-01-27 16:28 ` Vitaliy Gusev
1 sibling, 0 replies; 3+ messages in thread
From: Vitaliy Gusev @ 2009-01-27 16:28 UTC (permalink / raw)
To: Ayaz Abdulla; +Cc: Manfred Spraul, Jeff Garzik, Andrew Morton, nedev
On 10 January 2009 00:03:49 Ayaz Abdulla wrote:
> This patch fixes a potential race condition between scheduling napi and
> completing napi poll. The call to netif_rx_schedule should be under
> protection of the lock (as is the completion), otherwise, interrupts
> could be masked off.
Can you explain how this issue or race can occur (interrupts can be masked off) ?
netif_rx_schedule() merely mark soft irq as waked on current CPU. So dev->poll
will not be called until irq_exit() or local_bh_enable. As nv_nic_irq() is run
under interrupt context, so napi poll will be called only during irq_exit.
>
> Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>
>
>
--
Thank,
Vitaliy Gusev
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-27 16:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-09 21:03 [PATCH 3/4] forcedeth: napi schedule lock fix Ayaz Abdulla
2009-01-10 7:13 ` David Miller
2009-01-27 16:28 ` Vitaliy Gusev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.