Re: [Xen-devel] [PATCH RFC 03/12] x86/ticketlock: Use C for __ticket_spin_unlock

From: Jeremy Fitzhardinge
Date: Fri Aug 06 2010 - 16:03:12 EST


On 08/06/2010 10:47 AM, H. Peter Anvin wrote:
On 07/20/2010 09:17 AM, Jeremy Fitzhardinge wrote:
"volatile" would be a compiler barrier, but it has no direct effect on,
or relevence to, the CPU. It just cares about the LOCK_PREFIX. The
"memory" clobber is probably unnecessary as well, since the constraints
already tell the compiler the most important information. We can add
barriers separately as needed.

You absolutely need volatile, since otherwise you're permitting the
compiler to split, re-execute or even drop the code. Anything else
might work, by accident, but it's not clean.

I don't think so in this case. The instructions in question are basically lock->waiters++/--; the only reason they need to be asm is that they're locked. But I'm not relying on them for any kind of compiler or cpu ordering or barrier. Where ordering is important, I have explicit barrier()s to enforce it.

J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/