All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Waiman Long <Waiman.Long@hp.com>, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrey Ryabinin <a.ryabinin@samsung.com>,
	Dave Jones <davej@codemonkey.org.uk>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: sched: memory corruption on completing completions
Date: Thu, 05 Feb 2015 15:44:35 -0500	[thread overview]
Message-ID: <54D3D633.3000602@oracle.com> (raw)
In-Reply-To: <20150205093024.GF5029@twins.programming.kicks-ass.net>

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

  reply	other threads:[~2015-02-05 20:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 23:24 sched: memory corruption on completing completions Sasha Levin
2015-02-04 23:46 ` Andrew Morton
2015-02-05  0:16 ` Linus Torvalds
2015-02-05  7:10   ` Ingo Molnar
2015-02-05  9:30   ` Peter Zijlstra
2015-02-05 20:44     ` Sasha Levin [this message]
2015-02-05 20:59   ` Davidlohr Bueso
2015-02-05 21:02     ` Sasha Levin
2015-02-05 21:34       ` Linus Torvalds
2015-02-05 22:37         ` Davidlohr Bueso
2015-02-05 22:57           ` Linus Torvalds
2015-02-06  6:48             ` Raghavendra K T
2015-02-06 15:00               ` Raghavendra K T
2015-02-06 12:29           ` Raghavendra K T

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D3D633.3000602@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=Waiman.Long@hp.com \
    --cc=a.ryabinin@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.