mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <xiyou.wangcong@gmail.com>, <mchan@broadcom.com>,
	<tdmackey@booleanhaiku.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bnx2: Use dev_kfree_skb_any() in bnx2_tx_int()
Date: Fri, 1 Nov 2013 23:34:50 +0000	[thread overview]
Message-ID: <1383348890.1737.40.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <20131101.180147.629210014672277622.davem@davemloft.net>

On Fri, 2013-11-01 at 18:01 -0400, David Miller wrote:
> From: Cong Wang <xiyou.wangcong@gmail.com>
> Date: Thu, 31 Oct 2013 21:19:16 -0700
> 
> > 2013年10月30日 下午9:26于 "David Miller" <davem@davemloft.net>写道:
> >>
> >> We have to provide a softint compatible environment for this callback
> >> to run in else everything is completely broken.
> >>
> >> All these drivers can safely assume softirq safe locking is
> >> sufficient, you're suggesting we need to take this hardirq safety and
> >> I'm really not willing to allow things to go that far.  A lot of
> >> effort has been expended precisely to avoid that kind of overhead and
> >> cost.
> > 
> > Alright, I am thinking to move netpoll_poll_dev() to a delayed work.
>  
> What if the printk is outputting a message that will help us discover
> that work queues are deadlocked?
> 
> You can't delay the message, because every layer of indirection you
> add increases the possibility that the message it never seen.  You
> have to do it synchronously.

As you've said, the ndo_start_xmit and NAPI poll operations are intended
to be called in softirq context, so everything that interlocks with them
will use spin_lock_bh().  Calling them from hardirq context obviously
opens the possibility of a deadlock.  How do you expect anyone to solve
that?

I think that most of the time netpoll doesn't actually call the NAPI
poll function, and the driver ndo_start_xmit function doesn't take any
locks, so we don't actually hit the deadlock in practice (on mainline
kernels - RT is a different story).

Obviously, the less machinery netpoll relies on continuing to work, the
better, so it should preferably defer to sofirq context rather than
workqueue context.  I think this means hooking queue_process() into
net_tx_action(), and then cutting out much of the rest of netpoll.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2013-11-01 23:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 22:16 David Mackey
2013-10-30  2:42 ` David Miller
2013-10-30  3:50   ` Cong Wang
2013-10-30  6:40     ` David Miller
2013-10-30 19:23       ` Cong Wang
2013-10-30 21:32         ` David Miller
2013-10-30 22:01           ` Cong Wang
2013-10-31  4:26             ` David Miller
     [not found]               ` <CAM_iQpXPrEj619=PRaKN4PxgOoEB96U0mLFS65AzXOezSWvhxQ@mail.gmail.com>
2013-11-01 22:01                 ` David Miller
2013-11-01 23:34                   ` Ben Hutchings [this message]
2013-11-02  5:06                     ` David Miller

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=1383348890.1737.40.camel@bwh-desktop.uk.level5networks.com \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=tdmackey@booleanhaiku.com \
    --cc=xiyou.wangcong@gmail.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

all inboxes | Powered by JetHome®