Re: [PATCH 1/4, v2] x86: enlightenment for ticket spin locks -base implementation

From: Peter Zijlstra
Date: Wed Jun 30 2010 - 04:24:42 EST


On Tue, 2010-06-29 at 15:31 +0100, Jan Beulich wrote:
> @@ -62,18 +110,20 @@ static __always_inline void __ticket_spi
> {
> short inc = 0x0100;
>
> - asm volatile (
> + alternative_common(
> LOCK_PREFIX "xaddw %w0, %1\n"
> "1:\t"
> "cmpb %h0, %b0\n\t"
> - "je 2f\n\t"
> + "je 2f\n\t",
> "rep ; nop\n\t"
> "movb %1, %b0\n\t"
> /* don't need lfence here, because loads are in-order
> */
> "jmp 1b\n"
> - "2:"
> - : "+Q" (inc), "+m" (lock->slock)
> - :
> + "2:",
> + ALTERNATIVE_TICKET_LOCK,
> + X86_FEATURE_SPINLOCK_YIELD,
> + ASM_OUTPUT2("+Q" (inc), "+m" (lock->slock)),
> + [stub] "i" (virt_spin_lock_stub)
> : "memory", "cc");
> }


Also, instead of obfuscating __ticket_spin_lock(), can't you provide a
whole alternative arch_spin_lock() implementation and switch between
that and whatever bat-shit these paravirt people come up with?
--
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/