[ofa-general] spin_lock_irqsave in ib_send_mad
Suresh Shelvapille
suri at baymicrosystems.com
Wed Jun 10 11:58:52 PDT 2009
Sean:
Do you see a problem if the piece of code in ib_send_mad is re-written as follows:
----------------------------------------------------
if (qp_info->send_queue.count < qp_info->send_queue.max_active) {
ret = ib_post_send(mad_agent->qp, &mad_send_wr->send_wr,
&bad_send_wr);
spin_lock_irqsave(&qp_info->send_queue.lock, flags);
list = &qp_info->send_queue.list;
} else {
ret = 0;
spin_lock_irqsave(&qp_info->send_queue.lock, flags);
list = &qp_info->overflow_list;
}
--------------------------------------------------------
I tested it in my environment and it seemed to work OK.
Thanks,
Suri
> -----Original Message-----
> From: Sean Hefty [mailto:sean.hefty at intel.com]
> Sent: Wednesday, June 10, 2009 1:01 PM
> To: 'Suresh Shelvapille'; general at lists.openfabrics.org
> Cc: 'Roland Dreier'
> Subject: RE: [ofa-general] spin_lock_irqsave in ib_send_mad
>
> >mad.c:ib_send_mad() calls ib_post_send() after taking spin_lock_irqsave().
> >
> >Is it really necessary to take the spinlock during the entire time of
> >ib_post_send()? It appears like it is only necessary for list manipulation!
>
> It protects the list and the counters. It's technically not needed around
> ib_post_send.
>
> - Sean
More information about the general
mailing list