Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932583AbbGJO2o (ORCPT ); Fri, 10 Jul 2015 10:28:44 -0400 Received: from casper.infradead.org ([85.118.1.10]:40881 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932501AbbGJO2b (ORCPT ); Fri, 10 Jul 2015 10:28:31 -0400 Date: Fri, 10 Jul 2015 16:28:24 +0200 From: Peter Zijlstra To: Ingo Molnar Cc: Masami Hiramatsu , Ingo Molnar , linux-kernel , Waiman Long Subject: Re: [BUG][tip/master] kernel panic while locking selftest at qspinlock_paravirt.h:137! Message-ID: <20150710142824.GK19282@twins.programming.kicks-ass.net> References: <559FAD5E.3080309@hitachi.com> <20150710130028.GI19282@twins.programming.kicks-ass.net> <20150710135746.GA13461@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150710135746.GA13461@gmail.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1474 Lines: 41 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? --- kernel/locking/qspinlock_paravirt.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h index 04ab18151cc8..286e8978a562 100644 --- a/kernel/locking/qspinlock_paravirt.h +++ b/kernel/locking/qspinlock_paravirt.h @@ -133,8 +133,14 @@ static struct pv_node *pv_unhash(struct qspinlock *lock) * This guarantees a limited lookup time and is itself guaranteed by * having the lock owner do the unhash -- IFF the unlock sees the * SLOW flag, there MUST be a hash entry. + * + * This can trigger due to double-unlock. In which case, return a + * random pointer so that __pv_queued_spin_unlock() can dereference it + * without crashing. */ - BUG(); + WARN_ON_ONCE(true); + + return (struct pv_node *)this_cpu_ptr(&mcs_nodes[0]); } /* -- 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/