netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	David Miller <davem@davemloft.net>
Cc: 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 15:42:17 -0700	[thread overview]
Message-ID: <a7ff1afd2e1fc2232103ceb9aa763064daf90212.camel@kernel.org> (raw)
In-Reply-To: <e6f50a85-aa25-5fb7-7fd2-158668d55378@gmail.com>

On Wed, 2020-09-23 at 22:44 +0200, Heiner Kallweit wrote:
> On 23.09.2020 22:15, David Miller wrote:
> > From: Heiner Kallweit <hkallweit1@gmail.com>
> > Date: Wed, 23 Sep 2020 21:58:59 +0200
> > 
> > > On 23.09.2020 20:35, Saeed Mahameed wrote:
> > > > Why would a driver detach the device on ndo_stop() ?
> > > > seems like this is the bug you need to be chasing ..
> > > > which driver is doing this ? 
> > > > 
> > > Some drivers set the device to PCI D3hot at the end of ndo_stop()
> > > to save power (using e.g. Runtime PM). Marking the device as
> > > detached
> > > makes clear to to the net core that the device isn't accessible
> > > any
> > > longer.
> > 
> > That being the case, the problem is that IFF_UP+!present is not a
> > valid netdev state.
> > 
> If this combination is invalid, then netif_device_detach() should
> clear IFF_UP? At a first glance this should be sufficient to avoid
> the issue I was dealing with.
> 

Feels like a work around and would conflict with the assumption that 
netif_device_detach() should only be called when !IFF_UP

Maybe we need to clear IFF_UP before calling ops->ndo_stop(dev),
instead of after on __dev_close_many(). Assuming no driver is checking
IFF_UP state on its own ndo_stop(), other than this, the order
shouldn't really matter, since clearing the flag and calling ndo_stop()
should be considered as one atomic operation.

> > Is it simply the issue that, upon resume, IFF_UP is marked true
> > before
> > the device is brought out from D3hot state and thus marked as
> > present
> > again?
> > 
> I can't really comment on that. The issue I was dealing with at the
> time I submitted this change was about an async linkwatch event
> (caused by powering down the PHY in ndo_stop) trying to access the
> device when it was powered down already.


  reply	other threads:[~2020-09-23 22:42 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 [this message]
2020-09-24  0:21               ` David Miller
2020-09-24  0:23                 ` David Miller
2020-09-24  5:49                   ` Saeed Mahameed
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=a7ff1afd2e1fc2232103ceb9aa763064daf90212.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;
as well as URLs for NNTP newsgroup(s).