Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754539AbbBEUpX (ORCPT ); Thu, 5 Feb 2015 15:45:23 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:44664 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754493AbbBEUpT (ORCPT ); Thu, 5 Feb 2015 15:45:19 -0500 Message-ID: <54D3D633.3000602@oracle.com> Date: Thu, 05 Feb 2015 15:44:35 -0500 From: Sasha Levin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Peter Zijlstra , Linus Torvalds CC: Waiman Long , Ingo Molnar , Andrew Morton , Andrey Ryabinin , Dave Jones , LKML Subject: Re: sched: memory corruption on completing completions References: <54D2AA16.6030706@oracle.com> <20150205093024.GF5029@twins.programming.kicks-ass.net> In-Reply-To: <20150205093024.GF5029@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1773 Lines: 47 On 02/05/2015 04:30 AM, Peter Zijlstra wrote: > On Wed, Feb 04, 2015 at 04:16:54PM -0800, Linus Torvalds wrote: >> > Why did I think we had this bug but already fixed it ? Maybe it's one >> > of those things that Waiman fixed in his long delayed qspinlock >> > series? Waiman? > ISTR that that would do the exact same thing, but I need to go look a > the latest paravirt code -- that's the part that we all were still > bothered with. Testing Linus's explanation, I tried simply: diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index 7050d86..54454da 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h @@ -142,7 +142,7 @@ static inline void __ticket_unlock_slowpath(arch_spinlock_t *lock, __ticket_unlock_kick(lock, old.tickets.head); } } - +static inline int arch_spin_is_locked(arch_spinlock_t *lock); static __always_inline void arch_spin_unlock(arch_spinlock_t *lock) { if (TICKET_SLOWPATH_FLAG && @@ -153,7 +153,7 @@ static __always_inline void arch_spin_unlock(arch_spinlock_t *lock) add_smp(&lock->tickets.head, TICKET_LOCK_INC); /* add_smp() is a full mb() */ - + WARN_ON(arch_spin_is_locked(lock)); if (unlikely(lock->tickets.tail & TICKET_SLOWPATH_FLAG)) __ticket_unlock_slowpath(lock, prev); } else And the warnings confirmed that the lock is indeed "unlocked" before we finished arch_spin_unlock()... Thanks, Sasha -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/