|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/pass-through: alter locking around pt_irq_{create,destroy}_bind()
commit d70db94288f0cbf739c424292f75e2e05669d45d
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Oct 29 09:08:45 2026 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Oct 29 09:08:45 2026 +0100
x86/pass-through: alter locking around pt_irq_{create,destroy}_bind()
The questionable use of pcidevs_lock() there was discussed more than once.
It really is pointless: The functions synchronize primarily via the per-
domain event lock. They also may already be called with the global PCI
devices lock not held: See hvm/vmsi.c:vpci_msi_update(),
hvm/vmsi.c:vpci_msi_arch_update(), and hvm/vmsi.c:vpci_msi_disable().
It's merely msixtbl_pt_{,un}register() which require the global or per-
domain PCI lock held. Switch to using the latter, which is also sufficient
to acquire in read mode. While strictly speaking this is needed only for
PT_IRQ_TYPE_MSI, keep it being unconditional. In vioapic_hwdom_map_gsi()
also unlock earlier.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
---
xen/arch/x86/domctl.c | 8 ++++----
xen/arch/x86/hvm/vioapic.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 51d62617bb..1e00510702 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -636,9 +636,9 @@ long arch_do_domctl(
ret = -EPERM;
else if ( is_iommu_enabled(d) )
{
- pcidevs_lock();
+ read_lock(&d->pci_lock);
ret = pt_irq_create_bind(d, bind);
- pcidevs_unlock();
+ read_unlock(&d->pci_lock);
if ( ret < 0 )
printk(XENLOG_G_ERR "pt_irq_create_bind failed (%ld) for
%pd\n",
@@ -670,9 +670,9 @@ long arch_do_domctl(
ret = -EPERM;
else if ( is_iommu_enabled(d) )
{
- pcidevs_lock();
+ read_lock(&d->pci_lock);
ret = pt_irq_destroy_bind(d, bind);
- pcidevs_unlock();
+ read_unlock(&d->pci_lock);
if ( ret < 0 )
printk(XENLOG_G_ERR "pt_irq_destroy_bind failed (%ld) for
%pd\n",
diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 222e59e2c2..b633f15232 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -197,7 +197,7 @@ static int vioapic_hwdom_map_gsi(unsigned int gsi, unsigned
int trig,
return ret;
}
- pcidevs_lock();
+ read_lock(&currd->pci_lock);
ret = pt_irq_create_bind(currd, &pt_irq_bind);
if ( ret )
{
@@ -207,7 +207,7 @@ static int vioapic_hwdom_map_gsi(unsigned int gsi, unsigned
int trig,
unmap_domain_pirq(currd, pirq);
write_unlock(&currd->event_lock);
}
- pcidevs_unlock();
+ read_unlock(&currd->pci_lock);
return ret;
}
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |