From patchwork Thu Sep 19 08:45:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Zhan X-Patchwork-Id: 13807520 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F3F1CE8D60 for ; Thu, 19 Sep 2024 08:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=F6JnHn3a2jwuKFBloKQMOAnCZsaxF9MPNKwcw6dorF0=; b=BFETsXewlGRv2IS4Zsl5WAAk6t EfbTdL51+kyHHGRJnqdClLEKtwhahxy5GjLcN3ZAm6er9C28dskqFeOizUUhp4i9jkMWq73nEcP2N /+AreoJIkXkQLschfC4DJPWL/oJqi70jDDCrU79JsBy0mecIYynA/u3/1f70Lh9eqTVC8y4zuUwOe J7rWUwW9WTsgoQMZliJplRBw7hUrNjCK3pC+neM/Ki7XfgV7Y96H5lbUTgjSVASDE/i6vndE336eP AaJOBjitLHoHNTst/wR4bo7bC+Ya8nWjpJjb2vG8zcMnmy9XJi+iEetnSeQToufGDA9E5T42JFqru Z42w0pNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1srCva-00000009pzY-14Ob; Thu, 19 Sep 2024 08:54:18 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1srCtM-00000009piK-1tnL for linux-arm-kernel@lists.infradead.org; Thu, 19 Sep 2024 08:52:03 +0000 Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4X8TlV2yvWz20p7t; Thu, 19 Sep 2024 16:51:34 +0800 (CST) Received: from dggpeml500019.china.huawei.com (unknown [7.185.36.137]) by mail.maildlp.com (Postfix) with ESMTPS id 12E85180044; Thu, 19 Sep 2024 16:51:49 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by dggpeml500019.china.huawei.com (7.185.36.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 19 Sep 2024 16:51:48 +0800 From: Jie Zhan To: , , , , CC: , , , , , , , , , , , Subject: [PATCH v3 0/2] cppc_cpufreq: Rework ->get() error handling when cores are idle Date: Thu, 19 Sep 2024 16:45:50 +0800 Message-ID: <20240919084552.3591400-1-zhanjie9@hisilicon.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-Originating-IP: [10.90.30.45] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500019.china.huawei.com (7.185.36.137) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240919_015200_804858_37AB7E4D X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org CPPC feedback counters can be unchanged or 0 when cores are idle, e.g. clock-gated or power-gated. In such case, get the latest desired perf for calculating frequency. Also, the HiSilicon CPPC workaround can now be removed as it can be handled by the common code. --- v3: - Merge patch 1 & 2, tidy up the logic, and reduce duplicate code - Return 0 in cppc_perf_from_fbctrs() if the feedback counters are unchanged rather than return a cached desired perf - Return early in cppc_scale_freq_workfn() if the feedback counters are unchanged v2: - Try reading the lastest desired perf first before using the cached one - Do the same handling logic when feedback counters are unchanged - Remove hisilicon workaround Discussions: v1: https://lore.kernel.org/all/20240819035147.2239767-1-zhanjie9@hisilicon.com/ v2: https://lore.kernel.org/all/20240912072231.439332-1-zhanjie9@hisilicon.com/ Jie Zhan (2): cppc_cpufreq: Use desired perf if feedback ctrs are 0 or unchanged cppc_cpufreq: Remove HiSilicon CPPC workaround drivers/cpufreq/cppc_cpufreq.c | 120 +++++++++++---------------------- 1 file changed, 39 insertions(+), 81 deletions(-)