netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	netdev@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>,
	Marc MERLIN <marc@merlins.org>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH net v3] net: ethtool: do runtime PM outside RTNL
Date: Wed, 3 Jan 2024 13:15:09 +0100	[thread overview]
Message-ID: <ZZVPzRN9hUaPtPPh@linux.intel.com> (raw)
In-Reply-To: <615c97e9-0a43-4ae6-ae61-172fd64971ec@gmail.com>

On Wed, Jan 03, 2024 at 12:24:18PM +0100, Heiner Kallweit wrote:
> On 03.01.2024 11:30, Stanislaw Gruszka wrote:
> > On Wed, Dec 06, 2023 at 08:44:48AM -0800, Jakub Kicinski wrote:
> >> On Wed,  6 Dec 2023 11:39:32 +0100 Johannes Berg wrote:
> >>> As reported by Marc MERLIN, at least one driver (igc) wants or
> >>> needs to acquire the RTNL inside suspend/resume ops, which can
> >>> be called from here in ethtool if runtime PM is enabled.
> >>>
> >>> Allow this by doing runtime PM transitions without the RTNL
> >>> held. For the ioctl to have the same operations order, this
> >>> required reworking the code to separately check validity and
> >>> do the operation. For the netlink code, this now has to do
> >>> the runtime_pm_put a bit later.
> >>
> >> I was really, really hoping that this would serve as a motivation
> >> for Intel to sort out the igb/igc implementation. The flow AFAICT
> >> is ndo_open() starts the NIC, the calls pm_sus, which shuts the NIC
> >> back down immediately (!?) then it schedules a link check from a work
> > 
> > It's not like that. pm_runtime_put() in igc_open() does not disable device.
> > It calls runtime_idle callback which check if there is link and if is
> > not, schedule device suspend in 5 second, otherwise device stays running.
> > 
> > Work watchdog_task runs periodically and also check for link changes.
> > 
> >> queue, which opens it again (!?). It's a source of never ending bugs.
> > 
> > Maybe there are issues there and igc pm runtime implementation needs
> > improvements, with lockings or otherwise. Some folks are looking at this. 
> > But I think for this particular deadlock problem reverting of below commits
> > should be considered:
> > 
> > bd869245a3dc net: core: try to runtime-resume detached device in __dev_open
> > f32a21376573 ethtool: runtime-resume netdev parent before ethtool ioctl ops
> > Reverting bd869245a3dc would break existing stuff.
> 
> > First, the deadlock should be addressed also in older kernels and
> > refactoring is not really backportable fix.
> > 
> You could simply disable igc runtime pm on older kernel versions
> if backporting a proper fix would be too cumbersome.

It would be better to have pm working on older kernels as it use to.

> > Second, I don't think network stack should do any calls to pm_runtime* .
> 
> It's not unusual that subsystem core code deals with runtime pm.
> E.g. see all the runtime pm calls in drivers/pci/pci.c
> IMO it's exactly the purpose of the RPM API to encapsulate the
> device-specific (r)pm features.

PCI is bus layer that control device probe/remove, suspend/resume, etc,
it has to do this. To make proper companion non-bus subsystem should be
used i.e. sound, drm,  bluetooth ...  all of those do not pm_runtime 
in core layer and leave that to drivers. One exception is block layer
with it's blk-pm.c , but that it's also more like library that is used
by the drivers.

Regards
Stanislaw


  reply	other threads:[~2024-01-03 12:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 10:39 [PATCH net v3] net: ethtool: do runtime PM outside RTNL Johannes Berg
2023-12-06 16:44 ` Jakub Kicinski
2023-12-06 16:46   ` Johannes Berg
2023-12-06 21:39     ` Marc MERLIN
2023-12-07 10:16     ` Przemek Kitszel
2023-12-07 17:40       ` Jakub Kicinski
2023-12-11  4:52         ` Marc MERLIN
2023-12-15 13:42           ` Heiner Kallweit
2023-12-15 17:46             ` Marc MERLIN
2023-12-24 16:30               ` Marc MERLIN
2023-12-24 23:12                 ` Heiner Kallweit
2023-12-25  8:03                   ` [Intel-wired-lan] " Sasha Neftin
2023-12-25 11:21                     ` Marc MERLIN
2024-01-03 10:30   ` Stanislaw Gruszka
2024-01-03 11:24     ` Heiner Kallweit
2024-01-03 12:15       ` Stanislaw Gruszka [this message]
2024-01-03 23:34     ` Jakub Kicinski
2024-01-04  8:25       ` Stanislaw Gruszka
2024-01-04  9:05         ` Heiner Kallweit
2024-01-04 16:16           ` Jakub Kicinski
2024-01-05 11:53             ` Stanislaw Gruszka
2024-01-05 15:30               ` Jakub Kicinski
2024-01-05 16:29                 ` Stanislaw Gruszka
2024-01-06  3:02                   ` Jakub Kicinski
2024-01-08 11:18                     ` Stanislaw Gruszka
2024-01-05 10:34           ` Stanislaw Gruszka

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=ZZVPzRN9hUaPtPPh@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=hkallweit1@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=marc@merlins.org \
    --cc=netdev@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.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).