Re: [PATCH 3/8] x86/ticketlock: Use C for __ticket_spin_unlock

From: Jeremy Fitzhardinge
Date: Fri Jul 22 2011 - 17:23:25 EST


On 07/22/2011 11:32 AM, H. Peter Anvin wrote:
> On 06/24/2011 03:41 PM, Jeremy Fitzhardinge wrote:
>> On 06/24/2011 02:52 PM, H. Peter Anvin wrote:
>>> These should be asm volatile, I believe.
>> OK.
>>
>> J
> You still owe me a new patch here, I believe...

Ah, yes, though I don't think it can make a difference in practice,
since the caller contains barrier()s on either side. And the non-asm
non-locked variant has no equivalent. But it can't hurt.

J

From: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Date: Fri, 22 Jul 2011 12:27:14 -0700
Subject: [PATCH] x86/ticketlocks: make asms volatile to be extra sure

Make the locked-unlock asms volatile, just to be extra sure they won't wander away.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 2d14e7c..05fd59e 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -36,11 +36,11 @@
static __always_inline void __ticket_unlock_release(struct arch_spinlock *lock)
{
if (sizeof(lock->tickets.head) == sizeof(u8))
- asm (LOCK_PREFIX "incb %0"
- : "+m" (lock->tickets.head) : : "memory");
+ asm volatile (LOCK_PREFIX "incb %0"
+ : "+m" (lock->tickets.head) : : "memory");
else
- asm (LOCK_PREFIX "incw %0"
- : "+m" (lock->tickets.head) : : "memory");
+ asm volatile (LOCK_PREFIX "incw %0"
+ : "+m" (lock->tickets.head) : : "memory");

}
#else


--
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/