From: sashiko-bot@kernel.org
To: "Omar Elghoul" <oelghoul@linux.ibm.com>
Cc: kvm@vger.kernel.org, "Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH v8 1/4] s390/pci: Hold fmb_lock when enabling or disabling PCI devices
Date: Tue, 06 Oct 2026 16:22:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-162246@kernel.org> (raw)
In-Reply-To: <20261005154557.57801-2-oelghoul@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] pci/s390: Race between pcibios_disable_device() and debugfs write leaves FMB enabled
--
commit 6846c80d4f9b53691af0a39418f819b11bc5390b
Author: Omar Elghoul <oelghoul@linux.ibm.com>
s390/pci: Hold fmb_lock when enabling or disabling PCI devices
Ensure that fmb_lock is held by pcibios_enable_device() and
pcibios_disable_device() when calling zpci_fmb_enable_device() or
zpci_fmb_disable_device(), respectively. Additionally, assert that the
fmb_lock is held within the latter two functions.
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index d64c544b32b0c..c055a9ad09724 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
[ ... ]
> @@ -648,7 +654,9 @@ void pcibios_disable_device(struct pci_dev *pdev)
> {
> struct zpci_dev *zdev = to_zpci(pdev);
>
> + mutex_lock(&zdev->fmb_lock);
> zpci_fmb_disable_device(zdev);
> + mutex_unlock(&zdev->fmb_lock);
> zpci_debug_exit_device(zdev);
> }
[Severity: Medium]
Does this create a race condition with debugfs writes?
Releasing fmb_lock before calling zpci_debug_exit_device() creates a window
where a blocked debugfs writer to the statistics file via pci_perf_seq_write()
can wake up, acquire the lock, and re-enable the Function Measurement Block
(FMB).
zpci_debug_exit_device() will then wait for the writer to finish and tear down
the debugfs files, leaving the device disabled but with FMB actively running
in hardware.
Should zpci_debug_exit_device() be called before acquiring fmb_lock to drain
active accesses and prevent new ones?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261005154557.57801-1-oelghoul@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-10-06 16:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 15:45 [PATCH v8 0/4] vfio-pci/zdev: Improved zPCI Function Measurement Support Omar Elghoul
2026-10-05 15:45 ` [PATCH v8 1/4] s390/pci: Hold fmb_lock when enabling or disabling PCI devices Omar Elghoul
2026-10-06 16:22 ` sashiko-bot [this message]
2026-10-05 15:45 ` [PATCH v8 2/4] s390/pci: Reuse FMB buffer and preserve state in device re-enablement Omar Elghoul
2026-10-05 19:53 ` Niklas Schnelle
2026-10-05 22:05 ` Omar Elghoul
2026-10-06 8:48 ` Niklas Schnelle
2026-10-06 16:25 ` sashiko-bot
2026-10-05 15:45 ` [PATCH v8 3/4] s390/pci: Fence FMB enable/disable via debugfs for passthrough devices Omar Elghoul
2026-10-05 18:42 ` Niklas Schnelle
2026-10-06 16:19 ` sashiko-bot
2026-10-05 15:45 ` [PATCH v8 4/4] vfio-pci/zdev: Add VFIO FMB device features Omar Elghoul
2026-10-06 16:18 ` sashiko-bot
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-162246@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=oelghoul@linux.ibm.com \
--cc=sashiko-reviews@lists.linux.dev \
/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