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

On Thursday 19 July 2007 18:07, Ingo Molnar wrote:
> because i dont seem to be able to trigger Olaf's WARN_ON(), can you see 
> anything in the ethtool output that i sent in the previous mail(s)?

If the WARN_ON doesn't trigger, I cannot see how my patch would affect
your system.

 -	IF we enter the if() branch in poll_napi, then the following
	must hold:
	 -	an interrupt from the e1000 arrived
	 -	e1000_intr disables interrupts, increments irq_sem
		(which is now 1) and schedules rx_action

 -	Now, inside poll_napi, the following happens:
	 -	poll_napi is called, finds the device is marked for
		polling, invokes dev->poll
	 -	dev->poll calls netif_rx_complete (which does *not*
		remove the device from the poll list), and re-enables
		interrupts. irq_sem is now 0.

 -	Finally, the rx_action softirq is run, which calls dev->poll
	again, which ends up invoking netif_rx_complete once more,
	and tries to re-enable interrupts. The latter doesn't do
	anything except decrementing irq_sem once more, which now
	goes negative.

	Which would trigger the WARN_ON.

Now, as you say the WARN_ON is never triggered, it follows that
we never end up in the if() branch of poll_napi. But that is
where the only substantial modification of my patch is.

Here's a somewhat drastic modification that should not change any
timing, but just verifies whether my patch is to blame at all. Can
you give it a try?

Thanks,
Olaf
-- 
Olaf Kirch  |  --- o --- Nous sommes du soleil we love when we play
okir@lst.de |    / | \   sol.dhoop.naytheet.ah kin.ir.samse.qurax
---
Test patch
---
 include/linux/netdevice.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: build-2.6/include/linux/netdevice.h
===================================================================
--- build-2.6.orig/include/linux/netdevice.h
+++ build-2.6/include/linux/netdevice.h
@@ -1027,7 +1027,7 @@ static inline void netif_rx_complete(str
 	 * But at least it doesn't penalize the non-netpoll
 	 * code path. */
 	if (test_bit(__LINK_STATE_POLL_LIST_FROZEN, &dev->state))
-		return;
+		BUG();
 #endif
 
 	local_irq_save(flags);

  reply	other threads:[~2007-07-19 19:18 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
2007-07-19 16:07                                               ` Ingo Molnar
2007-07-19 19:13                                                 ` Olaf Kirch [this message]
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=200707192113.26878.olaf.kirch@oracle.com \
    --to=olaf.kirch@oracle.com \
    --cc=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=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