public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: David Miller <davem@davemloft.net>
Cc: hkallweit1@gmail.com, geert+renesas@glider.be,
	f.fainelli@gmail.com, andrew@lunn.ch, kuba@kernel.org,
	gaku.inami.xh@renesas.com, yoshihiro.shimoda.uh@renesas.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Revert "net: linkwatch: add check for netdevice being present to linkwatch_do_dev"
Date: Wed, 23 Sep 2020 22:49:37 -0700	[thread overview]
Message-ID: <2cf4178e970d2737e7ba866ebc83a7ec30ca8ad1.camel@kernel.org> (raw)
In-Reply-To: <20200923.172349.872678515629678579.davem@davemloft.net>

On Wed, 2020-09-23 at 17:23 -0700, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 23 Sep 2020 17:21:25 -0700 (PDT)
> 
> > If an async code path tests 'present', gets true, and then the RTNL
> > holding synchronous code path puts the device into D3hot
> immediately
> > afterwards, the async code path will still continue and access the
> > chips registers and fault.
> 
> Wait, is the sequence:
> 
>         ->ndo_stop()
>                 mark device not present and put into D3hot
>                 triggers linkwatch event
>           ...
>                          ->ndo_get_stats64()
> 
> ???
> 

I assume it is, since normally device drivers do carrier_off() on
ndo_stop()

1) One problematic sequence would be 
(for drivers doing D3hot on ndo_stop())

__dev_close_many()
   ->ndo_stop()
      netif_device_detach() //Mark !present;
      ... D3hot
      carrier_off()->linkwatch_event()
            ... // !present && IFF_UP 
      
2) Another problematic scenario which i see is repeated in many
drivers:

shutdown/suspend()
    rtnl_lock()
    netif_device_detach()//Mark !present;
    stop()->carrier_off()->linkwatch_event()
    // at this point device is still IFF_UP and !present
    // due to the early detach above..  
    rtnl_unlock();
   
For scenario 1) we can fix by marking IFF_UP at the beginning, but for
2), i think we need to fix the drivers to detach only after stop :(
   
> Then yeah we might have to clear IFF_UP at the beginning of taking
> a netdev down.



  reply	other threads:[~2020-09-24  5:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 15:02 [PATCH] Revert "net: linkwatch: add check for netdevice being present to linkwatch_do_dev" Geert Uytterhoeven
2020-09-03 21:58 ` David Miller
2020-09-10 19:20 ` David Miller
2020-09-11  6:32   ` Geert Uytterhoeven
2020-09-12  0:44     ` David Miller
2020-09-12 12:33       ` Geert Uytterhoeven
2020-09-13  1:34         ` David Miller
2020-09-14  7:40           ` Geert Uytterhoeven
2020-09-18 12:35             ` Nikolay Aleksandrov
2020-09-18 21:47               ` David Miller
2020-09-18 17:58 ` Saeed Mahameed
2020-09-18 22:10   ` David Miller
2020-09-23 11:49   ` Heiner Kallweit
2020-09-23 18:35     ` Saeed Mahameed
2020-09-23 19:58       ` Heiner Kallweit
2020-09-23 20:15         ` David Miller
2020-09-23 20:44           ` Heiner Kallweit
2020-09-23 22:42             ` Saeed Mahameed
2020-09-24  0:21               ` David Miller
2020-09-24  0:23                 ` David Miller
2020-09-24  5:49                   ` Saeed Mahameed [this message]
2020-09-24 16:03                     ` Jakub Kicinski
2020-09-24 18:16                       ` Saeed Mahameed

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=2cf4178e970d2737e7ba866ebc83a7ec30ca8ad1.camel@kernel.org \
    --to=saeed@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=gaku.inami.xh@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@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