From: sashiko-bot@kernel.org
To: "Omar Elghoul" <oelghoul@linux.ibm.com>,
linux-s390@vger.kernel.org, kvm@vger.kernel.org
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v13 2/5] s390/pci: Improve function measurement state management
Date: Wed, 11 Nov 2026 17:20:59 +0000 [thread overview]
Message-ID: <sashiko-outbox-209403@kernel.org> (raw)
In-Reply-To: <20261111162758.9792-3-oelghoul@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] s390/pci: zpci_reenable_device() enables FMB on disabled PCI
devices
--
commit fa84ea4339ffa82b899be0638304928f5c7daa03
Author: Omar Elghoul <oelghoul@linux.ibm.com>
s390/pci: Improve function measurement state management
This commit tracks the desired function measurement state in
zdev->statistics_on and restores it when enabling, disabling, or
re-enabling a zPCI device.
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index c055a9ad09724..f49736386eb7c 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
[ ... ]
> @@ -737,8 +769,14 @@ int zpci_reenable_device(struct zpci_dev *zdev)
> }
>
> rc = zpci_iommu_register_ioat(zdev, &status);
> - if (rc)
> + if (rc) {
> zpci_disable_device(zdev);
> + return rc;
> + }
> +
> + guard(mutex)(&zdev->fmb_lock);
> + if (zdev->statistics_on)
> + zpci_fmb_enable(zdev);
>
> return rc;
> }
[Severity: Medium]
Does this enable FMB measurement in firmware when the PCI device is
disabled?
zdev->statistics_on is initialized to 1 in zpci_create_device() and
remains 1 after pcibios_disable_device() disables FMB. Callers such as
_do_recover() and vfio_pci_core_disable() -> ... -> zpci_hot_reset_device()
disable or remove the struct pci_dev before calling
zpci_reenable_device(zdev):
arch/s390/pci/pci_sysfs.c:_do_recover() {
pci_stop_and_remove_bus_device(pdev);
if (zdev_enabled(zdev)) {
ret = zpci_disable_device(zdev);
...
}
ret = zpci_reenable_device(zdev);
}
Because zdev->statistics_on is still 1, zpci_reenable_device() allocates
zdev->fmb and enables FMB DMA in firmware even though pcibios_disable_device()
already ran. If no driver re-enables the PCI device, firmware FMB
measurement stays active on a disabled device, and at this commit
zpci_release_device() leaks zdev->fmb if the device is later deconfigured
(though commit "s390/pci: Improve FMB memory management" later in the
series frees zdev->fmb on release). When a driver does later enable the
device, pcibios_enable_device() -> zpci_fmb_enable() sees zdev->fmb
already allocated and returns -EINVAL instead of zeroing zdev->fmb and
resetting the software IOMMU counters.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111162758.9792-1-oelghoul@linux.ibm.com?part=2
next prev parent reply other threads:[~2026-11-11 17:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 16:27 [PATCH v13 0/5] vfio-pci/zdev: Improved zPCI Function Measurement Support Omar Elghoul
2026-11-11 16:27 ` [PATCH v13 1/5] s390/pci: Hold fmb_lock when enabling or disabling PCI devices Omar Elghoul
2026-11-11 16:27 ` [PATCH v13 2/5] s390/pci: Improve function measurement state management Omar Elghoul
2026-11-11 17:20 ` sashiko-bot [this message]
2026-11-11 20:33 ` Niklas Schnelle
2026-11-11 20:37 ` Niklas Schnelle
2026-11-11 16:27 ` [PATCH v13 3/5] s390/pci: Improve FMB memory management Omar Elghoul
2026-11-11 20:39 ` Niklas Schnelle
2026-11-11 16:27 ` [PATCH v13 4/5] s390/pci: Fence FMB enable/disable via debugfs for passthrough devices Omar Elghoul
2026-11-11 16:27 ` [PATCH v13 5/5] vfio-pci/zdev: Add VFIO FMB device features Omar Elghoul
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-209403@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