[openib-general] Re: [PATCH] remove locking for cq event (was: rcu for event speedup)
Michael S. Tsirkin
mst at mellanox.co.il
Wed Jan 26 10:26:07 PST 2005
The following patch avoids taking
the cq table lock on data path.
This gets a nice speedup (about 4%) in IP over
IB on my hardware.
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Index: hw/mthca/mthca_cq.c
===================================================================
--- hw/mthca/mthca_cq.c (revision 1653)
+++ hw/mthca/mthca_cq.c (working copy)
@@ -180,11 +180,8 @@ void mthca_cq_event(struct mthca_dev *de
{
struct mthca_cq *cq;
- spin_lock(&dev->cq_table.lock);
cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
- if (cq)
- atomic_inc(&cq->refcount);
- spin_unlock(&dev->cq_table.lock);
+ read_barrier_depends();
if (!cq) {
mthca_warn(dev, "Completion event for bogus CQ %08x\n", cqn);
@@ -192,9 +189,6 @@ void mthca_cq_event(struct mthca_dev *de
}
cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
-
- if (atomic_dec_and_test(&cq->refcount))
- wake_up(&cq->wait);
}
void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn)
@@ -785,6 +779,15 @@ void mthca_free_cq(struct mthca_dev *dev
cq->cqn & (dev->limits.num_cqs - 1));
spin_unlock_irq(&dev->cq_table.lock);
+ wmb();
+
+ if (dev->mthca_flags & MTHCA_FLAG_MSI_X)
+ synchronize_irq(dev->eq_table.eq[MTHCA_EQ_COMP].msi_x_vector);
+ else
+ synchronize_irq(dev->pdev->irq);
+
+
+
atomic_dec(&cq->refcount);
wait_event(cq->wait, !atomic_read(&cq->refcount));
--
I dont speak for Mellanox
More information about the general
mailing list