[ofa-general] Dubious use of barrier() in ipath

Roland Dreier rdreier at cisco.com
Wed Feb 6 14:37:06 PST 2008


In ipath_rc.c, there are a couple of places that do:

		qp->r_msn++;
		qp->r_psn++;
		qp->r_state = opcode;
		qp->r_nak_state = 0;
		barrier();
		qp->r_head_ack_queue = next;

This looks pretty suspicious to me -- I haven't really tried to
understand the code, but it has the flavor of protecting against
another CPU seeing the r_head_ack_queue update before the other
updates; and barrier() doesn't actually do that.  If this code is
correct, I think a comment explaining the barrier() would be good.

But I have the feeling that the barrier() should really be wmb(), with
rmb()s added on the reader side.

 - R.



More information about the general mailing list