Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1009841rbb; Sun, 25 Feb 2024 15:06:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVWfEgygEZ0xFTI7J8LrWvpIQFWqPK4KlPYiV3mXjWw6fqx3yap9bds2XTicTtJSC+l/8IE+xLBzGiOZlsB0CXYshHPIotJHwJAofOPBQ== X-Google-Smtp-Source: AGHT+IG5m7sk8KRcI4lZ6dEyzCCYCNzHu1JFJZaAOkhApnbwqLO5zj3xsRtnnJbXgdpcDsC3s6aw X-Received: by 2002:aa7:d290:0:b0:565:9dbe:768a with SMTP id w16-20020aa7d290000000b005659dbe768amr2937131edq.25.1708902396277; Sun, 25 Feb 2024 15:06:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708902396; cv=pass; d=google.com; s=arc-20160816; b=z/3rzDy7DGWUvhnvb1bAccSTrIiKBQA6PGaY/p6gx/JeCeP3d/OUiAJtvJdDDkR7NW nv9vADeUjWLdlrccGRC015kZ7GDUSQAQNICcn6l+Jv8Rs+ENrxRC4+ietk1bGB/rxm+P mFR9hYs3RIIbZLOFUGkxbYbnc+WJEZmqC1XhkQhnfrjs0Z6azwOzxz6Mkh3HNzuQWNKl QsrM08nzYg4/Pw4kyhf4Q2Ja4E2wEFUsgXfY8PF09PL2hbTzm1eGGXnYutKtTMabF1ck 8QwswODMAFO+Fw3wjJL9ERuplDFpZF8+wMNkhIrC6w9ZBfugpxt2yi/mY0jARoQXGKy3 yfBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GPfbRWLuTmFZ67iA/iDHMD64V4SaiQWw1cwLFRmCh+k=; fh=9AYDxpIF3ws21qQDvjghHSFUuXpDdpq2Zh/SbnasVRo=; b=n2pfxPQewSFWfYp/3pxL6/Wx7RQ/v9UAQ1ukT39qR0BGJgzyH9NfViRqDCaCp0pshj 9xQ7SrtFAz3xpcGKYYemDif7vwubQMkaYBgbsInIUcZkZFMqIIIOL+yc8sktxJRoV1Tf tNHlXFo8RanuWDUMcHOyuxGOLP2zIloOEEQ3KQN5yFoXyaKhFQzSE4tFKpbicGocDQF/ 6GQArCQLaNK+67o9PZxrJp+t9JkhtYBR9jiQ404o3W3SX0hXjg1vlto4qi+20qIGJzhK clOKPQWh6nRUYENwo+zB48Hz0J9RdkmuAl1mOPK6d7J6Mbx6G6XqsAlMQ7PJZ5M3MCCA EmSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e7oYwvG4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y10-20020a056402440a00b00565a7b11d51si1465954eda.505.2024.02.25.15.06.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 15:06:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e7oYwvG4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D93EA1F23244 for ; Sun, 25 Feb 2024 22:57:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9C672C6A8; Sun, 25 Feb 2024 22:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e7oYwvG4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5B672576B for ; Sun, 25 Feb 2024 22:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708901734; cv=none; b=Iet1CLtRTQEGgtBXcbpUaVEsyXfBh79xDQoBluFqHdHh9HzmGA+gJ+4+TCYP+xvYpYbyH5Oax1u2+3h7oPnhF9PXw5/kFQ0UO85dHyb3e/DLzQGoknBp0YqORngSsB9m0y+YDxQyt03XIhg9AEqlF8iEHdKBbQli+gf2rmuJT+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708901734; c=relaxed/simple; bh=a2TLuKZ1NcjYXwjYQRiKiZcFGSpIbLE6pKtHI2QYajQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sZicznxWB6rmEWq29uTFg8zs2RHH7I+aLC4zL78Cd5Aadf6Qs74shE68K84WZQxziKA42MDLexGEDk3DREDJZj+j7d55YynKvRDkyIB17bRd8E6mgD6qDxzhKABEyCIeTtVAAMFbnF9QV3P2Brfy1YCMMqE9T54UBWSz9ZPPOq0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e7oYwvG4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5F1DC43330; Sun, 25 Feb 2024 22:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708901733; bh=a2TLuKZ1NcjYXwjYQRiKiZcFGSpIbLE6pKtHI2QYajQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e7oYwvG4n1Y7nG60vnmZjcVkm5N0H1Z4Xn/LhEoBOrMY7z4uX9D9hOMYtj6hC2Bjo 7Ftd8HoYbh8PsFjzgUweXRX/AkY4PENBhAzsxOK5aIOPIqbCBScse3s2aDIE6xD9Mq oUYEgUFr/Tal9YFs1UjrC2mqn5nEJMJFAMVKNFi20Hq5oZVcvJEx4RsdTv+D1ZvnAy lEX7mTUIYOGepiZrqrWGe1jsljnXvlle5FVGyacpkbtLsM4Eio9/N/UvzXiNCiZbNE itZdcMLiGD9k2WKnfDOCasexBUJ2CP4yYhZAR1m1OrRGDB4mN5nIIdFlUR9cPg0JcB jCI+dyxCZeTnw== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , Anna-Maria Behnsen , Peng Liu , Joel Fernandes Subject: [PATCH 09/16] tick: Move broadcast cancellation up to CPUHP_AP_TICK_DYING Date: Sun, 25 Feb 2024 23:55:01 +0100 Message-ID: <20240225225508.11587-10-frederic@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240225225508.11587-1-frederic@kernel.org> References: <20240225225508.11587-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The broadcast shutdown code is executed through a random explicit call within stop machine from the outgoing CPU. However the tick broadcast is a midware between the tick callback and the clocksource, therefore it makes more sense to shut it down after the tick callback and before the clocksource drivers. Move it instead to the common tick shutdown CPU hotplug state where related operations can be ordered from highest to lowest level. Reviewed-by: Thomas Gleixner Signed-off-by: Frederic Weisbecker --- include/linux/tick.h | 6 ------ kernel/cpu.c | 2 -- kernel/time/tick-common.c | 3 +++ kernel/time/tick-internal.h | 2 ++ 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index afff4c207bd8..c7840ae8ebaf 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -73,12 +73,6 @@ extern void tick_broadcast_control(enum tick_broadcast_mode mode); static inline void tick_broadcast_control(enum tick_broadcast_mode mode) { } #endif /* BROADCAST */ -#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_HOTPLUG_CPU) -extern void tick_offline_cpu(unsigned int cpu); -#else -static inline void tick_offline_cpu(unsigned int cpu) { } -#endif - #ifdef CONFIG_GENERIC_CLOCKEVENTS extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state); #else diff --git a/kernel/cpu.c b/kernel/cpu.c index 263508073da8..5a8ad4f5ccf3 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1324,8 +1324,6 @@ static int take_cpu_down(void *_param) */ cpuhp_invoke_callback_range_nofail(false, cpu, st, target); - /* Remove CPU from timer broadcasting */ - tick_offline_cpu(cpu); /* Park the stopper thread */ stop_machine_park(cpu); return 0; diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index b4af8c743b73..522414089c0d 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -412,6 +412,9 @@ int tick_cpu_dying(unsigned int dying_cpu) tick_cancel_sched_timer(dying_cpu); + /* Remove CPU from timer broadcasting */ + tick_offline_cpu(dying_cpu); + return 0; } diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index a3243c4ac45f..5f2105e637bd 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -142,8 +142,10 @@ static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_ #endif /* !(BROADCAST && ONESHOT) */ #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_HOTPLUG_CPU) +extern void tick_offline_cpu(unsigned int cpu); extern void tick_broadcast_offline(unsigned int cpu); #else +static inline void tick_offline_cpu(unsigned int cpu) { } static inline void tick_broadcast_offline(unsigned int cpu) { } #endif -- 2.43.0