From patchwork Sun Sep 29 03:32:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Zhan X-Patchwork-Id: 13814817 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 B796DCF6498 for ; Sun, 29 Sep 2024 03:42:08 +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=njs5bNK6gRMvh2BymrQ4p3TM1eRD4C2TE5Fmdq6r8zM=; b=qPH9XpRgKzm6T75ZrzGErx6V0f sdoLepxtyohZACv0FiILTZEUnTL0nf0dIZFita4Qq14SQLTev6cTKx2Hw2fP1IFRp/GRgeW6M6T7n wQ7Q+yg6t/clp80R+006ey3LskNJziwZwcaFq04SniE/HLWzQPTRaI/Q2+jSrHh58oEERLFdzeaDc zz3QRcRxNsKmlebytdS5kNfxmUA3qIe3Up316+1gGM1F+5Y6tr/5/L/1pMYMKyr80GaoaMNskCNdo +h5t1RljfK6l1BQdEnUUicSfp3+6BDFxCtoOFnWe8Su3UDXHQxzRcNop+gwvkCWsl1SwWXHfOSQ/3 dHwLKaiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sukoq-0000000E3lc-0fnc; Sun, 29 Sep 2024 03:42:00 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1suklO-0000000E3Vi-1sZV for linux-arm-kernel@lists.infradead.org; Sun, 29 Sep 2024 03:38:28 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4XGVJM3X62z1SBPs; Sun, 29 Sep 2024 11:37:23 +0800 (CST) Received: from dggpeml500019.china.huawei.com (unknown [7.185.36.137]) by mail.maildlp.com (Postfix) with ESMTPS id 31673140157; Sun, 29 Sep 2024 11:38:16 +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; Sun, 29 Sep 2024 11:38:15 +0800 From: Jie Zhan To: , , , , CC: , , , , , , , , , , , Subject: [PATCH v4 0/2] cppc_cpufreq: Rework ->get() error handling when cores are idle Date: Sun, 29 Sep 2024 11:32:12 +0800 Message-ID: <20240929033214.1039485-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: dggems703-chm.china.huawei.com (10.3.19.180) 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-20240928_203826_762268_6580C963 X-CRM114-Status: UNSURE ( 8.80 ) 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. --- v4: - Some additional comments as suggested. No functions changes. 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/ v3: https://lore.kernel.org/all/20240919084552.3591400-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 | 128 ++++++++++++--------------------- 1 file changed, 46 insertions(+), 82 deletions(-)