Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2460678rda; Wed, 25 Oct 2023 03:32:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBhhF1IEz0ZcF9EFeZHxkHbdBwseYc9tgRrreMjwhm1hVF6jkM47eMJEm62jdVAuVNd+x9 X-Received: by 2002:a25:d38d:0:b0:d9c:2a9c:3f4f with SMTP id e135-20020a25d38d000000b00d9c2a9c3f4fmr15396965ybf.62.1698229943502; Wed, 25 Oct 2023 03:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698229943; cv=none; d=google.com; s=arc-20160816; b=KNISVrcvMhsoMCiGp55WjflymT3a6n6DMmIB0FlyxTRJmtheacAUpYU6rg2DJDtqB2 y0INQixHNBfGjoePzNCinI8JUCyW+0QwVMl6WuusLcMLUGUaLnyJ2Q3XhJzw9nVDkfCv SwhL2u1vorB9k5uyi0SjRlDiepyz0pmx//yC9MjsWAxDPx7gtAStSZ+vzphMgmJNM4PU zAeTPYmrySGxlYiucB/C64OYJo1kBh/HYoW2TPkEn7R43AEuDfxqDXS+VbtFvhTiZhq5 hiCy2Dr0nfVQTOn0cniiX34DLBx4exNPGoySKOBxCmo8wh4s514vP66RVGGoBjrg0mUJ n84w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ds78Zlvlt7CThKgH1+zjmrqHe49u9zZQ90ZIbGmonsI=; fh=Aw1/EQpRga3lMTUSRe6JikFzVmaQ8UVPQKbA1A4xhqc=; b=ZIJZiASXw/86UQ7pReCtH4FKkkHPkGvQiMGUQNYUoIPUe6yTnj9hejDBdlkoBnba2q VJtGWzC0cIHxVy65Al0nkYiDeDaIbk23DpMshpTrsO1iM1RcIg+oWsakt5LzmO8U1YQb upzuKRP4sxtvH2qFqZcEzeQTzrgh2TaW5tEgZEXMyaxkae4N1lF4Z1uiXL8vQAlSnKyN F87BGVfF/5JaY7QFXxclrFNq7jvrhw9gVIrrvW1jI24w2ZawlWlOfD/kersYUt6K+GeS SRbLxgp6HAg4W6pb70nEkcvrSOvDZaMhCQzIjB8HMq9w8/LLiUBDd4mXIRgqja96YJNP hIaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jeDt6GO+; 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 g186-20020a2520c3000000b00da05890df44si2209012ybg.324.2023.10.25.03.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:32:23 -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=jeDt6GO+; 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 B74C9802B3C0; Wed, 25 Oct 2023 03:32:20 -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 S234404AbjJYKcM (ORCPT + 99 others); Wed, 25 Oct 2023 06:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbjJYKcL (ORCPT ); Wed, 25 Oct 2023 06:32:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F88CB0; Wed, 25 Oct 2023 03:32:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0125C433C7; Wed, 25 Oct 2023 10:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698229929; bh=qnhvyqAbScSS7DqI8YnTAhrhFJz18xmcGfOkvSOx8uI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jeDt6GO+aB5o6rgyqhj8iGGgm6X0jZ0PWiY4RQQs80zxh434h52VIl0NHFPwMKgqP 1Ki+/SLLEMdR6iK/GA7vyg0ETid+qkr4WBp8npcjZSf8PkF6Sblsi8iqieLk6uqx41 6TxIzHFK2q1OyO5ta8usXHN+atCc83yzbr2RanJIRilrvEcg3zD8ZIIDXavj1nM54d JrBtloWJt5EZx7iPqJW8eArnbvTGZJ6obUTFgYFxixdkGQoC29lvsv5uqaFk5jkSNT gq614zH2sZsHHLoiv3YBNDweET5lmwoIlR7a7w3Lgrz+si6qyrKFsLgzqzfF9vvZZ5 7IRkJ7o8VrR0g== Date: Wed, 25 Oct 2023 12:32:05 +0200 From: Frederic Weisbecker To: Z qiang Cc: LKML , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , "Paul E . McKenney" , Steven Rostedt , Uladzislau Rezki , rcu , "Liam R . Howlett" , Peter Zijlstra Subject: Re: [PATCH 1/4] rcu: Introduce rcu_cpu_online() Message-ID: References: <20231024214625.6483-1-frederic@kernel.org> <20231024214625.6483-2-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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]); Wed, 25 Oct 2023 03:32:20 -0700 (PDT) Le Wed, Oct 25, 2023 at 10:29:46AM +0800, Z qiang a ?crit : > > > > Export the RCU point of view as to when a CPU is considered offline > > (ie: when does RCU consider that a CPU is sufficiently down in the > > hotplug process to not feature any possible read side). > > > > This will be used by RCU-tasks whose vision of an offline CPU should > > reasonably match the one of RCU core. > > > > Fixes: cff9b2332ab7 ("kernel/sched: Modify initial boot task idle setup") > > Signed-off-by: Frederic Weisbecker > > --- > > kernel/rcu/rcu.h | 2 ++ > > kernel/rcu/tree.c | 7 +++++++ > > 2 files changed, 9 insertions(+) > > > > diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h > > index 0d866eaa4cc8..b531c33e9545 100644 > > --- a/kernel/rcu/rcu.h > > +++ b/kernel/rcu/rcu.h > > @@ -500,6 +500,7 @@ static inline void rcu_expedite_gp(void) { } > > static inline void rcu_unexpedite_gp(void) { } > > static inline void rcu_async_hurry(void) { } > > static inline void rcu_async_relax(void) { } > > +static inline bool rcu_cpu_online(int cpu) { return true; } > > #else /* #ifdef CONFIG_TINY_RCU */ > > bool rcu_gp_is_normal(void); /* Internal RCU use. */ > > bool rcu_gp_is_expedited(void); /* Internal RCU use. */ > > @@ -509,6 +510,7 @@ void rcu_unexpedite_gp(void); > > void rcu_async_hurry(void); > > void rcu_async_relax(void); > > void rcupdate_announce_bootup_oddness(void); > > +bool rcu_cpu_online(int cpu); > > #ifdef CONFIG_TASKS_RCU_GENERIC > > void show_rcu_tasks_gp_kthreads(void); > > #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */ > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > index 700524726079..fd21c1506092 100644 > > --- a/kernel/rcu/tree.c > > +++ b/kernel/rcu/tree.c > > @@ -4202,6 +4202,13 @@ static bool rcu_rdp_cpu_online(struct rcu_data *rdp) > > return !!(rdp->grpmask & rcu_rnp_online_cpus(rdp->mynode)); > > } > > > > +bool rcu_cpu_online(int cpu) > > +{ > > + struct rcu_data *rdp = this_cpu_ptr(&rcu_data); > > > > > > Should 'struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu)' be used ? Oh! Good catch! > > Thanks > Zqiang > > > > > > + > > + return rcu_rdp_cpu_online(rdp); > > +} > > + > > #if defined(CONFIG_PROVE_RCU) && defined(CONFIG_HOTPLUG_CPU) > > > > /* > > -- > > 2.41.0 > >