linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Sabrina Dubroca <sd@queasysnail.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	Fengguang Wu <fengguang.wu@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev@vger.kernel.org, Satyam Sharma <satyam@infradead.org>,
	intel-wired-lan@lists.osuosl.org,
	Ye Xiaolong <xiaolong.ye@intel.com>
Subject: Re: [e1000_netpoll] BUG: sleeping function called from invalid context at kernel/irq/manage.c:110
Date: Thu, 28 Jul 2016 14:21:16 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1607281414040.19896@nanos> (raw)
In-Reply-To: <20160728101958.GA26846@bistromath.localdomain>

On Thu, 28 Jul 2016, Sabrina Dubroca wrote:
> 2016-07-28, 07:43:55 +0200, Eric Dumazet wrote:
> > I would prefer having a definitive advice from Thomas Gleixner and/or
> > others if disable_irq() is forbidden from IRQ path.

Yes it is. Before we added threaded interrupt handlers it was not an issue,
but with (possibly) threaded interrupts it's an absolute no-no.

> > As I said, about all netpoll() methods in net drivers use disable_irq()
> > so a lot of patches would be needed.
> > 
> > disable_irq() should then test this condition earlier, so that we can
> > detect potential bug, even if the IRQ is not (yet) threaded.
> 
> The idea when this first came up was to skip the sleeping part of
> disable_irq():
> 
> http://marc.info/?l=linux-netdev&m=142314159626052
> 
> This fell off my todolist and I didn't send the conversion patches,
> which would basically look like this:
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 41f32c0b341e..b022691e680b 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -6713,20 +6713,20 @@ static irqreturn_t e1000_intr_msix(int __always_unused irq, void *data)
>  
>  		vector = 0;
>  		msix_irq = adapter->msix_entries[vector].vector;
> -		disable_irq(msix_irq);
> -		e1000_intr_msix_rx(msix_irq, netdev);
> +		if (disable_hardirq(msix_irq))
> +			e1000_intr_msix_rx(msix_irq, netdev);
>  		enable_irq(msix_irq);

That'll work nicely even when one of the affected interrupts is threaded.

Thanks,

	tglx

  reply	other threads:[~2016-07-28 12:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26  3:50 [e1000_netpoll] BUG: sleeping function called from invalid context at kernel/irq/manage.c:110 Fengguang Wu
2016-07-26  9:14 ` Eric Dumazet
     [not found]   ` <20160726093224.GA10339@wfg-t540p.sh.intel.com>
2016-07-26  9:45     ` [PATCH] schedule function called for e1000 driver interrupt kbuild test robot
2016-07-26  9:50     ` [e1000_netpoll] BUG: sleeping function called from invalid context at kernel/irq/manage.c:110 Thomas Gleixner
     [not found]       ` <8578bb16-cd04-e8a5-c7f4-be061ede95b4@gmail.com>
2016-07-28  7:45         ` Thomas Gleixner
2016-07-28  9:46           ` Valdis.Kletnieks
2016-07-26  9:50     ` [PATCH] schedule function called for e1000 driver interrupt kbuild test robot
2016-07-26 15:32   ` [e1000_netpoll] BUG: sleeping function called from invalid context at kernel/irq/manage.c:110 Fengguang Wu
2016-07-26 16:28     ` Eric Dumazet
2016-07-27 15:01       ` Fengguang Wu
2016-07-27 18:50         ` Eric Dumazet
2016-07-27 21:38   ` Jeff Kirsher
2016-07-28  5:43     ` Eric Dumazet
2016-07-28 10:19       ` Sabrina Dubroca
2016-07-28 12:21         ` Thomas Gleixner [this message]
2016-07-28 13:30         ` Fengguang Wu
2016-07-28 23:28       ` [Intel-wired-lan] " Francois Romieu

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=alpine.DEB.2.11.1607281414040.19896@nanos \
    --to=tglx@linutronix.de \
    --cc=eric.dumazet@gmail.com \
    --cc=fengguang.wu@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=satyam@infradead.org \
    --cc=sd@queasysnail.net \
    --cc=xiaolong.ye@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).