Commit 78c29bd95bd8d2c3bcf7932cb3ab8ae01cd8f58f

Authored by Eric Dumazet
Committed by David S. Miller
1 parent 3942453948

forcedeth: Fix NAPI race.

Eric Dumazet a écrit :
> Ingo Molnar a écrit :
>>> The following changes since commit 52989765629e7d182b4f146050ebba0abf2cb0b7:
>>>   Linus Torvalds (1):
>>>         Merge git://git.kernel.org/.../davem/net-2.6
>>>
>>> are available in the git repository at:
>>>
>>>   master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master
>> Hm, something in this lot quickly wrecked networking here - see the
>> tx timeout dump below. It starts with:
>>
>> [  351.004596] WARNING: at net/sched/sch_generic.c:246 dev_watchdog+0x10b/0x19c()
>> [  351.011815] Hardware name: System Product Name
>> [  351.016220] NETDEV WATCHDOG: eth0 (forcedeth): transmit queue 0 timed out
>>
>> Config attached. Unfortunately i've got no time to do bisection
>> today.
>
>
>
> forcedeth might have a problem, in its netif_wake_queue() logic, but
> I could not see why a recent patch could make this problem visible now.
>
> CPU0/1: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ stepping 02
> is not a new cpu either :)
>
> forcedeth uses an internal tx_stop without appropriate barrier.
>
> Could you try following patch ?
>
> (random guess as I dont have much time right now)

We might have a race in napi_schedule(), leaving interrupts disabled forever.
I cannot test this patch, I dont have the hardware...

Tested-by: Ingo Molnar <mingo@elte.hu>

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 14 additions and 11 deletions Side-by-side Diff

drivers/net/forcedeth.c
... ... @@ -3514,12 +3514,14 @@
3514 3514 nv_msi_workaround(np);
3515 3515  
3516 3516 #ifdef CONFIG_FORCEDETH_NAPI
3517   - napi_schedule(&np->napi);
  3517 + if (napi_schedule_prep(&np->napi)) {
  3518 + /*
  3519 + * Disable further irq's (msix not enabled with napi)
  3520 + */
  3521 + writel(0, base + NvRegIrqMask);
  3522 + __napi_schedule(&np->napi);
  3523 + }
3518 3524  
3519   - /* Disable furthur irq's
3520   - (msix not enabled with napi) */
3521   - writel(0, base + NvRegIrqMask);
3522   -
3523 3525 #else
3524 3526 do
3525 3527 {
... ... @@ -3615,12 +3617,13 @@
3615 3617 nv_msi_workaround(np);
3616 3618  
3617 3619 #ifdef CONFIG_FORCEDETH_NAPI
3618   - napi_schedule(&np->napi);
3619   -
3620   - /* Disable furthur irq's
3621   - (msix not enabled with napi) */
3622   - writel(0, base + NvRegIrqMask);
3623   -
  3620 + if (napi_schedule_prep(&np->napi)) {
  3621 + /*
  3622 + * Disable further irq's (msix not enabled with napi)
  3623 + */
  3624 + writel(0, base + NvRegIrqMask);
  3625 + __napi_schedule(&np->napi);
  3626 + }
3624 3627 #else
3625 3628 do
3626 3629 {