Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2167890rda; Tue, 24 Oct 2023 14:46:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGok6AU5Vp8lEqb1SOGSAAaLqG/2DNgH8QAwDyau2f+v0/uc9XTPD3e0/fM+PGUQDqyZDwj X-Received: by 2002:a17:902:f550:b0:1ca:7dcf:a74 with SMTP id h16-20020a170902f55000b001ca7dcf0a74mr11810407plf.22.1698184010471; Tue, 24 Oct 2023 14:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698184010; cv=none; d=google.com; s=arc-20160816; b=w0QdYEVFrsTx5F1w2rIQSajzu9o6ya2qFTSIc5wZ9qCZC5oM+xOecVl3O1GfWW3ITN binY5d9ouud9pU82BEEN24/YWEtGMgT35GGa7+hNdLGnXEmJ7cvzuJhcipkejaoMBeub TyB7zHBugqmV/xgP6E/tau7DoTd0lCDTNiIcn5agDsrBPuBkcVAf+JQelCiddw3shffH 2CI+IiwMj7oX43SGF/o1gE8PY0QS3kaOsvY1lS6BWIIYkx3xKQ0MFVdpe5RXE+UE7uOO IA709ctp43ATsdZmh7WDy9Uyg/vLMjVcfvrTqvJcCUh7Mw9HyUpmesS0BEx3il05Z1MS I8qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=43+qOvO1pSIEkar0nm9UeJWflzC/otSuyoj0sGvmF2U=; fh=vRLsh+mlJ/3erNsj9qJLuZWu4oX6irbICpSWFnY9W1o=; b=dvFmATwS51VnEh1uhsjB9prwx1iX/II1Q5pend6pewqhGgNb5Gt3m9mlc3X76mSu7i epKhD8FDOpkmHRwY7sd3Tgklqkf0UxD7ulbrLGUbxUlZWqCSZlMIifVWLYMNox5ZWE6t fkHP0QET5pFf/GvQEGAJT+oGDtJgXvtb8gKs6PlOZDiRL5Ugw2v/MpgrJAvqJBHtY05m jK/dibWKO0lixOBBUqF6zHlcREronM6RgTBcy89wJjaIY8hAp8nDWuy2EAfLaca+NTGI bPV68NndzC7wO0nnnobd72ZBWqRqbipHiWKroIW76YW+FNzmrRy3sXbHv2reaxNkbG0c DlKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qJwBiK2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u6-20020a17090341c600b001bbd639dff9si9120881ple.467.2023.10.24.14.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 14:46:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qJwBiK2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 6794380BD532; Tue, 24 Oct 2023 14:46:48 -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 S1344455AbjJXVql (ORCPT + 99 others); Tue, 24 Oct 2023 17:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344454AbjJXVqk (ORCPT ); Tue, 24 Oct 2023 17:46:40 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17440E8; Tue, 24 Oct 2023 14:46:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D70CC433CA; Tue, 24 Oct 2023 21:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698183997; bh=55r/JWo6Uc73yf5DqaZWWtL9jn0mpU9zwuvJddzRrBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJwBiK2zpYQrDryXd6sMwPwBHy1iWVHeuLLm1/SKdspkdlBLaYb177rzprEGFzQFC d/2ylslU8EmC2+4Sxk4BW38uhxydzZeW+CDALQ60QUQXXXMYjKOENLFfZDMsQ7glEN 8TPMKcAiWCjVXy86PTUMPR4BEzvx+20j7GxF0ihu6H1skiQnZQQdkTR+l8JG5Oe8yb qTLqfRwx7ExEu1za8vQIQvLUB4dJIgVHGysKG9CVdjrd+GFhiUBp0cCxXA3ht+hfqb Yy0yzvn+ueDYrOWnH1UYuicR+p70IkpRclVnhpdORftbhzg+rh52jd3Uz8zDi6+0G/ yVG9Kidh8eqhw== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Boqun Feng , Joel Fernandes , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , Neeraj Upadhyay , "Paul E . McKenney" , Steven Rostedt , Uladzislau Rezki , Zqiang , rcu , "Liam R . Howlett" , Peter Zijlstra Subject: [PATCH 1/4] rcu: Introduce rcu_cpu_online() Date: Tue, 24 Oct 2023 23:46:22 +0200 Message-ID: <20231024214625.6483-2-frederic@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231024214625.6483-1-frederic@kernel.org> References: <20231024214625.6483-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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]); Tue, 24 Oct 2023 14:46:48 -0700 (PDT) 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); + + return rcu_rdp_cpu_online(rdp); +} + #if defined(CONFIG_PROVE_RCU) && defined(CONFIG_HOTPLUG_CPU) /* -- 2.41.0