Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1976400rdb; Wed, 31 Jan 2024 15:30:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDnxHU9MD4Zx8gkM2/lGSwSX32yP1qbhZ2BTPSSRqebM4ubRKdA/S8Db7oEjAc1PiDKZbk X-Received: by 2002:a05:6122:ca4:b0:4b6:c299:4a8f with SMTP id ba36-20020a0561220ca400b004b6c2994a8fmr640790vkb.5.1706743852192; Wed, 31 Jan 2024 15:30:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706743852; cv=pass; d=google.com; s=arc-20160816; b=eDTA0wtKaFCWDPuL9BqLb/TD7bRC7oJg8MY+/qJrlfQJqd4PtJDhVCdNpUmJZwMqzJ LplSQ68VSZPA2tR/a/1wXZx0rQV+8gwJ39kkdX4zlnOEPN3RxpSF/Tz5U1yJuXzM7RjE smPDICNnIS8YRpfpix7rbeiz0n397PQQBW2Ck93pNKAApw/A4Iuds1lQmoEoLUhajV7t ux2EM9zyqjdZEBgYhIJ/xN08bgyqupupQIt/40jWLhKy7JB7A1MmCtVPhCyblA3z1wHr Eceoe0FACKgEGxlYCrc0Vqrjk/7WMwh8sO4eTXK266TTUbh1C5k7nBsl7vezIJZeeY+V LO1g== 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=g4noiabl/09fRDiQUrw88BLuen4Vzt8p3dhk8Ys+lHE=; fh=Q1gy1gnTLo/3nAWB/5ojTuzLhZQB9d0jBFF5Q6a6ayQ=; b=CFuvxfDxXdcSdCEi92EcDFOkdw47q7NNx0WEHtDPaeEwRq9z31T3IfyOZat1Xf8KNy KEk/CuUmesnMZ40dhkK0LZYp0v3yCXdqs553nPG78EnvUlAS+DWVnd9yVOxdABNe9Vxr BcfRuZalueSNVkLWIDlJrx3GzEpPdUXqAWQ5iEI+tNvudSm2ENLlUm9FwZ8Jvuxv/vhE Hr19rSldsepyEzFq6CFvbKCTAvH0IDJ/VH5e5wg0YtEw792NgrCpFiJhTlJ4ju5EK1/L paDq3N5qJHYz6gqdLEeZpAZ2g8HxfCBcxY0qVESLZI1c61W6ZmNRPd6VOfWw3Rksm0Pe iv6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W1iv1NUe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47353-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVoPFFkEJthHUNMXEp/k8JmOGX3g2f2LEm/cVmHqkQk9ii/HaM24MQfE8pxxswOf8PSotyBtzrCy4Dpn08Aajj8HAjjojH4zi4PsmOdBQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r7-20020a056214212700b0068c4200b86dsi10568888qvc.225.2024.01.31.15.30.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:30:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W1iv1NUe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47353-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D99D81C213CF for ; Wed, 31 Jan 2024 23:30:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA7548288D; Wed, 31 Jan 2024 23:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W1iv1NUe" 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 1BE6D69D01 for ; Wed, 31 Jan 2024 23:11:46 +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=1706742707; cv=none; b=mdH+SzE6wkUq/L79Q1/TuyG2PqlAwatf1vCUGxR+YTITm0mQ8b8qRUEWmxd4wZUJ+1wmD7kewphitx3YuEqYpcJmlhdBbjDVsajmYOmLFFfyLkZCfNFcsa84/MNABsPyuU1sTcWR59sOHUQBVUbhL5FCmUo/Nlw52Abr5kwImTA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742707; c=relaxed/simple; bh=MlUbkGKGjJi82z5TxfBnlqTsq0RVRvhDZpea1eJZW/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cN8lrmYSlJm5QtHqwUDJTB+49io/aFH0cq3HmcEaNahUPLMaJJGXKPMI0bylSy4Xu/YEDopIMBzPEib6CRX8okYLAt/LnyNWJcTfLKkFhH1QwVHE3h94uFeV5xxVs93EIcV3/UqVwhU2jXu3lnexNI8WTnYcB3YIRTrowu/ptYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W1iv1NUe; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B24EDC43390; Wed, 31 Jan 2024 23:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742706; bh=MlUbkGKGjJi82z5TxfBnlqTsq0RVRvhDZpea1eJZW/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W1iv1NUe6YFmz80ocBTAV/rgd85OVpBLfRdAaRWhQko51iiRTuZSjsESN4+4epWte MVqy+xp9ee0/+vODHuypmRFuzISZkELUlpAu787iYFNS42CnqGtirMrLbzkR5VpZG7 799amkNTKfWi/jPIUPdVuyX3w9ZzLFroBT4gXMpK1qRoadY6eD8kstdsNBTvMG69SR /CpvlyVZSV9He4HLIv7UKhtr6uzkHAMpIuEk/i7juVIS356hIHUZwtv0xmk+KbZWss PwEBeaHHcfW2Z9bGlNdWGLx0J9eWJOB+ICo20YHNgg6EgJ4LoZSn7O9CQ21lbm/N5g FCZIT1JPDKKWg== 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: Thu, 1 Feb 2024 00:11:14 +0100 Message-ID: <20240131231120.12006-10-frederic@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240131231120.12006-1-frederic@kernel.org> References: <20240131231120.12006-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 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