Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2276551rda; Tue, 24 Oct 2023 19:31:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFMam2Z4r8HL8gw+Sw3W1jPxMU4la95HA195ri6Rygm69ZY9eaPLarNhvTUZoxEbuIxz6y X-Received: by 2002:a05:620a:9cd:b0:778:9210:ceb3 with SMTP id y13-20020a05620a09cd00b007789210ceb3mr13337967qky.46.1698201083851; Tue, 24 Oct 2023 19:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698201083; cv=none; d=google.com; s=arc-20160816; b=jtsfX0erU3XY296EWzdkUwXplspNcMDr4rFprComOtkaqAiJEfnVkxRGne5RaWM+af Mq2JXH0niYMAIM/rKDFFShkHkhtd1rVh2q5xS+M8ui6UmrHRwdemzfxdPSBG963oRrEt kQ5LKfGpNePyK9RtSSFIwM7MwF0W53YAxZNWX3lyFmfbavJHeOBXSX6wm4l8sntdnTau snhWOvoeUmx163EoaE9GDLR7C8G7UkLzgYbiwE4KmSvK+ED1ea0ZoDJgFwn5XJ49OjDD bEJfX9K99S80sz5LYxqJsP1oV2Kf7jZzklQMwD9WwW4PnRq+sy3WJWDrz/uNLGFuiZ9U YpNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=UBs7BhHj7osv0k6psRfJTocN6ObSQb2o0iZG5n+6D9E=; fh=1kynK6jvsaUHw6sJju1TYyIrzYeIdgZm0CbUvvMi3Zk=; b=xYz81TObbDc66tQwMaapFWuRTezXq3GL76wsuuk1eTpjiqUxXu74ndMEembhfXNyts EiGwhp1BdzSsor9RHlEfCV+M+MSSZoZgL+INnHJY6NmsFSQS7L5kg7cqNOHKazm9DE+z i4hhISjSscNirLKtWecLhnWkXv7VHh7ldmF630KngkKSJVkl58iX2lPOCf24jtPMKk20 H/aP2SOXjeGpeos2XMK8TA32Iqzs3B8rc6rx5HpaUBbhuzfxaFC9R+lOlojbiKVpaBYz 3Vfn1YTRFVVeTZmazdjFkBL4Xp4JGBiioxN1j3+MhfT7KHBJdDNaz347ClSh/Id/eMi7 LeYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="CPfyJ9S/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f132-20020a25518a000000b00d9a42c75a5bsi8885042ybb.157.2023.10.24.19.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 19:31:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="CPfyJ9S/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D43F2807C746; Tue, 24 Oct 2023 19:30:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbjJYCaB (ORCPT + 99 others); Tue, 24 Oct 2023 22:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjJYCaA (ORCPT ); Tue, 24 Oct 2023 22:30:00 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DB169C; Tue, 24 Oct 2023 19:29:58 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5b8f68ba4e5so789760a12.1; Tue, 24 Oct 2023 19:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698200998; x=1698805798; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UBs7BhHj7osv0k6psRfJTocN6ObSQb2o0iZG5n+6D9E=; b=CPfyJ9S/JKi9ygb+bH1zPZa4AqNQ+W8Aqs6GqccQvsjIZ4rO1peFaOGFlXwGA3fS7l 1EHQOFdZo5Gfv36SHVCf4aczT/qRqfWtcl5Yid8hB2f327rU2/p3SQXYju8XpVICTiGb KbFoHSQAcsgYPGzleAFhBSifGrLrTmZOeHPiYff+7Whq60FryI++qnUR1pWpqe2dNEVf XPXcR29K+il6KqrPMUyEuAyqrqsF5OGsiJFHE/J3X6eI0ND/+DDYwbbVFwwzraIgVxNS HQifI4FyxyQjsymyM2pp17oqpfLlNg0muBiEKTPBTAYBhr8zPrWyvaXBf6BayjXfjvOo SBiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698200998; x=1698805798; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UBs7BhHj7osv0k6psRfJTocN6ObSQb2o0iZG5n+6D9E=; b=Kq5FPnzy3TAi+FC6jiDnyKZVqXGy3xto5Sp0ruMkZewQJ6O1nC72RmaWayOsTqmAo9 e7TEet08KbpSJ44x4wmIJCbyJoRbAKi+5ogjxerk1eujk3S5QaLFT/SlAV3qlnOidKS3 7XjK+u+ua6930Ai/b3GRU40I2QyztmCjxfNMcJi5pKW1FWQ7AC7CwWIxd5GXWAza9OwE YCeLdYpelCX0hmEBqI4V4IdHqnOJZrsdNzUycAwI3umw+gXbcGRcjYg1h7MOrOlQwX6F xe7M+NGazEobkerRwKmxgC3yjfAR3moqwfw8EK81o++xkE3c/DBm904C+Au518cWWeaC UtXw== X-Gm-Message-State: AOJu0YzZQ2g5UphUBoSYT6RaZpef5jttsPOZNRjOWwVqyb1xdyC6FXHk 3ApS9ez2zjOV61URmHEjK0H8ymS8VLz0ub3xrbM= X-Received: by 2002:a17:90b:3949:b0:27c:ef18:d270 with SMTP id oe9-20020a17090b394900b0027cef18d270mr10698424pjb.20.1698200997712; Tue, 24 Oct 2023 19:29:57 -0700 (PDT) MIME-Version: 1.0 References: <20231024214625.6483-1-frederic@kernel.org> <20231024214625.6483-2-frederic@kernel.org> In-Reply-To: <20231024214625.6483-2-frederic@kernel.org> From: Z qiang Date: Wed, 25 Oct 2023 10:29:46 +0800 Message-ID: Subject: Re: [PATCH 1/4] rcu: Introduce rcu_cpu_online() To: Frederic Weisbecker 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 19:30:09 -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); > > Should 'struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu)' be used ? Thanks Zqiang > > + > + return rcu_rdp_cpu_online(rdp); > +} > + > #if defined(CONFIG_PROVE_RCU) && defined(CONFIG_HOTPLUG_CPU) > > /* > -- > 2.41.0 >