From patchwork Tue Aug 15 01:40:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 135617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:3f2:4152:657d with SMTP id x8csp191641vqo; Mon, 14 Aug 2023 21:09:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEG7KZLxUQso3V46Q5xh6UEDrUchDk4k6kZRQG7smjbOrOkk2zdrqnPIoQjE6HYifpxUkm1 X-Received: by 2002:a17:906:53:b0:98c:e72c:6b83 with SMTP id 19-20020a170906005300b0098ce72c6b83mr8632378ejg.45.1692072581338; Mon, 14 Aug 2023 21:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692072581; cv=none; d=google.com; s=arc-20160816; b=cc6naZyAC/NKwTleA+Xj6W8icswkwu+q3HiQL534rzLtWhMcyjuv3MPn5buufGA4Wh PQpRJCsc70lfLPnkzQOp2wQ7pRyjdxouqMojsRVXptKb5QLFk5PfNsakOt9FuaaOE/6+ UAf38gmwI55DPJMtlVF2n1TMJQuGA6X26270bCkHGAhvMT1XJywdn9Eo4ctZCbFZAjW2 LwsLIKgIlHbaOucxKG7cLj0aHRhXdvmDoJx0PMN5NI5U/k5xDxF8uuLVevkCyAxgLObn YS+CH4PUFxOyqHxOzqJkRUxi9S0Yl2D2X9kgLrwbr6vSNpY5dm6m305HbPSkDdCmMUwP Fp7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=58WAyai+brZFBOoT4kTBOqTMKZDuLaDa9gXXcg1MuC4=; fh=MkjW1f1ixasRiKuzf2PaYxsdrg4RoFahP+0zEUjLGHA=; b=eSdNo+1DAFvaFR8mhDC6rBfZPUMxNo9TqqnarbX+chQ0KRqS2XUl1VsNPnN2FLkcD+ opKjNcZZ0uNV0uxJAu31Nu7NHDP/xhnDfHq8cY2vkd2t6SwvBdmBJ6mmvzTOeaQwEY9n kxZiBVHsIj2brXCv68INam/GxkFL0xOZhcWw5Z0MJsbhd05evxguOidkCMuBBJ8qSeZi ACcGY4WmtqyP7M/H/IqA6fFUNEABgdq/upP902REjfan0dvfi+Ce8l9K6IkOqdcIjuiZ jR7AptIXpVezPcK8/zVTwCfy4ncyIv0t3LY49PYptgpN+FQyXNWPrDx9GJnar5aUQG64 w4HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a170906040900b00992b63c9c16si8343675eja.129.2023.08.14.21.09.08; Mon, 14 Aug 2023 21:09:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230043AbjHOBka (ORCPT + 99 others); Mon, 14 Aug 2023 21:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbjHOBk3 (ORCPT ); Mon, 14 Aug 2023 21:40:29 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 608EEE7; Mon, 14 Aug 2023 18:40:27 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RPv4y18s7ztRyh; Tue, 15 Aug 2023 09:36:50 +0800 (CST) Received: from huawei.com (10.67.174.53) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 15 Aug 2023 09:40:25 +0800 From: Liao Chang To: , CC: , Subject: [PATCH 1/2] cpufreq: Prefer to print cpuid in MIN/MAX QoS register error message Date: Tue, 15 Aug 2023 09:40:02 +0800 Message-ID: <20230815014002.4132226-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.53] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774266699251939148 X-GMAIL-MSGID: 1774266699251939148 When a cpufreq_policy is allocated, the cpus, related_cpus and real_cpus of policy are still unset. Therefore, it is preferable to print the passed 'cpu' parameter instead of a empty 'cpus' cpumask in error message when registering MIN/MAX QoS notifier fails. Signed-off-by: Liao Chang --- drivers/cpufreq/cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 50bbc969ffe5..a757f90aa9d6 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1234,16 +1234,16 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MIN, &policy->nb_min); if (ret) { - dev_err(dev, "Failed to register MIN QoS notifier: %d (%*pbl)\n", - ret, cpumask_pr_args(policy->cpus)); + dev_err(dev, "Failed to register MIN QoS notifier: %d (CPU%u)\n", + ret, cpu); goto err_kobj_remove; } ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MAX, &policy->nb_max); if (ret) { - dev_err(dev, "Failed to register MAX QoS notifier: %d (%*pbl)\n", - ret, cpumask_pr_args(policy->cpus)); + dev_err(dev, "Failed to register MAX QoS notifier: %d (CPU%u)\n", + ret, cpu); goto err_min_qos_notifier; } From patchwork Tue Aug 15 01:40:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 135612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:3f2:4152:657d with SMTP id x8csp161226vqo; Mon, 14 Aug 2023 19:37:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3/RmTlmRR08BrokR9OnCszo0KQ7vJSm0heKuAYQEbxP8woSP2UDYT4QglW8pLqcG2Dwx1 X-Received: by 2002:a17:907:6e0d:b0:988:8efc:54fa with SMTP id sd13-20020a1709076e0d00b009888efc54famr649273ejc.37.1692067034037; Mon, 14 Aug 2023 19:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692067034; cv=none; d=google.com; s=arc-20160816; b=OrsHjKhJy7sDNq8hZEkIBekvpJiHZ2ki3/fQwp33dchlEKSUMlywJkWo6PKvIvS7a4 +ZWohaOCnSvhPIhYSVfQuflV+w3E7wXEM2by1Y+wrr5B3mdEYSWW80lWZce03oclfTY6 4FivG6oMyl35lx1cXCRllP7lWJXoiNnRGE3Qrx4jX3Ds680KlFIliHfFSYWQVrixvEUL oPDJYlQEmcepl6+n+oro3q6Nc5P4Sc7YC2jzEfkVa7916dOsYZ8NXcOSXzvkxTh2nHBM 5zrZUA6e85ULKgEX6myujkJhI84b31HP+Mh9zCaqeD2UZPD6EEvrYdqO0oEyo59cUsV1 SHdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=uaBUlxiq8W1x8P27CeaNwm/QAPlunedkPJbWzZjw7KY=; fh=MkjW1f1ixasRiKuzf2PaYxsdrg4RoFahP+0zEUjLGHA=; b=k7Dijha+s499Dr74RQuuz0KMw3ec1+dyLRV9+bj4mEKZIDrJVo+6dWGsR942T76U1r 7Icnw6G5onVbjO+sHnuaiOKVmTZVjU7P+/lD7GkSwZ47HDOvpWNQOUiGCAqLGjpVGRmE ZZP/rAy4U4xjrcQKDHCpZIdpEpt6/6Sghf1dHckgTn5UM7aPBlLO0b3wn7Awnfv0zY/S 51GXufH6eThOKDKTDmr/4VIQCwq+fNRkkOo9F3zcLslOUwDJ21EpYRFrWwL0voEdPFdp kaFiTWyrFsOMxMiiLqFgWkEAwmzcgtutSp0W/mnmj8Cq7yscws4FNdeRYC3MFVoJ3Bz/ doAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot19-20020a170906ccd300b00992550ccfa2si8563162ejb.273.2023.08.14.19.36.44; Mon, 14 Aug 2023 19:37:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232523AbjHOBlG (ORCPT + 99 others); Mon, 14 Aug 2023 21:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231590AbjHOBkm (ORCPT ); Mon, 14 Aug 2023 21:40:42 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E692EE7; Mon, 14 Aug 2023 18:40:41 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RPv7s0MXlzrSNL; Tue, 15 Aug 2023 09:39:21 +0800 (CST) Received: from huawei.com (10.67.174.53) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 15 Aug 2023 09:40:39 +0800 From: Liao Chang To: , CC: , Subject: [PATCH 2/2] cpufreq: cppc: cppc_cpufreq_get_rate() returns zero in all error cases. Date: Tue, 15 Aug 2023 09:40:17 +0800 Message-ID: <20230815014018.4132350-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.53] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774260881882235670 X-GMAIL-MSGID: 1774260881882235670 The cpufreq framework used to use the zero of return value to reflect the cppc_cpufreq_get_rate() had failed to get current frequecy and treat all positive integer to be succeed. Since cppc_get_perf_ctrs() returns a negative integer in error case, so it is better to convert the value to zero as the return value of cppc_cpufreq_get_rate(). Signed-off-by: Liao Chang --- drivers/cpufreq/cppc_cpufreq.c | 4 ++-- include/linux/cpufreq.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 796bc3e19f77..1cdef2da1ea4 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -854,13 +854,13 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu) ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0); if (ret) - return ret; + return 0; udelay(2); /* 2usec delay between sampling */ ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t1); if (ret) - return ret; + return 0; delivered_perf = cppc_perf_from_fbctrs(cpu_data, &fb_ctrs_t0, &fb_ctrs_t1); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 172ff51c1b2a..99da27466b8f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -370,7 +370,7 @@ struct cpufreq_driver { int (*target_intermediate)(struct cpufreq_policy *policy, unsigned int index); - /* should be defined, if possible */ + /* should be defined, if possible, return 0 on error */ unsigned int (*get)(unsigned int cpu); /* Called to update policy limits on firmware notifications. */