Skip to contentSkip to conversation

linux 2.6.18: change pcifront locking

PATCH In review Jan Beulich 1 participant 1 message Mar 5, 2007 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 6/10 linux 2.6.18: change pcifront locking

pci_bus_sem is getting acquired by free_root_bus_devs() exclusively for lookup purposes in my understanding, hence it can be a read acquire, not a write one.

drivers/xen/pcifront/pci_op.c +4 -4
Index: head-2007-02-27/drivers/xen/pcifront/pci_op.c
===================================================================
@@ -239,17 +239,17 @@ static void free_root_bus_devs(struct pc
 {
 	struct pci_dev *dev;
 
-	down_write(&pci_bus_sem);
+	down_read(&pci_bus_sem);
 	while (!list_empty(&bus->devices)) {
 		dev = container_of(bus->devices.next, struct pci_dev, bus_list);
-		up_write(&pci_bus_sem);
+		up_read(&pci_bus_sem);
 
 		dev_dbg(&dev->dev, "removing device\n");
 		pci_remove_bus_device(dev);
 
-		down_write(&pci_bus_sem);
+		down_read(&pci_bus_sem);
 	}
-	up_write(&pci_bus_sem);
+	up_read(&pci_bus_sem);
 }
 
 void pcifront_free_roots(struct pcifront_device *pdev)