public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Waiman Long <waiman.long@hp.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Ingo Molnar <mingo@kernel.org>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [BUG][tip/master] kernel panic while locking selftest at qspinlock_paravirt.h:137!
Date: Sat, 11 Jul 2015 12:22:19 +0200	[thread overview]
Message-ID: <20150711102219.GP19282@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <55A07111.6030900@hp.com>

On Fri, Jul 10, 2015 at 09:27:45PM -0400, Waiman Long wrote:
> Anyway, I have an alternative fix that should better capture the problem:
> 
> -------------------------------
> diff --git a/kernel/locking/qspinlock_paravirt.h
> b/kernel/locking/qspinlock_paravirt.h
> index 04ab181..92fc54f 100644
> --- a/kernel/locking/qspinlock_paravirt.h
> +++ b/kernel/locking/qspinlock_paravirt.h
> @@ -286,15 +286,24 @@ __visible void __pv_queued_spin_unlock(struct
> qspinlock *lock)
>  {
>      struct __qspinlock *l = (void *)lock;
>      struct pv_node *node;
> +    u8 lockval = cmpxchg(&l->locked, _Q_LOCKED_VAL, 0);
> 
>      /*
>       * We must not unlock if SLOW, because in that case we must first
>       * unhash. Otherwise it would be possible to have multiple @lock
>       * entries, which would be BAD.
>       */
> -    if (likely(cmpxchg(&l->locked, _Q_LOCKED_VAL, 0) == _Q_LOCKED_VAL))
> +    if (likely(lockval == _Q_LOCKED_VAL))
>          return;
> 
> +    if (unlikely(lockval != _Q_SLOW_VAL)) {
> +        printk(KERN_WARNING
> +               "pvqspinlock: lock 0x%lx has corrupted value 0x%x!\n",
> +               (unsigned long)lock, atomic_read(&lock->val));
> +        WARN_ON_ONCE(1);

	WARN_ONCE(1, "foo");

> +        return;
> +    }

Right, so since this should not ever happen in 'sane' code, its a shame
to have to put in this condition. But yes, this works too.

  parent reply	other threads:[~2015-07-11 10:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 11:32 [BUG][tip/master] kernel panic while locking selftest at qspinlock_paravirt.h:137! Masami Hiramatsu
2015-07-10 13:00 ` Peter Zijlstra
2015-07-10 13:57   ` Ingo Molnar
2015-07-10 14:28     ` Peter Zijlstra
2015-07-11  0:32       ` Masami Hiramatsu
2015-07-11  1:27         ` Waiman Long
2015-07-11  5:05           ` Masami Hiramatsu
2015-07-12  3:09             ` Waiman Long
2015-07-11 10:22           ` Peter Zijlstra [this message]
2015-07-11 10:27       ` Ingo Molnar

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=20150711102219.GP19282@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=waiman.long@hp.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox