From patchwork Fri Sep 8 20:36:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Weisbecker X-Patchwork-Id: 13377811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38263EEB56F for ; Fri, 8 Sep 2023 20:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242606AbjIHUhA (ORCPT ); Fri, 8 Sep 2023 16:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236159AbjIHUhA (ORCPT ); Fri, 8 Sep 2023 16:37:00 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B71E65; Fri, 8 Sep 2023 13:36:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF15FC433CC; Fri, 8 Sep 2023 20:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694205397; bh=Myb0x4KbAYJfwZIc0cipS2HFSdskG2s5T9FsIJvmid8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0sLQb1ovYq4ry65mQo6nbCRm0BjIK14Q2Y2YTtP6N/G9GgJYl8Prsmdnw+BDxezF Suqz6NvTkljdrVQtGPL8+4AfFKJXj8JkWH2EKQSP3VrWg8X/MEx/RF/Kr8qn3IHOph xktc8JtPLSuSDv9HSn3VpgfpKVkyekrfBMUlFL8eCi2MXlBXisR3d7r2jwOUdolRd+ e6irVd/fD8CK/MYu3uyV7sX9ofnl6AWI0WpzEI1ydA3ScvxKGBA7LAvzy2osae359i G8YDLc+OkrB8xt9vsPXMtjdTWF/vTZNg7kIBPM4xwn5k9frlEm5V80/6/0k4bThKf6 6nzjFgjkIwhVw== From: Frederic Weisbecker To: "Paul E . McKenney" Cc: LKML , Frederic Weisbecker , rcu , Uladzislau Rezki , Neeraj Upadhyay , Boqun Feng , Joel Fernandes Subject: [PATCH 10/10] rcu: Comment why callbacks migration can't wait for CPUHP_RCUTREE_PREP Date: Fri, 8 Sep 2023 22:36:03 +0200 Message-ID: <20230908203603.5865-11-frederic@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230908203603.5865-1-frederic@kernel.org> References: <20230908203603.5865-1-frederic@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org The callbacks migration is performed through an explicit call from the hotplug control CPU right after the death of the target CPU and before proceeding with the CPUHP_ teardown functions. This is unusual but necessary and yet uncommented. Summarize the reason as explained in the changelog of: a58163d8ca2c (rcu: Migrate callbacks earlier in the CPU-offline timeline) Signed-off-by: Frederic Weisbecker Reviewed-by: Paul E. McKenney --- kernel/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index a41a6fff3c91..b135bb481be1 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1352,7 +1352,14 @@ static int takedown_cpu(unsigned int cpu) cpuhp_bp_sync_dead(cpu); tick_cleanup_dead_cpu(cpu); + + /* + * Callbacks must be re-integrated right away to the RCU state machine. + * Otherwise an RCU callback could block a further teardown function + * waiting for its completion. + */ rcutree_migrate_callbacks(cpu); + return 0; }