lkml.org 
[lkml]   [2011]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH 3/8] x86/ticketlock: Use C for __ticket_spin_unlock
    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@citrix.com>
    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@citrix.com>

    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



    \
     
     \ /
      Last update: 2011-07-22 23:25    [W:2.380 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site