Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1425527rdb; Mon, 2 Oct 2023 09:07:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxy0Ez62k7JUXJNzDpQXxbXQXgrt54p/YsOmQRQE+tthWgd2ygXNnFAfizwyCAosHTOG/t X-Received: by 2002:a05:6830:2006:b0:6bc:f6d0:87d4 with SMTP id e6-20020a056830200600b006bcf6d087d4mr11487144otp.29.1696262854947; Mon, 02 Oct 2023 09:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696262854; cv=none; d=google.com; s=arc-20160816; b=QvVfCq/p3fr73fE6EbRR4e/5K1aKmBkQj9fO9PVYe4vqqsoFvJEyLdXS/8mtHbj9ur nf3xwfOeyKmCZ741HNn7Lw4xbH9gs4HOpbOhmJu8Da2wyW7521tD/4kCPTyVB2ouEU81 I628tR/iZZd7I+10TlUNGQ3W6mV9fX4i77pn0eU9Q/B7Tz3afyylinIK6j1bZfIcz1kN UYhD6TEpEpS+eR65rpH5SHSjSRJpuNUzOFjl1rFfPfsGDRkunHMcjSbqADNnu+i3ozNc bYmic2r35VYlif6ZzsDyQ5t0E3ua7L7u5ZJLlK2IjBrhs45l07QjmSEZ3b7J+cEJofbf oniw== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=yk7bDwalcTquhRYYfrMudr5N/O7hXHGzGAxg0UQD0xQ=; fh=vvIxxotwr/5I3LAaua/faPKkOqW5Gug4vtwueRdQQCg=; b=rdWak5DYs3GuJDmuHAaqLw8jtj7L+6RVJLUnOHPp+9GvwEFZ4tzAh8zBZgPyPHtMCy V0MX2lE9ORi07+RVZXUjs+C8GxfpnmUVpy7JiGFP7Kw4y4YStK1jIGJ4LZkJmiprM8+u iw+eeEqun++91ZhM48v53RFoq9BNjZvTc372FEeETQsJfPOvu6d13VzlwQrx4NZ816J4 kQb+7cKjzJBMt4yg8HMwlf/ucd/eMT2ozH/erjTqGhxW+mZRHVnL9NC6QQliUeNDxX8e KTigzx/h8FKB8sEfNKQ3FYc1qyJ9Zk2q4V0GWOTQ0dP44Q6XrKesEIfKdLXZKTK1MgPN imow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bs7VDzIx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e21-20020a637455000000b00563f72935e3si15639734pgn.608.2023.10.02.09.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 09:07:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bs7VDzIx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D6B80809565B; Mon, 2 Oct 2023 08:42:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238174AbjJBPlk (ORCPT + 99 others); Mon, 2 Oct 2023 11:41:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238170AbjJBPli (ORCPT ); Mon, 2 Oct 2023 11:41:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7B93B8; Mon, 2 Oct 2023 08:41:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 521EAC433C8; Mon, 2 Oct 2023 15:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696261295; bh=OIxjPCr9wkZbCOoxXWBU/u5qVifWIFEkIOgrP/+zrzg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=bs7VDzIxp3PxLyxrVFfEnB2W6cL3823xMsPOR9+MVtzOSpvvQmKWsz32La4mqW3Ip FSXsrDi6V8bNib4o/jQ1sxuht04cRXiRD+sxRpStg08EIz8RzQ2/dVmKqQ5TFyh/Mf s+hPEn8B6fX+63vfYq4hw22sb1Z5x8RY00DpaKtD6MXAGNe9TX99t9xPoSwwq8j7lN VG0DKF28gE2HUG4uR/jUBjf1IsyQ86R0Yz/ltfJw1JPrsqi7Ouh1ReJtgzuvRG5N3/ vO/bpeJfN3Ve6OluWOHBUmRFiceaTkHbC5kSzKrNgSv6Y0XXanzVET85Qja4EtA/8f qx4X8EB8XJZcA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C70CFCE0CCF; Mon, 2 Oct 2023 08:41:34 -0700 (PDT) Date: Mon, 2 Oct 2023 08:41:34 -0700 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: LKML , rcu , Uladzislau Rezki , Neeraj Upadhyay , Boqun Feng , Joel Fernandes Subject: Re: [PATCH 05/10] rcu: Assume IRQS disabled from rcu_report_dead() Message-ID: Reply-To: paulmck@kernel.org References: <20230908203603.5865-1-frederic@kernel.org> <20230908203603.5865-6-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230908203603.5865-6-frederic@kernel.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:42:07 -0700 (PDT) On Fri, Sep 08, 2023 at 10:35:58PM +0200, Frederic Weisbecker wrote: > rcu_report_dead() is the last RCU word from the CPU down through the > hotplug path. It is called in the idle loop right before the CPU shuts > down for good. Because it removes the CPU from the grace period state > machine and reports an ultimate quiescent state if necessary, no further > use of RCU is allowed. Therefore it is expected that IRQs are disabled > upon calling this function and are not to be re-enabled again until the > CPU shuts down. > > Remove the IRQs disablement from that function and verify instead that > it is actually called with IRQs disabled as it is expected at that > special point in the idle path. > > Reviewed-by: Joel Fernandes (Google) > Signed-off-by: Frederic Weisbecker Reviewed-by: Paul E. McKenney > --- > kernel/rcu/tree.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index a83ecab77917..8b5ebef32e17 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -4553,11 +4553,16 @@ void rcu_cpu_starting(unsigned int cpu) > */ > void rcu_report_dead(unsigned int cpu) > { > - unsigned long flags, seq_flags; > + unsigned long flags; > unsigned long mask; > struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu); > struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */ > > + /* > + * IRQS must be disabled from now on and until the CPU dies, or an interrupt > + * may introduce a new READ-side while it is actually off the QS masks. > + */ > + lockdep_assert_irqs_disabled(); > // Do any dangling deferred wakeups. > do_nocb_deferred_wakeup(rdp); > > @@ -4565,7 +4570,6 @@ void rcu_report_dead(unsigned int cpu) > > /* Remove outgoing CPU from mask in the leaf rcu_node structure. */ > mask = rdp->grpmask; > - local_irq_save(seq_flags); > arch_spin_lock(&rcu_state.ofl_lock); > raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */ > rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq); > @@ -4579,8 +4583,6 @@ void rcu_report_dead(unsigned int cpu) > WRITE_ONCE(rnp->qsmaskinitnext, rnp->qsmaskinitnext & ~mask); > raw_spin_unlock_irqrestore_rcu_node(rnp, flags); > arch_spin_unlock(&rcu_state.ofl_lock); > - local_irq_restore(seq_flags); > - > rdp->cpu_started = false; > } > > -- > 2.41.0 >