Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
@ 2026-11-30 22:56 Arina Kharlamova via B4 Relay
  2026-11-30 23:00 ` netdev-bot+sinfo
  2026-12-01  0:02 ` Bjorn Helgaas
  0 siblings, 2 replies; 7+ messages in thread
From: Arina Kharlamova via B4 Relay @ 2026-11-30 22:56 UTC (permalink / raw)
  To: Chandrashekar Devegowda, Liu Haijun, Ricardo Martinez,
	Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Philipp Stanner, Krzysztof Wilczyński, Bjorn Helgaas
  Cc: netdev, Arina Kharlamova

From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>

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.

Fixes: 77f79ac8de0f ("PCI: Remove struct pci_devres.enabled status bit")
Fixes: f748a07a0b64 ("PCI: Remove legacy pcim_release()")
Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
---
Found by checks derived from the spec2patch kernel API specifications,
with the help of an AI coding assistant (Claude); I reviewed the
analysis and the fix.
---
 drivers/net/wwan/t7xx/t7xx_pci.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c
index c51c3b267186..47593e759238 100644
--- a/drivers/net/wwan/t7xx/t7xx_pci.c
+++ b/drivers/net/wwan/t7xx/t7xx_pci.c
@@ -496,12 +496,6 @@ static void t7xx_pcie_interrupt_reinit(struct t7xx_pci_dev *t7xx_dev)
 
 static int t7xx_pcie_reinit(struct t7xx_pci_dev *t7xx_dev, bool is_d3)
 {
-	int ret;
-
-	ret = pcim_enable_device(t7xx_dev->pdev);
-	if (ret)
-		return ret;
-
 	t7xx_pcie_mac_atr_init(t7xx_dev);
 	t7xx_pcie_interrupt_reinit(t7xx_dev);
 

---
base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5
change-id: 20261129-s2p-d64-e315656e3f12

Best regards,
--  
Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
  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 18:31   ` Arina Kharlamova
  2026-12-01  0:02 ` Bjorn Helgaas
  1 sibling, 1 reply; 7+ messages in thread
From: netdev-bot+sinfo @ 2026-11-30 23:00 UTC (permalink / raw)
  To: Arina Kharlamova
  Cc: Chandrashekar Devegowda, Liu Haijun, Ricardo Martinez,
	Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Philipp Stanner, Krzysztof Wilczyński, Bjorn Helgaas, netdev

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2026-12-01  0:02 UTC (permalink / raw)
  To: Arina Kharlamova
  Cc: Chandrashekar Devegowda, Liu Haijun, Ricardo Martinez,
	Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Philipp Stanner, Krzysztof Wilczyński, Bjorn Helgaas, netdev

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.

> Fixes: 77f79ac8de0f ("PCI: Remove struct pci_devres.enabled status bit")
> Fixes: f748a07a0b64 ("PCI: Remove legacy pcim_release()")
> Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
> ---
> Found by checks derived from the spec2patch kernel API specifications,
> with the help of an AI coding assistant (Claude); I reviewed the
> analysis and the fix.
> ---
>  drivers/net/wwan/t7xx/t7xx_pci.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c
> index c51c3b267186..47593e759238 100644
> --- a/drivers/net/wwan/t7xx/t7xx_pci.c
> +++ b/drivers/net/wwan/t7xx/t7xx_pci.c
> @@ -496,12 +496,6 @@ static void t7xx_pcie_interrupt_reinit(struct t7xx_pci_dev *t7xx_dev)
>  
>  static int t7xx_pcie_reinit(struct t7xx_pci_dev *t7xx_dev, bool is_d3)
>  {
> -	int ret;
> -
> -	ret = pcim_enable_device(t7xx_dev->pdev);
> -	if (ret)
> -		return ret;
> -
>  	t7xx_pcie_mac_atr_init(t7xx_dev);
>  	t7xx_pcie_interrupt_reinit(t7xx_dev);
>  
> 
> ---
> base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5
> change-id: 20261129-s2p-d64-e315656e3f12
> 
> Best regards,
> --  
> Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
  2026-12-01  0:02 ` Bjorn Helgaas
@ 2026-12-01  9:45   ` pstanner
  2026-12-01 18:07     ` Arina Kharlamova
  2026-12-01 20:36     ` Bjorn Helgaas
  0 siblings, 2 replies; 7+ messages in thread
From: pstanner @ 2026-12-01  9:45 UTC (permalink / raw)
  To: Bjorn Helgaas, Arina Kharlamova
  Cc: Chandrashekar Devegowda, Liu Haijun, Ricardo Martinez,
	Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Wilczyński, Bjorn Helgaas, netdev

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
  2026-12-01  9:45   ` pstanner
@ 2026-12-01 18:07     ` Arina Kharlamova
  2026-12-01 20:36     ` Bjorn Helgaas
  1 sibling, 0 replies; 7+ messages in thread
From: Arina Kharlamova @ 2026-12-01 18:07 UTC (permalink / raw)
  To: pstanner@redhat.com
  Cc: Arina Kharlamova, Bjorn Helgaas, Chandrashekar Devegowda,
	Liu Haijun, Ricardo Martinez, Loic Poulain, Sergey Ryazanov,
	Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Krzysztof Wilczyński,
	Bjorn Helgaas, netdev@vger.kernel.org

Thanks!!
I will keep the t7xx and lsdc fixes as they are. 
dwmac-intel and pata_macio also call pcim_enable_device() again
on resume; 

I can send fixes for those two in the same way. libata is
already covered by Weidong Wang's patch.

Thanks,
Arina

> On 1 Dec 2026, at 13:45, pstanner@redhat.com wrote:
> 
> Notice: This email originated from outside MBZUAI.
> Please exercise caution before clicking links, opening attachments, or sharing sensitive information.
> 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://urldefense.com/v3/__https://lore.kernel.org/all/20261201-s2p-d60-v1-1-d88cf22132ab@mbzuai.ac.ae__;!!J2_iJ0WgAoU!YersOOHbbYGwemqzH_ZDEIxdt2Dq9Z8Dpb6PNGQBOe2we4ZBmrvyqu2Ezjrz6pdHbQhLcANRMWpw4VLT5sGSAhR-LNc$)
> > 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.
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
  2026-11-30 23:00 ` netdev-bot+sinfo
@ 2026-12-01 18:31   ` Arina Kharlamova
  0 siblings, 0 replies; 7+ messages in thread
From: Arina Kharlamova @ 2026-12-01 18:31 UTC (permalink / raw)
  To: netdev-bot+sinfo@kernel.org
  Cc: Arina Kharlamova, Chandrashekar Devegowda, Liu Haijun,
	Ricardo Martinez, Loic Poulain, Sergey Ryazanov, Johannes Berg,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Philipp Stanner, Krzysztof Wilczyński,
	Bjorn Helgaas, netdev@vger.kernel.org

Hi,

> - Whether the issue was actually triggered, or is only theoretical
>   (e.g. found by LLM and not proven at runtime).

It was not triggered at runtime. I found it statically with a check
derived from our formal specifications of kernel APIs (spec2patch), with
the help of an AI coding assistant (Claude). I then checked it by
reading the code: t7xx_pcie_reinit()
calls pcim_enable_device() on every resume from L2/L3 and every reprobe,
and since 77f79ac8de0f and f748a07a0b64 each call raises the enable
count and adds one more devres action. The change is compile-tested
only (x86_64 allmodconfig), not on real hardware.

Thanks,
Arina

> On 1 Dec 2026, at 03:00, netdev-bot+sinfo@kernel.org wrote:
> 
> Notice: This email originated from outside MBZUAI.
> Please exercise caution before clicking links, opening attachments, or sharing sensitive information.
> Hi!
> 
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
> 
> - Whether the issue was actually triggered, or is only theoretical
> (e.g. found by LLM and not proven at runtime). If it was triggered
> please include the symptoms, like the stack trace or kernel messages.
> 
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
> 
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> -- 
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit
  2026-12-01  9:45   ` pstanner
  2026-12-01 18:07     ` Arina Kharlamova
@ 2026-12-01 20:36     ` Bjorn Helgaas
  1 sibling, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2026-12-01 20:36 UTC (permalink / raw)
  To: pstanner@redhat.com
  Cc: Arina Kharlamova, Chandrashekar Devegowda, Liu Haijun,
	Ricardo Martinez, Loic Poulain, Sergey Ryazanov, Johannes Berg,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Krzysztof Wilczyński, Bjorn Helgaas, netdev

On Tue, Dec 01, 2026 at 10:45:31AM +0100, pstanner@redhat.com wrote:
> 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 wonder if sashiko could be taught to look for this issue, e.g.,
maybe something in
https://github.com/sashiko-dev/sashiko/blob/main/projects/linux/prompts/maintainers/pci.md?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-01 20:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 18:31   ` Arina Kharlamova
2026-12-01  0:02 ` Bjorn Helgaas
2026-12-01  9:45   ` pstanner
2026-12-01 18:07     ` Arina Kharlamova
2026-12-01 20:36     ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox