Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1251598rdb; Wed, 24 Jan 2024 09:09:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlFccNv7YAUNSk/VhhEXU/EdaDG5MWJWO74uQ2XN7Hrj+12FzNkvbP0I1alGDV91Y+LWCL X-Received: by 2002:a05:6870:2316:b0:210:bb18:3e9a with SMTP id w22-20020a056870231600b00210bb183e9amr3945214oao.96.1706116176632; Wed, 24 Jan 2024 09:09:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706116176; cv=pass; d=google.com; s=arc-20160816; b=kPjgtit+TNPwi1KaebIddjQ89OcqKwKT2zrVv0Eja5DUigINnM3SivwwWHM4Try/j1 J3s7bg5lDMViDvlvpR4bSIB8q3OsvIxloBsAEj+1vov1ViEhkMpjBGLVF8Xlrz9bNcKR Wtdx7nIW9zIlhQC6xU1Ll3akDw28eQrbCwQLCPdB0JGkoGfeo5kqdQm4i4s1ywGzsGA7 cKOrqY25c+YmMGnOKg/vtUI4Cp1ddcf4D/gzodvXEGSZ3QYzk00DlDA+rYfY+ORrsfo7 kx7PvYwzq5rYPRhbwGEjuUtHa0f9puMZIDN0bptARHqmVYsNMxRJLwabV2Db0C8BkM74 ZRUQ== 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=43CniSD3u5oq5MrsQmsJXBigbxpQ5ZjoUnsuOut4OiE=; fh=9AYDxpIF3ws21qQDvjghHSFUuXpDdpq2Zh/SbnasVRo=; b=CBAqJfq7FFkZLzlJIoEH8L0ailtyFc83wvfru/N+GP3V3giOZudUce8oZFN6s3t2fI 3Pow5l8CQlwgug19UsnBtN1G4ID2l/lVNbVj9RJZG/AT5jF1SjlK5w1oltE+zkzjeE4x gC5zgaUNQ0P+uq9GjN+adIv0GqCp6YIGe9dd4x0p5/d68nlSBd96N77GUJJriOSbNIiQ vFRSFIlvZrXKhMRkJ3Cm6RbVEy2aN4PZAgKWEq1uH8c+B938KYNCwWRFl/HLIUd+A98k uPUWp2OgwetgZt35wa+XJykpSuZ407X2cmcYwUQPAinFnc7cAaSUziw8fSdUHNLUdxKG TZCQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VER8K9h2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-37388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m5-20020a656a05000000b0057d7cff25besi12195967pgu.829.2024.01.24.09.09.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 09:09:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VER8K9h2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-37388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37388-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 31D16288497 for ; Wed, 24 Jan 2024 17:07:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEF4A1272A7; Wed, 24 Jan 2024 17:05:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VER8K9h2" 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 09F6D86AF3 for ; Wed, 24 Jan 2024 17:05:31 +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=1706115931; cv=none; b=KBiuaANn1slV+VDuDWjTm6rK2P0VNpH1BXU3JopLi3Y5M/zmwrapAoluzNKrR/LGIzQtdKfHNhHOx6j8bjQjoPUwogbC8NOclJzc1TKxPxiB4nbDhT3Kr8CJA+Cg4OrABH5g32NSh5jwxNTRz+h2G5KC6z4whgDE9yPfZ49Del0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115931; c=relaxed/simple; bh=M4HS4i9INNBmGr3d/GfNARoMdgXE99jEy5fvedm3YDE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GQxiWmZhi8GFwV9dZTVCUdSog90bfxBuD4u4WXqgwwIvxF/ep+RFMt9ahFEc3Uw5jjQJliwJXLKTH0IqnTvuYenM0WD2T7gb90R4EstTn1GJ9tTd3vbHGFXQUxs0r1CVfJOjy3a5cE8vFqGvFH6VqKybtGEqeRutWuT5Zz9NA1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VER8K9h2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18E49C43394; Wed, 24 Jan 2024 17:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706115930; bh=M4HS4i9INNBmGr3d/GfNARoMdgXE99jEy5fvedm3YDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VER8K9h2lzl9Xmakflxcyi4nVrh3leQVSrph5vFLdBqjPjsF9Anyt/c21xBTvxPu6 TERvPKs0A/R5dr1/2RhuSDG04alj6MUmkMj+t8zTJH6fl43dG2eQ0/St04tvTo4f16 UT+9WOxWMMBrrYhr4eGRwbXelsZ/14wkhhf4qIKDqQZqkymmQy5RU+yVC/45in3u1u mWRV+ZX8/vZ+uIM7WY5P4az1ZBWYpMkGcc5mSyNfv9h9N4enfCN9IxHHCA6+hUMujN 6p9mPdQ650qF5uFDzVfqlwBJeXcFgo6UJCbX7mrOgT5F5AGNMn3JQIgD/v0frLVkvz JShPiwyDA/zsA== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , Anna-Maria Behnsen , Peng Liu , Joel Fernandes Subject: [PATCH 09/15] tick: Move broadcast cancellation up to CPUHP_AP_TICK_DYING Date: Wed, 24 Jan 2024 18:04:53 +0100 Message-ID: <20240124170459.24850-10-frederic@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124170459.24850-1-frederic@kernel.org> References: <20240124170459.24850-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. 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 481b7ab65e2c..a939ff6de97c 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -137,8 +137,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