From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755694Ab1G0WDY (ORCPT ); Wed, 27 Jul 2011 18:03:24 -0400 Received: from mga01.intel.com ([192.55.52.88]:12903 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755555Ab1G0Vsl (ORCPT ); Wed, 27 Jul 2011 17:48:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,279,1309762800"; d="scan'208";a="35258233" From: Andi Kleen References: <20110727247.325703029@firstfloor.org> In-Reply-To: <20110727247.325703029@firstfloor.org> To: a.p.zijlstra@chello.nl, torvalds@linux-foundation.org, ak@linux.intel.com, mingo@elte.hu, gregkh@suse.de, linux-kernel@vger.kernel.org, stable@kernel.org, tim.bird@am.sony.com Subject: [PATCH] [42/99] lockdep: Fix lock_is_held() on recursion Message-Id: <20110727214841.156E72403FF@tassilo.jf.intel.com> Date: Wed, 27 Jul 2011 14:48:41 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2.6.35-longterm review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra commit f2513cde93f0957d5dc6c09bc24b0cccd27d8e1d upstream. The main lock_is_held() user is lockdep_assert_held(), avoid false assertions in lockdep_off() sections by unconditionally reporting the lock is taken. [ the reason this is important is a lockdep_assert_held() in ttwu() which triggers a warning under lockdep_off() as in printk() which can trigger another wakeup and lock up due to spinlock recursion, as reported and heroically debugged by Arne Jansen ] Reported-and-tested-by: Arne Jansen Signed-off-by: Peter Zijlstra Cc: Linus Torvalds Signed-off-by: Andi Kleen Link: http://lkml.kernel.org/r/1307398759.2497.966.camel@laptop Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- kernel/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6.35.y/kernel/lockdep.c =================================================================== --- linux-2.6.35.y.orig/kernel/lockdep.c +++ linux-2.6.35.y/kernel/lockdep.c @@ -3250,7 +3250,7 @@ int lock_is_held(struct lockdep_map *loc int ret = 0; if (unlikely(current->lockdep_recursion)) - return ret; + return 1; /* avoid false negative lockdep_assert_held() */ raw_local_irq_save(flags); check_flags(flags);