Re: [PATCH v2 6/7] s390/pci: Set MSI_FLAG_NO_AFFINITY at IRQ init time
From: Niklas Schnelle
Date: Tue Oct 06 2026 - 11:42:33 EST
On Mon, 2026-10-05 at 14:03 +0200, Tobias Schumacher wrote:
> MSI_FLAG_NO_AFFINITY is added to zpci_msi_parent_ops.required_flags from
> zpci_create_parent_msi_domain(), which runs for every new PCI bus,
> including buses created at runtime from a hotplug availability event.
>
> That is a non-atomic read-modify-write on a field which
> msi_lib_init_dev_msi_info() reads without a common lock while setting up
> MSI for a device on an already existing bus:
>
> required_flags = pops->required_flags;
>
> The stored value is always the same, so no caller observes a change, but
> the race need not exist: irq_delivery is decided once in zpci_irq_init()
> and never changes afterwards.
>
> Set the flag there instead, before any parent domain exists.
>
> Signed-off-by: Tobias Schumacher <ts@xxxxxxxxxxxxx>
> ---
> arch/s390/pci/pci_irq.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c
> index 682bceb6525e..661867a1ffad 100644
> --- a/arch/s390/pci/pci_irq.c
> +++ b/arch/s390/pci/pci_irq.c
> @@ -523,9 +523,6 @@ int zpci_create_parent_msi_domain(struct zpci_bus *zbus)
> return -ENOMEM;
> }
>
> - if (irq_delivery == FLOATING)
> - zpci_msi_parent_ops.required_flags |= MSI_FLAG_NO_AFFINITY;
> -
> zbus->msi_parent_domain = msi_create_parent_irq_domain(&info, &zpci_msi_parent_ops);
> if (!zbus->msi_parent_domain) {
> irq_domain_free_fwnode(info.fwnode);
> @@ -636,6 +633,9 @@ int __init zpci_irq_init(void)
> if (s390_pci_force_floating)
> irq_delivery = FLOATING;
>
> + if (irq_delivery == FLOATING)
> + zpci_msi_parent_ops.required_flags |= MSI_FLAG_NO_AFFINITY;
> +
> if (irq_delivery == DIRECTED)
> zpci_airq.handler = zpci_directed_irq_handler;
>
Looks good to me and I agree the race is benign as everyone races to
write the same value but this is certainly cleaner. Thanks.
Reviewed-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>