netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, Lijun Pan <lijunp213@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net v2] net: core: make napi_disable more robust
Date: Thu, 15 Apr 2021 08:46:30 +0200	[thread overview]
Message-ID: <5f5ea71d-c9e9-fe85-2f29-475c67174549@gmail.com> (raw)
In-Reply-To: <20210414162109.77eecf47@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>



On 4/15/21 1:21 AM, Jakub Kicinski wrote:
> On Wed, 14 Apr 2021 03:08:45 -0500 Lijun Pan wrote:
>> There are chances that napi_disable can be called twice by NIC driver.
>> This could generate deadlock. For example,
>> the first napi_disable will spin until NAPI_STATE_SCHED is cleared
>> by napi_complete_done, then set it again.
>> When napi_disable is called the second time, it will loop infinitely
>> because no dev->poll will be running to clear NAPI_STATE_SCHED.
>>
>> Though it is driver writer's responsibility to make sure it being
>> called only once, making napi_disable more robust does not hurt, not
>> to say it can prevent a buggy driver from crashing a system.
>> So, we check the napi state bit to make sure that if napi is already
>> disabled, we exit the call early enough to avoid spinning infinitely.
> 
> You've already been told by Eric & Dave to fix the driver instead.
> 
> Your check is _not_ correct - SCHED && NPSVC && !MISSED && !BUSY_POLL 
> can well arise without disabling the NAPI.
> 
> But regardless, a driver bug should be relatively easy to identify with
> task getting stuck in napi_disable(). We don't provide "protection" 
> for taking spin locks or ref counts twice either. Unless you can show 
> a strong use case please stop posting new versions of this patch.
> 

+222

I notice this v2 does not even mention which driver has the issue.

I suspect an out-of-tree driver.


  reply	other threads:[~2021-04-15  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  8:08 [PATCH net v2] net: core: make napi_disable more robust Lijun Pan
2021-04-14  8:45 ` Yunsheng Lin
2021-04-14 17:31   ` Lijun Pan
2021-04-14 23:21 ` Jakub Kicinski
2021-04-15  6:46   ` Eric Dumazet [this message]
2021-04-15  6:47 ` Eric Dumazet

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=5f5ea71d-c9e9-fe85-2f29-475c67174549@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lijunp213@gmail.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).