Netdev List
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	alexandre.besnard@softathome.com, davem@davemloft.net,
	ecree@solarflare.com, jiri@mellanox.com, petrm@mellanox.com,
	alexander.h.duyck@intel.com, amritha.nambiar@intel.com,
	lirongqing@baidu.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: check negative value for signed refcnt
Date: Thu, 31 Jan 2019 18:34:05 +0300	[thread overview]
Message-ID: <859d2649-31a0-0fae-7768-97bc9d754ccc@virtuozzo.com> (raw)
In-Reply-To: <31736d5e-8e14-67f2-9780-9ba6a6f10f4d@gmail.com>

On 31.01.2019 18:21, Eric Dumazet wrote:
> 
> 
> On 01/31/2019 07:15 AM, Eric Dumazet wrote:
>>
>>
>> On 01/31/2019 05:49 AM, Kirill Tkhai wrote:
>>>
>>> 2)Not related to your patch -- it looks like we have problem in existing
>>> code with this netdev_refcnt_read(). It does not imply a memory ordering
>>> or some guarantees about reading percpu values. For example, in generic
>>> code struct percpu_ref switches a counter into atomic mode before it checks
>>> for the last reference. But there is nothing in netdev_refcnt_read().
>>
>> Well, if we read an old value here, after a full and expensive synchronize_net(),
>> then we would have lot more problems than simply having a second round in
>> netdev_wait_allrefs()
>>  
>>
> 
> percpu_ref was added more recently than the netdev_refcnt stuff, and is
> interesting for users wanting a synchronous wait for the refcnt reaching 0.
> 
> netdev_wait_allrefs() was designed to be asynchronous, so that we at least release
> RTNL (and current cpu) when something is wrong and a device can not be dismantled.

Yeah, they are different, and I think we can't add more synchronize_rcu()-dependent
synchronizations in this code, since network namespaces are already destroyed very slow.

      reply	other threads:[~2019-01-31 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 13:20 [PATCH] net: check negative value for signed refcnt alexandre.besnard
2019-01-31 13:49 ` Kirill Tkhai
2019-01-31 15:14   ` Alexandre BESNARD
2019-01-31 15:31     ` Kirill Tkhai
2019-01-31 15:15   ` Eric Dumazet
2019-01-31 15:21     ` Eric Dumazet
2019-01-31 15:34       ` Kirill Tkhai [this message]

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=859d2649-31a0-0fae-7768-97bc9d754ccc@virtuozzo.com \
    --to=ktkhai@virtuozzo.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=alexandre.besnard@softathome.com \
    --cc=amritha.nambiar@intel.com \
    --cc=davem@davemloft.net \
    --cc=ecree@solarflare.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jiri@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@mellanox.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