From: "Jan Beulich" Subject: [PATCH 6/10] linux 2.6.18: change pcifront locking Date: Mon, 05 Mar 2007 11:16:29 +0000 Message-ID: <45EC0A1D.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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. Signed-off-by: Jan Beulich Index: head-2007-02-27/drivers/xen/pcifront/pci_op.c =================================================================== --- head-2007-02-27.orig/drivers/xen/pcifront/pci_op.c 2007-03-05 10:00:18.000000000 +0100 +++ head-2007-02-27/drivers/xen/pcifront/pci_op.c 2007-02-27 16:27:37.000000000 +0100 @@ -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)