[openfabrics-ewg] [PATCH ofed-1.2 1/6] ehca: fix yield with spinlock held and mismatched unlock

Hoang-Nam Nguyen hnguyen at linux.vnet.ibm.com
Fri Jan 26 16:59:46 PST 2007


ehca_cq.c: fix yield with spinlock held
ehca_irq.c: fix mismatched unlock


Signed-off-by: Hoang-Nam Nguyen <hnguyen at de.ibm.com>
---


 ehca_cq.c  |    5 ++++-
 ehca_irq.c |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)


diff -Nurp ofed_1_2_jan26/drivers/infiniband/hw/ehca/ehca_cq.c ofed_1_2_nam/drivers/infiniband/hw/ehca/ehca_cq.c
--- ofed_1_2_jan26/drivers/infiniband/hw/ehca/ehca_cq.c	2007-01-27 00:28:38.000000000 +0100
+++ ofed_1_2_nam/drivers/infiniband/hw/ehca/ehca_cq.c	2007-01-27 00:35:09.000000000 +0100
@@ -344,8 +344,11 @@ int ehca_destroy_cq(struct ib_cq *cq)
 	unsigned long flags;
 
 	spin_lock_irqsave(&ehca_cq_idr_lock, flags);
-	while (my_cq->nr_callbacks)
+	while (my_cq->nr_callbacks) {
+		spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
 		yield();
+		spin_lock_irqsave(&ehca_cq_idr_lock, flags);
+	}
 
 	idr_remove(&ehca_cq_idr, my_cq->token);
 	spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
diff -Nurp ofed_1_2_jan26/drivers/infiniband/hw/ehca/ehca_irq.c ofed_1_2_nam/drivers/infiniband/hw/ehca/ehca_irq.c
--- ofed_1_2_jan26/drivers/infiniband/hw/ehca/ehca_irq.c	2007-01-27 00:28:38.000000000 +0100
+++ ofed_1_2_nam/drivers/infiniband/hw/ehca/ehca_irq.c	2007-01-27 00:39:12.000000000 +0100
@@ -440,7 +440,8 @@ void ehca_tasklet_eq(unsigned long data)
 					cq = idr_find(&ehca_cq_idr, token);
 
 					if (cq == NULL) {
-						spin_unlock(&ehca_cq_idr_lock);
+						spin_unlock_irqrestore(&ehca_cq_idr_lock,
+								       flags);
 						break;
 					}
 




More information about the ewg mailing list