From: sashiko-bot@kernel.org
To: "Li Yifan" <yifan2.li@intel.com>, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI/PTM: Keep ptm_enable_cnt balanced when pci_enable_ptm() fails
Date: Wed, 04 Nov 2026 12:29:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-197253@kernel.org> (raw)
In-Reply-To: <20261104121457.2108515-1-yifan2.li@intel.com>
> Since commit e1092d5e15e6 ("PCI/PTM: Do not enable PTM automatically
> for Root and Switch Upstream Ports"), pci_enable_ptm() takes a
> reference on the device and on each port of the upstream path, and
> pci_disable_ptm() releases them. If pci_enable_ptm() fails, the counts
> can become incorrect in two ways:
>
> 1. pci_disable_ptm() decrements dev->ptm_enable_cnt without a check.
> Many drivers ignore the return value of pci_enable_ptm() and call
> pci_disable_ptm() unconditionally, for example mlx5 and bnxt. If
> pci_enable_ptm() failed, for example because the upstream port does
> not support PTM, the count becomes -1 and stays negative after the
> driver unbinds. Then pcie_ptm_enabled() returns true, and
> pci_resume_ptm() can enable PTM on the device after a resume,
> although the upstream path does not support PTM. Before
> e1092d5e15e6, pci_disable_ptm() did nothing if PTM was not enabled.
> [ ... ]
> Cc: stable@vger.kernel.org
> Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
> Link: https://lore.kernel.org/r/20261102222817.GA983941@bhelgaas
> Link: https://lore.kernel.org/r/20260616141733.1688264-1-vulab@iscas.ac.cn # [1]
> Signed-off-by: Li Yifan <yifan2.li@intel.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104121457.2108515-1-yifan2.li@intel.com?part=1
prev parent reply other threads:[~2026-11-04 12:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 12:14 [PATCH] PCI/PTM: Keep ptm_enable_cnt balanced when pci_enable_ptm() fails Li Yifan
2026-11-04 12:29 ` sashiko-bot [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=sashiko-outbox-197253@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yifan2.li@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