Re: [PATCH v7 2/4] s390/pci: Reuse FMB buffer and preserve state in device re-enablement

From: Alex Williamson

Date: Wed Sep 30 2026 - 16:56:03 EST


On Tue, 22 Sep 2026 15:51:39 -0400
Omar Elghoul <oelghoul@xxxxxxxxxxxxx> wrote:

> Introduce the function zpci_fmb_reenable_device() that checks the state
> of function measurement and ensures it is enabled. Reset the counters to
> zero, disable, and re-enable the FMB if it was already enabled. Call
> this function from zpci_reenable_device().
>
> Don't free the FMB buffer during disabling and reuse it when re-enabling
> measurement. Instead, free the buffer upon device teardown, allowing the
> same buffer to be reused in the enable path and add the bit fmb_enabled
> to struct zpci_dev. Audit the only consumer of zdev->fmb and update it
> to reflect the change in semantics.
>
> Signed-off-by: Omar Elghoul <oelghoul@xxxxxxxxxxxxx>
> ---
> arch/s390/include/asm/pci.h | 2 +
> arch/s390/pci/pci.c | 77 +++++++++++++++++++++++++++++--------
> arch/s390/pci/pci_debug.c | 2 +-
> 3 files changed, 63 insertions(+), 18 deletions(-)
>
> diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
> index 88a125b92bdd..b8162f7a8968 100644
> --- a/arch/s390/include/asm/pci.h
> +++ b/arch/s390/include/asm/pci.h
> @@ -175,6 +175,7 @@ struct zpci_dev {
> u8 util_str_avail : 1;
> u8 tid_avail : 1;
> u8 rtr_avail : 1; /* Relaxed translation allowed */
> + u8 fmb_enabled : 1;

This appears safe, fmb_enabled seems to be the only runtime mutated
bitfield in this set, but it might be a good idea to flag it as such or
use a separate storage unit to avoid a tearing hazard in the future.
Thanks,

Alex