Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp87143pxu; Wed, 14 Oct 2020 21:13:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8cg5r7Xfbi07PwWK5OSPztsJ3lTE1XpvN9VDHneCkApIy+5dMxY9oU//ULb60YzWD17v6 X-Received: by 2002:a17:906:f205:: with SMTP id gt5mr2434685ejb.48.1602735214307; Wed, 14 Oct 2020 21:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602735214; cv=none; d=google.com; s=arc-20160816; b=RlySyuDA3BHOpc69j8JQI8FJiMmSbR3yRIhjTXHEUE1deUCJDPNzeK+/i83vBbA8AK RY/h32engDGLjBPgH6O4LOfJjiGbRL15dNeu6o2p0qEoDJkQZCxK/DrH3ZWhclPMZdRC +8b7fM04H6e+n6wOvFoadjHNOFKARwONWQOBHGr8ByYBO1LmFAijSTVF88iHdfizahpK pEhm+j9XLj/6jJJX3pRxHYHccs43yMVIZKnqVcUBR0MvzewSgpcvdac2s2xMg93lHB00 Pv+wYk0o4NakSo0uws/7x44NoH39sQAF2OLXBBBbsJamVxL4ULNrGYqGCzOpI8XvzVtH vWLA== 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=Wpi1ELZaaFaYJLsGXjb01Rpxc7NFR8QcNczNaEl+OBw=; b=ftHC5QZec7a2clN5k58p6xKFBJ0k4V9Te+mLfZeF+zYmzaDAKW/5XdUZx4Lyap0lz+ 2VBIXwsEkRjIacAlSff896LCr4xlxEHjPXJPPCDVevG+487AkbXs94NKM7rDzJX6F+Uf +dBnU7jToqvSC1x4mlDgspWCj3e48zMtISNZeAXuKW0j3E9uoEXD5qNj50DqZfAWjrSt zaBHpSwtCiHlnw9Xt0oVdx70pigSSp/SUxs6MZI5csEEeil/3h0syM/q52V+KBIoCm3H ofPmf/hRtTdo6K9g4pZa6bjd5vlKNjSCzh6UQ7Wbn244R6yY8mT701j/NPIccjzpmaBY usKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QCJSyr+n; 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 i27si1154804edb.55.2020.10.14.21.13.11; Wed, 14 Oct 2020 21:13:34 -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=casper.20170209 header.b=QCJSyr+n; 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 S1729129AbgJOCTj (ORCPT + 99 others); Wed, 14 Oct 2020 22:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728427AbgJOCTh (ORCPT ); Wed, 14 Oct 2020 22:19:37 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3346C05BD1F; Wed, 14 Oct 2020 15:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=Wpi1ELZaaFaYJLsGXjb01Rpxc7NFR8QcNczNaEl+OBw=; b=QCJSyr+nBW9tyGZHxgNMEfq6vK 9CDTb9Q60ev+vS1XEgNUMXIeqsFAqUz+/J81ylBL3v0dlFfQ77bikk0DMeiuBE3p+kmTkx3Je72Ph mWwM0Zr+3thQS63WIPiCwj8r1C6Zk+EhHgMhZvIohuzMB488dgKj7t58emUizRT8efX2x7CELFrPC pP6MKa13D2jEiTxHiIh67/ieFrJprLORwtcpUna2lLdMY1O4SBVFzBHiFq38bsaICfM7H8zSDd2wd pDgduvKgbco71epQW2teHyNF37eYEqnpJcFhfit+JKzvnNGdTKkXojmLyLNty3FaDkRK0HzPgEncP UxNnz1Uw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSpR5-0003mj-56; Wed, 14 Oct 2020 22:39:55 +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 3AAA2304B90; Thu, 15 Oct 2020 00:39:54 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2D0FD20325ECC; Thu, 15 Oct 2020 00:39:54 +0200 (CEST) Date: Thu, 15 Oct 2020 00:39:54 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: Boqun Feng , Qian Cai , Steven Rostedt , Ingo Molnar , x86 , linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Linux Next Mailing List , Stephen Rothwell Subject: Re: [tip: locking/core] lockdep: Fix lockdep recursion Message-ID: <20201014223954.GH2594@hirez.programming.kicks-ass.net> References: <20201012031110.GA39540@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> <20201012212812.GH3249@paulmck-ThinkPad-P72> <20201013103406.GY2628@hirez.programming.kicks-ass.net> <20201013104450.GQ2651@hirez.programming.kicks-ass.net> <20201013112544.GZ2628@hirez.programming.kicks-ass.net> <20201013162650.GN3249@paulmck-ThinkPad-P72> <20201013193025.GA2424@paulmck-ThinkPad-P72> <20201014183405.GA27666@paulmck-ThinkPad-P72> <20201014215319.GF2974@worktop.programming.kicks-ass.net> <20201014221152.GS3249@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201014221152.GS3249@paulmck-ThinkPad-P72> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 14, 2020 at 03:11:52PM -0700, Paul E. McKenney wrote: > On Wed, Oct 14, 2020 at 11:53:19PM +0200, Peter Zijlstra wrote: > > On Wed, Oct 14, 2020 at 11:34:05AM -0700, Paul E. McKenney wrote: > > > commit 7deaa04b02298001426730ed0e6214ac20d1a1c1 > > > Author: Paul E. McKenney > > > Date: Tue Oct 13 12:39:23 2020 -0700 > > > > > > rcu: Prevent lockdep-RCU splats on lock acquisition/release > > > > > > The rcu_cpu_starting() and rcu_report_dead() functions transition the > > > current CPU between online and offline state from an RCU perspective. > > > Unfortunately, this means that the rcu_cpu_starting() function's lock > > > acquisition and the rcu_report_dead() function's lock releases happen > > > while the CPU is offline from an RCU perspective, which can result in > > > lockdep-RCU splats about using RCU from an offline CPU. In reality, > > > aside from the splats, both transitions are safe because a new grace > > > period cannot start until these functions release their locks. > > > > But we call the trace_* crud before we acquire the lock. Are you sure > > that's a false-positive? > > You lost me on this one. > > I am assuming that you are talking about rcu_cpu_starting(), because > that is the one where RCU is not initially watching, that is, the > case where tracing before the lock acquisition would be a problem. > You cannot be talking about rcu_cpu_starting() itself, because it does > not do any tracing before acquiring the lock. But if you are talking > about the caller of rcu_cpu_starting(), then that caller should put the > rcu_cpu_starting() before the tracing. But that would be the other > patch earlier in this thread that was proposing moving the call to > rcu_cpu_starting() much earlier in CPU bringup. > > So what am I missing here? rcu_cpu_starting(); raw_spin_lock_irqsave(); local_irq_save(); preempt_disable(); spin_acquire() lock_acquire() trace_lock_acquire() <--- *whoopsie-doodle* /* uses RCU for tracing */ arch_spin_lock_flags() <--- the actual spinlock