From nobody Tue Dec 30 15:14:12 2025 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 9BCE9C4332F for ; Tue, 14 Nov 2023 11:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232723AbjKNLta (ORCPT ); Tue, 14 Nov 2023 06:49:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjKNLt2 (ORCPT ); Tue, 14 Nov 2023 06:49:28 -0500 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 672EEE8 for ; Tue, 14 Nov 2023 03:49:24 -0800 (PST) Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8CxNvHCXlNlvfA5AA--.48113S3; Tue, 14 Nov 2023 19:49:22 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bxni_CXlNlnuRBAA--.13313S2; Tue, 14 Nov 2023 19:49:22 +0800 (CST) From: Bibo Mao To: Huacai Chen Cc: WANG Xuerui , Peter Zijlstra , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] LoongArch: Implement stable timer shutdown interface Date: Tue, 14 Nov 2023 19:46:56 +0800 Message-Id: <20231114114656.1003841-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: AQAAf8Bxni_CXlNlnuRBAA--.13313S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7Cw45uFW3JFW3XF18Xry5GFX_yoW8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kernel.org Content-Type: text/plain; charset="utf-8" When cpu is hotplug out, cpu is in idle state and function arch_cpu_idle_dead is called. Timer interrupt for this processor should be disabled, else there will be timer interrupt for the dead cpu. Also this prevents vcpu to schedule out during halt-polling flow when system is running in vm mode, since there is pending timer interrupt. This patch adds detailed implementation for timer shutdown interface, so that timer will be disabled when cpu is plug-out. Signed-off-by: Bibo Mao Reviewed-by: WANG Xuerui --- arch/loongarch/kernel/time.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c index 3064af94db9c..2920770e30a9 100644 --- a/arch/loongarch/kernel/time.c +++ b/arch/loongarch/kernel/time.c @@ -58,7 +58,7 @@ static int constant_set_state_oneshot(struct clock_event_= device *evt) return 0; } =20 -static int constant_set_state_oneshot_stopped(struct clock_event_device *e= vt) +static int constant_set_state_shutdown(struct clock_event_device *evt) { unsigned long timer_config; =20 @@ -90,11 +90,6 @@ static int constant_set_state_periodic(struct clock_even= t_device *evt) return 0; } =20 -static int constant_set_state_shutdown(struct clock_event_device *evt) -{ - return 0; -} - static int constant_timer_next_event(unsigned long delta, struct clock_eve= nt_device *evt) { unsigned long timer_config; @@ -161,7 +156,7 @@ int constant_clockevent_init(void) cd->rating =3D 320; cd->cpumask =3D cpumask_of(cpu); cd->set_state_oneshot =3D constant_set_state_oneshot; - cd->set_state_oneshot_stopped =3D constant_set_state_oneshot_stopped; + cd->set_state_oneshot_stopped =3D constant_set_state_shutdown; cd->set_state_periodic =3D constant_set_state_periodic; cd->set_state_shutdown =3D constant_set_state_shutdown; cd->set_next_event =3D constant_timer_next_event; base-commit: 9bacdd8996c77c42ca004440be610692275ff9d0 --=20 2.39.3