[ofa-general] RE: [RFC PATCH 3/5] rdma/cma: simplify locking needed for serialization of callbacks

Sean Hefty sean.hefty at intel.com
Tue May 27 11:09:24 PDT 2008


>>> 	spin_lock_irqsave(&id_priv->lock, flags);
>>> 	if (id_priv->state == state) {
>>> -		atomic_inc(&id_priv->dev_remove);
>>> +		mutex_lock(&id_priv->handler_mutex);
>> This just tried to acquire a mutex while holding a spinlock.
>
>I see. So can taking this spin lock be avoided here? I understand that
>spin lock came to protect the state check, correct?

I think we should just remove cma_disable_remove() and cma_enable_remove(), and
instead call mutex_lock/unlock directly in their places.  Where
cma_disable_remove() is called, add in appropriate state checks after acquiring
the mutex.

- Sean




More information about the general mailing list