Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3102426rdb; Wed, 15 Nov 2023 23:19:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUGYZ2kuq5Osdc22o6iY8ndCcwaPRurklabKQmjDuG/jcb9U+IwfijMUSMcuzdQtyNo4cV X-Received: by 2002:a05:6358:528e:b0:16b:c8cd:1f05 with SMTP id g14-20020a056358528e00b0016bc8cd1f05mr9749279rwa.17.1700119169082; Wed, 15 Nov 2023 23:19:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700119169; cv=none; d=google.com; s=arc-20160816; b=oexsaUOsNmdbM1ynOzTTSNN1628eds7HpxxiUgka8Oc4iaDJOmYq9n0JwVWuMfb9gw xPG+me84pFb0cpT/ZvWoGePx539eqdLkN3Mxf5lcMoLkZ5zprvmt2zKXYbnthZN9ge5z uK65tmxnptmzb11t8ctKhz9tfKCRmfl5D/LFQozKGeq2lv/x2wIjhblvVYjl0LcS0adh 9nglAGfHEo4E7C1yZ2HIIrupPZm/Av2xfJcot+6Q9kgzFbZUERm8HkGLWvO1JSxeBzUO rq4Y+fMQcdBoK0hiFfqNMerlaqK80jpoBeK6m5r/RgqZZZGxvqwk1SiXZpKVYypypex6 vnuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=2bOSYEwyFZUQyo1dmiDrBZFf+55DtgeL8fui/XLmVVI=; fh=BZ2YOScC1Y9oNpuaCPzraMtILCPb6tj+bmv0dvrw7dQ=; b=p7eMLQCjckNVElkS6hXnMYt/PaRkTLgdsZhXc0EoebeX5shAtK1HHILn/RBovGoJ2X heW32MKSOMLbxMaRMK1yFZasRgW6tmLcNuIUcRWbVkpAOyP8ONgO9EELChcNP7XIpLI5 VGS+Jq+NBY8ew46/dQLAn77Q6hYuUgKcB8C6BNE3h+OnEcOP2BnihIHi4NOUEDP7hgSh b0zLmJT8oi3xz98kcJEB/wNwl+bmbjzoVv6u8mh5uwb3AFCyMcDDPIEpVC8KEQ+KK14w mMCUOIOSnZ3r3zjQKZYfnb/tXrSM95aBy+K3HDTcS3ZzJPszEVtyX07hRLlHQ1FOlU2U Y+5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=NAJxJYVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bq6-20020a056a02044600b005b91536981csi12884125pgb.11.2023.11.15.23.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 23:19:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=NAJxJYVj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 5256D80A532D; Wed, 15 Nov 2023 23:19:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbjKPHTT (ORCPT + 99 others); Thu, 16 Nov 2023 02:19:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjKPHTS (ORCPT ); Thu, 16 Nov 2023 02:19:18 -0500 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 675EEDA for ; Wed, 15 Nov 2023 23:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1700118545; bh=tLhZrpx6yt9jl3oYPUFGvwS/PimaF07PQj+3E4RHTU8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=NAJxJYVjQm26NZG+m5Gq3p4yf4vzA96hBHGaXLL4vN84pBTNOZzXQqpv1RT5AzzH5 i718fYipP+pbE9L4+Sn5t7iZ2291u8V4jr3de9NKezzrBPdfH+qrQ1+lNdaYx/KA/R NI4nyRiAEXK2aXiz8IpMlugqQxMhQSw7qwlJ7hIs= Received: from [IPV6:240e:388:8d26:bf00:6f50:1e00:d62c:dcf9] (unknown [IPv6:240e:388:8d26:bf00:6f50:1e00:d62c:dcf9]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id C53276018A; Thu, 16 Nov 2023 15:09:05 +0800 (CST) Message-ID: <21c772c3-b1ad-49c4-b6ca-204cb65042de@xen0n.name> Date: Thu, 16 Nov 2023 15:09:05 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] LoongArch: Implement stable timer shutdown interface Content-Language: en-US To: Bibo Mao , Huacai Chen Cc: Peter Zijlstra , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org References: <20231114114656.1003841-1-maobibo@loongson.cn> From: WANG Xuerui In-Reply-To: <20231114114656.1003841-1-maobibo@loongson.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 15 Nov 2023 23:19:26 -0800 (PST) Hi, Sorry for the late review but here we go: On 11/14/23 19:46, Bibo Mao wrote: > When cpu is hotplug out, cpu is in idle state and function "When a CPU is hot-unplugged, it is put into idle state and the function ... is called" > 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. The logical relationship is a bit unclear, is my paraphrasing correct in your opinion? "Timer interrupt for this processor should be disabled, else a pending timer interrupt will prevent the vCPU from scheduling out during the halt-polling flow when system is running in VM mode" (I don't immediately know what a "schedule out" is. Is that a translation artifact or some KVM jargon?) > > This patch adds detailed implementation for timer shutdown interface, so > that timer will be disabled when cpu is plug-out. Missing some definite articles too. "This patch implements the timer shutdown interface so that the timer will be properly disabled when a CPU is hot-unplugged" Is this version better? > > 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; > > @@ -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 Otherwise LGTM (regarding the renaming of constant_set_state_oneshot_stopped, both it and the removed constant_set_state_shutdown only has one usage respectively, and looking at the function body it's arguably more appropriate to let it take the "shutdown" name: it's just clearing the enable bit from the CSR.TCFG and nothing else). With the nits addressed: Reviewed-by: WANG Xuerui -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/