[lkml]   [2015]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [BUG][tip/master] kernel panic while locking selftest at qspinlock_paravirt.h:137!
On 07/10/2015 08:32 PM, Masami Hiramatsu wrote:
> On 2015/07/10 23:28, Peter Zijlstra wrote:
>> On Fri, Jul 10, 2015 at 03:57:46PM +0200, Ingo Molnar wrote:
>>> * Peter Zijlstra<> wrote:
>>>> Do we want to make double unlock non-fatal unconditionally?
>>> No, just don't BUG() out, don't crash the system - generate a warning?
>> So that would be a yes..
>> Something like so then? Won't this generate a splat on that locking self
>> test then? And upset people?
> Hmm, yes, this still noisy...
> Can't we avoid double-unlock completely? it seems that this warning can
> happen randomly, which means pv-spinlock randomly broken, doesn't it?

It shouldn't randomly happen. The message should be printed at the first
instance of double-unlock. If that is not case, there may be some
problem in the code.

Anyway, I have an alternative fix that should better capture the problem:

diff --git a/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))

+ if (unlikely(lockval != _Q_SLOW_VAL)) {
+ "pvqspinlock: lock 0x%lx has corrupted value 0x%x!\n",
+ (unsigned long)lock, atomic_read(&lock->val));
+ return;
+ }
* Since the above failed to release, this must be the SLOW path.
* Therefore start by looking up the blocked node and unhashing it.

 \ /
  Last update: 2015-07-11 09:01    [W:0.055 / U:1.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site