[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/4] x86/physdev: use less heavy locking in physdev_unmap_pirq()



On Thu, Oct 29, 2026 at 03:23:56PM +0100, Jan Beulich wrote:
> Like its mapping counterpart, in the GSI case no (PCI-related) lock would
> be needed at all, while in the MSI cases the domain's PCI lock is
> sufficient to hold.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> --- a/xen/arch/x86/physdev.c
> +++ b/xen/arch/x86/physdev.c
> @@ -156,11 +156,11 @@ int physdev_unmap_pirq(struct domain *d,
>              return ret;
>      }
>  
> -    pcidevs_lock();
> +    read_lock(&d->pci_lock);
>      write_lock(&d->event_lock);
>      ret = unmap_domain_pirq(d, pirq);
>      write_unlock(&d->event_lock);
> -    pcidevs_unlock();
> +    read_unlock(&d->pci_lock);

I think there's possibly one pre-patch that would be needed before
making this change.  Callers of pci_restore_msi_state() only hold the
pcidevs lock, dropping pcidevs lock here we would be allowing changes
to the list while there's possibly a concurrent access by
pci_restore_msi_state().

I think pci_restore_msi_state() (or its callers) need to hold the
d->event_lock, and this likely wants to be a pre-patch.  Not holding
d->event_lock while iterating over pdev->msi_list in
pci_restore_msi_state() seems like a pre-existing issue that would be
uncovered by this patch, albeit it's not clear what d->event_lock is
supposed to protect exactly.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.