Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3022120rdb; Wed, 15 Nov 2023 19:17:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4h5wPzV19zOij6oS0qI9JYr2Kb8E6KhnWKYSAyDBaxOLkHznpkVlH3Phcb2YcJJVn6pUp X-Received: by 2002:a17:902:d389:b0:1cc:3ae2:493f with SMTP id e9-20020a170902d38900b001cc3ae2493fmr1085878pld.65.1700104675942; Wed, 15 Nov 2023 19:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700104675; cv=none; d=google.com; s=arc-20160816; b=jCmOxvT4I3QDm9aWXCvuIxvw+qGp/sZRKZepOZ3CXEyqu9HZc0VqiK8zCKpd7zGu26 QyfGTxJ0lbmabRsPF+xuiUJTAl1ybCAF8+hYkndwaMZdpTPmFDwsgBnVGTGLhTy6rJQj VNrlq7ixs4JiDUCl0Fv5VbEw296GIxOatJLFWdKMSlbA+vEiimDVq0J0BclTTDBsL3Rt Kr3/7ZvRngo2RD67W5OiOZzNX88BouACk4HQkcCWdEUTpyPqhnYSU5CwL4WLkAp6LTr3 3MMDA8WH//yi2p3BipJ+kC58f0HHWLoEkU9OUSNJGVmiJGnSKwfPyPTqiOAWD1e2fXI4 03kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=hEEkWbjBVebcnP1jlUFf7II3F37ds8tf/DyZorI7h4w=; fh=VHLl5hJq+YmtZ4C4dBYyaB1/BenUC1DkHJSPoZ4A400=; b=0Wvv2zluBJoRi6a4+16IeF3j4t9sptYZ0cvYCdlb5ow7WlwdYre+9VeR4O95HzinXZ QIuv+8G5ibBD/4iXQlLBKGJuxOrjQh6BRMZ6Fuf7V3NfmW3bhB42A/lmkK8PNxIg4toU xR1gqkybPGB7tPrEEzV6jqSnPOdDPXPuf7LwslrXrQsWiviWpBmyBVsS8M4S4oQdHePA 6/l6EF/I30kXZy/C4t3bS/wAUM6WiDHsv+zA1+uu6R5JT8FRyLv1QNNXsMMgZzp6GpS9 75u7qxl1MTudF2iaTOK9VSZdoweOr1q2Ul4LE/ndDPcI+2GT4L/CeIIBRGwRJA3J5G8m Oa+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p12-20020a170902eacc00b001cc43368c9bsi10871237pld.630.2023.11.15.19.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 19:17:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D664F8049214; Wed, 15 Nov 2023 19:17:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344493AbjKPDRw (ORCPT + 99 others); Wed, 15 Nov 2023 22:17:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235471AbjKPDRv (ORCPT ); Wed, 15 Nov 2023 22:17:51 -0500 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A2CBA19E for ; Wed, 15 Nov 2023 19:17:46 -0800 (PST) Received: from loongson.cn (unknown [10.20.42.173]) by gateway (Coremail) with SMTP id _____8Dxl+jYiVVlW3I6AA--.13712S3; Thu, 16 Nov 2023 11:17:44 +0800 (CST) Received: from [10.20.42.173] (unknown [10.20.42.173]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxzdzViVVlMqlDAA--.17404S3; Thu, 16 Nov 2023 11:17:43 +0800 (CST) Subject: Re: [PATCH] LoongArch: Implement stable timer shutdown interface To: Huacai Chen Cc: WANG Xuerui , Peter Zijlstra , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org References: <20231114114656.1003841-1-maobibo@loongson.cn> From: maobibo Message-ID: Date: Thu, 16 Nov 2023 11:17:42 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8DxzdzViVVlMqlDAA--.17404S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoWxXw4UKw17KF1rZFWrWFWxuFX_yoW5Ar1xpa 1DCFnxKr45KwnagFn7tr4kZr90k34jvw43t3srKa48Cr9Iqr1ftF4xtrWqvF45uryFgFWx A3WY9w1DZay7XagCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUv2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE 14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCYjI0SjxkI62AI1c AE67vIY487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8C rVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtw CIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x02 67AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr 0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU1Ek sDUUUUU== X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 19:17:55 -0800 (PST) On 2023/11/16 上午10:50, Huacai Chen wrote: > Hi, Bibo, > > "stable timer" is Chinglish, use "constant timer" here. will do if you insist on, the name is not created by me :( > > On Tue, Nov 14, 2023 at 7:49 PM Bibo Mao wrote: >> >> 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 >> --- >> 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; >> } >> >> -static int constant_set_state_oneshot_stopped(struct clock_event_device *evt) >> +static int constant_set_state_shutdown(struct clock_event_device *evt) >> { >> unsigned long timer_config; >> > Please remove the whole constant_set_state_oneshot_stopped() and move > its logic to the below constant_set_state_shutdown(). will do. > > And it is very strange that this "bug" hasn't caused any problems until now. Since there is no other hw timer except percpu timer, there will be problem if hw timer is switched, also nobody watches hw behaviors when cpu is plug-out. LTP cpu hotplug test cases just report passed on physical machine. Regards Bibo Mao > > Huacai > >> @@ -90,11 +90,6 @@ static int constant_set_state_periodic(struct clock_event_device *evt) >> return 0; >> } >> >> -static int constant_set_state_shutdown(struct clock_event_device *evt) >> -{ >> - return 0; >> -} >> - >> static int constant_timer_next_event(unsigned long delta, struct clock_event_device *evt) >> { >> unsigned long timer_config; >> @@ -161,7 +156,7 @@ int constant_clockevent_init(void) >> cd->rating = 320; >> cd->cpumask = cpumask_of(cpu); >> cd->set_state_oneshot = constant_set_state_oneshot; >> - cd->set_state_oneshot_stopped = constant_set_state_oneshot_stopped; >> + cd->set_state_oneshot_stopped = constant_set_state_shutdown; >> cd->set_state_periodic = constant_set_state_periodic; >> cd->set_state_shutdown = constant_set_state_shutdown; >> cd->set_next_event = constant_timer_next_event; >> >> base-commit: 9bacdd8996c77c42ca004440be610692275ff9d0 >> -- >> 2.39.3 >>