From b1766b62890e3bba1a778a20ef8bf9348d6096c2 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Fri, 16 Sep 2011 14:43:14 -0400 Subject: xen/pciback: Use mutexes when working with Xenbus state transitions. The caller that orchestrates the state changes is xenwatch_thread and it takes a mutex. In our processing of Xenbus states we can take the luxery of going to sleep on a mutex, so lets do that and also fix this bug: BUG: sleeping function called from invalid context at /linux/kernel/mutex.c:271 in_atomic(): 1, irqs_disabled(): 0, pid: 32, name: xenwatch 2 locks held by xenwatch/32: #0: (xenwatch_mutex){......}, at: [] xenwatch_thread+0x4b/0x180 #1: (&(&pdev->dev_lock)->rlock){......}, at: [] xen_pcibk_disconnect+0x1b/0x80 Pid: 32, comm: xenwatch Not tainted 3.1.0-rc6-00015-g3ce340d #2 Call Trace: [] __might_sleep+0x102/0x130 [] mutex_lock_nested+0x2f/0x50 [] unbind_from_irq+0x2c/0x1b0 [] ? free_irq+0x56/0xb0 [] unbind_from_irqhandler+0x1c/0x30 [] xen_pcibk_disconnect+0x2b/0x80 [] xen_pcibk_frontend_changed+0xe8/0x140 [] xenbus_otherend_changed+0xd2/0x150 [] ? get_parent_ip+0x11/0x50 [] frontend_changed+0x10/0x20 [] xenwatch_thread+0xb2/0x180 Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/xen-pciback/pciback.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/xen/xen-pciback/pciback.h') diff --git a/drivers/xen/xen-pciback/pciback.h b/drivers/xen/xen-pciback/pciback.h index d095acdc0e65..e9b4011c5f9a 100644 --- a/drivers/xen/xen-pciback/pciback.h +++ b/drivers/xen/xen-pciback/pciback.h @@ -29,7 +29,7 @@ struct pci_dev_entry { struct xen_pcibk_device { void *pci_dev_data; - spinlock_t dev_lock; + struct mutex dev_lock; struct xenbus_device *xdev; struct xenbus_watch be_watch; u8 be_watching; -- cgit v1.2.3