Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4692321pxu; Tue, 13 Oct 2020 05:05:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7xGvj1AjHPHxF014VwQBVtXCEw2ckj6m8yZDt/Zyr/mSxkr26d0L/3uDVH9dqIzdu6fP7 X-Received: by 2002:a5d:6591:: with SMTP id q17mr35067409wru.173.1602590723583; Tue, 13 Oct 2020 05:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602590723; cv=none; d=google.com; s=arc-20160816; b=ZByhwXuFYUoTs/Zfjj9Nx5UelH+sZbQ7Z2Ol9Q07DaAs6zFLqPltoegK/y8Mn8LBVj RkalishpFqtPufCgMaalEpHuwZq1ZxKe8b11MwHjA4gzH6XX1qLL2QarJM5reyABcV1z eaLX+VzwoyLZdquK6MB5k+Oh9lJv233jm7QRkVWBoJyBPpBm1zJBAaTWzZqYHvgDAJkS LKgF0pMqlMO0TF5yPuoDfzufZ4u7aQJc2PTCNk6hBshpUzZStMs26mk7sUm1HFnsXvav 8wS1+1NRpH45tds861w3LK4ZSBSW2aTtIQSgzro/pO9hZJBsDWrm0dSWQGC7l7tBBrSl qBow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MZPyYVXUEYs3YSGCvJdse61SjO5uVTagum+obbVonkY=; b=sKSPfGizKv16hzmEedV01vewq0glZsY8Nb3B8Yqu2GPLEVS+/QNbGOk3B7Om6mfwMv KHiduNpUFknCROuJlwaGpnX5wTPKh3UnGKcFcHfADU/Gkl8m53JcnBVYCqrgFSMANCos 6cKTgkQeTxJWKq8vOBUaJbNTAlOcN3Fw1jMm34InevSK6nfhYD2ZB51CYJdC0/cSiix6 3+6lwPbfzBaWvbznGP6rIx5cNGRK0ZUfyVeN3xN5eZGwhsFU5Ac27xtnZtI8k/qrCn0c tHkuoBNa3cUfjJowdVfrX/zrXVDhV84tP0TJ/CCrcSg+TW70PX0LwfgGOHAP8Dljhbmk /aTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=hKIIxEAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz13si14827227ejb.120.2020.10.13.05.05.01; Tue, 13 Oct 2020 05:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=hKIIxEAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731284AbgJMK1j (ORCPT + 99 others); Tue, 13 Oct 2020 06:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731170AbgJMK1i (ORCPT ); Tue, 13 Oct 2020 06:27:38 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796E0C0613D0; Tue, 13 Oct 2020 03:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MZPyYVXUEYs3YSGCvJdse61SjO5uVTagum+obbVonkY=; b=hKIIxEAKckNUJZf25tZk7grtjR 061k1jMcJJdzSgHhPHoqHq7KxpOpAJ9WnAcphAtE6MAk0mcHVSRmU2WfRkE2HA7DtsGZat680EGsf 7lPabYy0sddJ+rB6EilT7IUDaZpJZYk/ByXs17UgGhNKtxJkNSCAfgaMB1nu/NKpe0HeAmvJ2USt/ gK8jkmD4gJKJ3S7IajAK9RkoiWC9Ji2LQFdFqjBVUvcfZxrzBf/DAysDlzfic/nC+RihtR4u8VLCj uyTaLNxG0I9FL9VRKnGn79bbbwdjNSx14rN7pZjXuzafRXkhiIss1aqG6IikjM6StVuozZOpvV9lb xXCq/V5g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSHWb-0002bp-TD; Tue, 13 Oct 2020 10:27:22 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F323B304B90; Tue, 13 Oct 2020 12:27:15 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 867742041906B; Tue, 13 Oct 2020 12:27:15 +0200 (CEST) Date: Tue, 13 Oct 2020 12:27:15 +0200 From: Peter Zijlstra To: Boqun Feng Cc: Qian Cai , Steven Rostedt , Ingo Molnar , x86 , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Linux Next Mailing List , Stephen Rothwell , "Paul E. McKenney" Subject: Re: [tip: locking/core] lockdep: Fix lockdep recursion Message-ID: <20201013102715.GX2628@hirez.programming.kicks-ass.net> References: <160223032121.7002.1269740091547117869.tip-bot2@tip-bot2> <20201012031110.GA39540@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201012031110.GA39540@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2020 at 11:11:10AM +0800, Boqun Feng wrote: > I think this happened because in this commit debug_lockdep_rcu_enabled() > didn't adopt to the change that made lockdep_recursion a percpu > variable? > > Qian, mind to try the following? > > Although, arguably the problem still exists, i.e. we still have an RCU > read-side critical section inside lock_acquire(), which may be called on There is actual RCU usage from the trace_lock_acquire(). > a yet-to-online CPU, which RCU doesn't watch. I think this used to be OK > because we don't "free" anything from lockdep, IOW, there is no > synchronize_rcu() or call_rcu() that _needs_ to wait for the RCU > read-side critical sections inside lockdep. But now we lock class > recycling, so it might be a problem. > > That said, currently validate_chain() and lock class recycling are > mutually excluded via graph_lock, so we are safe for this one ;-) We should have a comment on that somewhere, could you write one? > ----------->8 > diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c > index 39334d2d2b37..35d9bab65b75 100644 > --- a/kernel/rcu/update.c > +++ b/kernel/rcu/update.c > @@ -275,8 +275,8 @@ EXPORT_SYMBOL_GPL(rcu_callback_map); > > noinstr int notrace debug_lockdep_rcu_enabled(void) > { > - return rcu_scheduler_active != RCU_SCHEDULER_INACTIVE && debug_locks && > - current->lockdep_recursion == 0; > + return rcu_scheduler_active != RCU_SCHEDULER_INACTIVE && > + __lockdep_enabled; > } > EXPORT_SYMBOL_GPL(debug_lockdep_rcu_enabled); Urgh, I didn't expect (and forgot to grep) lockdep_recursion users outside of lockdep itself :/ It looks like this is indeed the only one.