public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: Olaf Kirch <olaf.kirch@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>, Jarek Poplawski <jarkao2@o2.pl>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, davem@davemloft.net,
	Auke Kok <auke-jan.h.kok@intel.com>
Subject: Re: [patch] revert: [NET]: Fix races in net_rx_action vs netpoll
Date: Thu, 19 Jul 2007 08:42:52 -0700	[thread overview]
Message-ID: <469F867C.7020707@intel.com> (raw)
In-Reply-To: <200707191452.09609.olaf.kirch@oracle.com>

Olaf Kirch wrote:
> On Thursday 19 July 2007 12:58, Ingo Molnar wrote:
>> i.e. it's the classic 'eth0 got stuck somehow' tx/rx state machine 
>> hickup symptoms, with no other bad symptoms such as lockups or crashes.
> 
> Duh, I found it.
> 
> The e1000 poll routine does this to leave polling mode.
> 
> 	netif_rx_complete(poll_dev);
>         e1000_irq_enable(adapter);
>         return 0;
> 
> Which looks innocent enough, except that e1000_irq_enable has
> this little irq_sem counter:
> 
> 	if (likely(atomic_dec_and_test(&adapter->irq_sem))) {
>                 E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
>                 E1000_WRITE_FLUSH(&adapter->hw);
>         }
> 
> So as poll_napi calls the poll() routine repeatedly, the irq_sem
> counter is decremented by one each time. During the first call,
> it re-enables the interrupt. During the next calls, irq_sem goes
> negative.
> 
> Then an interrupt comes in, e1000_intr disables the interrupt,
> increments irq_sem by one, and schedules the device for rx_action.
> rx_action calls dev->poll(), which finishes cleaning rx/rx rings,
> and when it finds there's no more work, it calls rx_complete and
> irq_enable. Except irq_enable doesn't enable anything now, since
> irq_sem is <= 0, and dec_and_test returns false.
> 
> The whole irq_sem accounting in the e1000 does not rhyme well with
> netpoll's way of exercising dev->poll().

it's been accused of worse things ;)

> The reason my patch triggers
> the problem reliably for you is that now, we always get at least
> two invocations of dev->poll: once from poll_napi - where we do not
> remove the device from the poll list any longer - and another one
> from net_rx_action.
> 
> I don't have a fix ready yet - I hope I'll have something later
> this afternoon.

interesting, you seem to found the cause allright. I can't confirm the problem 
but I know that netpoll and NAPI has historically been an issue. I look forward 
to your suggestions...

Cheers,

Auke

  parent reply	other threads:[~2007-07-19 15:43 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16  9:12 [patch] revert: [NET]: Fix races in net_rx_action vs netpoll Ingo Molnar
2007-07-16 10:35 ` Olaf Kirch
2007-07-16 11:26 ` David Miller
2007-07-16 12:18   ` Olaf Kirch
2007-07-16 13:29     ` Ingo Molnar
2007-07-16 21:09   ` Ingo Molnar
2007-07-16 22:06     ` David Miller
2007-07-16 21:40   ` Linus Torvalds
2007-07-16 21:51     ` Ingo Molnar
2007-07-16 22:09       ` David Miller
2007-07-16 22:37         ` Ingo Molnar
2007-07-16 22:57           ` David Miller
2007-07-17 18:09             ` Ingo Molnar
2007-07-16 22:08     ` David Miller
2007-07-16 22:29       ` Linus Torvalds
2007-07-16 22:52         ` David Miller
2007-07-16 23:17         ` Matt Mackall
2007-07-16 23:34           ` Linus Torvalds
2007-07-17  7:37       ` Olaf Kirch
2007-07-17  8:16     ` Olaf Kirch
2007-07-17  5:46 ` Jarek Poplawski
2007-07-17  6:14   ` Jarek Poplawski
2007-07-17  7:55     ` Olaf Kirch
2007-07-17  8:28       ` Olaf Kirch
2007-07-17  8:57         ` Ingo Molnar
2007-07-17  9:29           ` Jarek Poplawski
2007-07-17 14:07           ` Olaf Kirch
2007-07-17 16:57             ` Ingo Molnar
2007-07-17 18:06               ` Olaf Kirch
2007-07-17 18:18                 ` Ingo Molnar
2007-07-17 18:34                   ` Olaf Kirch
2007-07-17 18:56                     ` Ingo Molnar
2007-07-18 12:04                       ` Olaf Kirch
2007-07-18 12:41                         ` Ingo Molnar
2007-07-18 12:48                         ` Ingo Molnar
2007-07-18 14:41                           ` Olaf Kirch
2007-07-18 16:43                             ` Ingo Molnar
2007-07-19  9:09                               ` Ingo Molnar
2007-07-19  9:44                                 ` Olaf Kirch
2007-07-19 10:01                                   ` Ingo Molnar
2007-07-19 10:37                                     ` Olaf Kirch
2007-07-19 10:47                                       ` Ingo Molnar
2007-07-19 10:58                                         ` Ingo Molnar
2007-07-19 12:52                                           ` Olaf Kirch
2007-07-19 12:54                                             ` Olaf Kirch
2007-07-19 15:42                                             ` Kok, Auke [this message]
2007-07-19 16:07                                               ` Ingo Molnar
2007-07-19 19:13                                                 ` Olaf Kirch
2007-07-19 19:22                                                   ` Ingo Molnar
2007-07-19 19:35                                                     ` Olaf Kirch
2007-07-19 19:56                                                       ` Ingo Molnar
2007-07-19 20:02                                                         ` Olaf Kirch
2007-07-20  9:45                                                           ` Ingo Molnar
2007-07-19 15:07                                           ` Ingo Molnar
2007-07-19 15:27                                             ` Olaf Kirch
2007-07-19 15:32                                             ` Ingo Molnar
2007-07-19 15:52                                               ` Ingo Molnar
2007-07-19 16:05                                                 ` Ingo Molnar
2007-07-19 16:13                                                   ` Ingo Molnar
2007-07-19 17:36                                                   ` Olaf Kirch
2007-07-19 17:41                                                     ` Ingo Molnar
2007-07-19 17:51                                                     ` Olaf Kirch
2007-07-19 10:17                                 ` Ingo Molnar
2007-07-18 11:48                     ` Jarek Poplawski
2007-07-19  5:58                       ` Jarek Poplawski
2007-07-17 17:49           ` Linus Torvalds
2007-07-17  9:12         ` Jarek Poplawski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=469F867C.7020707@intel.com \
    --to=auke-jan.h.kok@intel.com \
    --cc=davem@davemloft.net \
    --cc=jarkao2@o2.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=olaf.kirch@oracle.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox