netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: yoshihiro.shimoda.uh@renesas.com
Cc: netdev@vger.kernel.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH 5/5] net: sh_eth: use NAPI
Date: Fri, 16 Mar 2012 02:15:38 -0700 (PDT)	[thread overview]
Message-ID: <20120316.021538.2022095011493944779.davem@davemloft.net> (raw)
In-Reply-To: <4F62FDDA.9070708@renesas.com>

From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
Date: Fri, 16 Mar 2012 17:46:18 +0900

sh_eth_interrupt takes mdp->lock, and:

> +static int sh_eth_poll(struct napi_struct *napi, int budget)
> +{
> +	struct sh_eth_private *mdp = container_of(napi, struct sh_eth_private,
> +						  napi);
> +	struct net_device *ndev = mdp->ndev;
> +	struct sh_eth_cpu_data *cd = mdp->cd;
> +	int work_done = 0, txfree_num;
> +	u32 intr_status = sh_eth_read(ndev, EESR);
> +
> +	spin_lock(&mdp->lock);

sh_eth_poll() runs from software interrupt context, therefore
this can deadlock.

Even though you turned off interrupts in sh_eth_interrupt to
enable NAPI mode, this can still happen, interrupts can be
stuck in the interrupt controller, another device can be on
the same interrupt line, etc.  Therefore you must handle
this properly.

I would suggest _NOT_ fixing this by taking the lock with interrupts
disabled in sh_eth_poll(), that defeats the whole prupose of
converting to NAPI and this would also require you to change back
the dev_kfree_skb() to dev_kfree_skb_irq().

Instead, do what other drivers do, make your interrupt handler run
completely lockless and have a sophisticated quiescence sequence
when you want to sync interrupts off and make sure no async contexts
are still running in the interrupt handler.  See tg3.c for one
example of this.

I'm toss this entire patch series, it needs a lot more work.

  reply	other threads:[~2012-03-16  9:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16  8:46 [PATCH 5/5] net: sh_eth: use NAPI Shimoda, Yoshihiro
2012-03-16  9:15 ` David Miller [this message]
2012-03-16 10:46   ` Shimoda, Yoshihiro

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=20120316.021538.2022095011493944779.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-sh@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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).