Netdev List
 help / color / mirror / Atom feed
From: "pstanner@redhat.com" <pstanner@redhat.com>
To: Bjorn Helgaas <helgaas@kernel.org>,
	Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
Cc: "Chandrashekar Devegowda" <chandrashekar.devegowda@intel.com>,
	"Liu Haijun" <haijun.liu@mediatek.com>,
	"Ricardo Martinez" <ricardo.martinez@linux.intel.com>,
	"Loic Poulain" <loic.poulain@oss.qualcomm.com>,
	"Sergey Ryazanov" <ryazanov.s.a@gmail.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
Date: Tue, 01 Dec 2026 10:45:31 +0100	[thread overview]
Message-ID: <97494bf10c949bc3a6845f79aef02ca52afe945f.camel@redhat.com> (raw)
In-Reply-To: <20261201000233.GA399004@bhelgaas>

On Mon, 2026-11-30 at 18:02 -0600, Bjorn Helgaas wrote:
> On Tue, Dec 01, 2026 at 02:56:31AM +0400, Arina Kharlamova wrote:
> > t7xx_pcie_reinit() runs on resume from L2 or L3 and on every reprobe
> > after a modem reset. It calls pcim_enable_device(), which did nothing
> > for an already enabled managed device until commit 77f79ac8de0f
> > ("PCI: Remove struct pci_devres.enabled status bit"). Since then each
> > call raises the enable count. Since commit f748a07a0b64 ("PCI: Remove
> > legacy pcim_release()") each call also registers a new
> > pcim_disable_device() devres action, and the actions pile up until the
> > device is unbound.
> > 
> > The device is enabled once in t7xx_pci_probe() and the driver never
> > disables it, so drop the call from the reinit path.
> 
> This and the loongson/lsdc issue
> (https://lore.kernel.org/all/20261201-s2p-d60-v1-1-d88cf22132ab@mbzuai.ac.ae)
> seem like basically the same issue, so I wonder if the pcim API could
> be improved to avoid it.  It seems a bit subtle and like something
> driver authors are likely to trip over.

I don't think that the APIs behavior should be guarded with more checks
(like "already enabled" checks). In the past, first the managed API was
added, and then (for unknown reasons) counter APIs were added to revoke
the managed actions. Look at pcim_pin_device(). IMO that makes the API
more convoluted, inconsistent and even harder to understand.

But it's true that drivers often don't seem to understand what a
managed interface is, proven by the fact that many of them also called
pcim_disable_device() in their remove(), which leads the entire design
ad absurdum.


I think what we can is to document more explicitly what functions you
could use when and for what purpose. Especially, we should deprecate
pcim_disable_device(), pcim_iounmap() et al.

I can send a patch for that.


P.

      reply	other threads:[~2026-12-01  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 22:56 [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit Arina Kharlamova via B4 Relay
2026-11-30 23:00 ` netdev-bot+sinfo
2026-12-01  0:02 ` Bjorn Helgaas
2026-12-01  9:45   ` pstanner [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=97494bf10c949bc3a6845f79aef02ca52afe945f.camel@redhat.com \
    --to=pstanner@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=arina.kharlamova@mbzuai.ac.ae \
    --cc=bhelgaas@google.com \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=haijun.liu@mediatek.com \
    --cc=helgaas@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ricardo.martinez@linux.intel.com \
    --cc=ryazanov.s.a@gmail.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