]> git.karo-electronics.de Git - linux-beck.git/commitdiff
IB/ehca: Rework destroy_eq()
authorAlexander Schmidt <alexs@linux.vnet.ibm.com>
Wed, 9 Dec 2009 18:11:04 +0000 (10:11 -0800)
committerRoland Dreier <rolandd@cisco.com>
Wed, 9 Dec 2009 18:11:04 +0000 (10:11 -0800)
The ibmebus_free_irq() function, which might sleep, was called with
interrupts disabled.  To fix this, make sure that no interrupts are
running by killing the interrupt tasklet.  Also lock the
shca_list_lock to protect against the poll_eqs_timer running
concurrently.

Signed-off-by: Alexander Schmidt <alexs@linux.vnet.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ehca/ehca_classes.h
drivers/infiniband/hw/ehca/ehca_eq.c
drivers/infiniband/hw/ehca/ehca_main.c

index c825142a2fb752c7514e3af7d95d13c6d2d60f8b..0136abd50dd4cc5ff9ca5034589b6ab3cd923d55 100644 (file)
@@ -375,6 +375,7 @@ extern rwlock_t ehca_qp_idr_lock;
 extern rwlock_t ehca_cq_idr_lock;
 extern struct idr ehca_qp_idr;
 extern struct idr ehca_cq_idr;
+extern spinlock_t shca_list_lock;
 
 extern int ehca_static_rate;
 extern int ehca_port_act_time;
index 523e733c630e560acf6585ed1f35e772378e9649..3b87589b8ea0362c1a71e5b15cfdf9247b43f071 100644 (file)
@@ -169,12 +169,15 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq)
        unsigned long flags;
        u64 h_ret;
 
-       spin_lock_irqsave(&eq->spinlock, flags);
        ibmebus_free_irq(eq->ist, (void *)shca);
 
-       h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq);
+       spin_lock_irqsave(&shca_list_lock, flags);
+       eq->is_initialized = 0;
+       spin_unlock_irqrestore(&shca_list_lock, flags);
 
-       spin_unlock_irqrestore(&eq->spinlock, flags);
+       tasklet_kill(&eq->interrupt_task);
+
+       h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq);
 
        if (h_ret != H_SUCCESS) {
                ehca_err(&shca->ib_device, "Can't free EQ resources.");
index fb2d83c5bf010f955fd0ee7cb440724a5a5336bd..129a6bebd6e37bc20f6b3f36e77b0fb7653865e5 100644 (file)
@@ -123,7 +123,7 @@ DEFINE_IDR(ehca_qp_idr);
 DEFINE_IDR(ehca_cq_idr);
 
 static LIST_HEAD(shca_list); /* list of all registered ehcas */
-static DEFINE_SPINLOCK(shca_list_lock);
+DEFINE_SPINLOCK(shca_list_lock);
 
 static struct timer_list poll_eqs_timer;