mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "zhangpengjie (A)" <zhangpengjie2@huawei.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: <rafael@kernel.org>, <lenb@kernel.org>, <viresh.kumar@linaro.org>,
	<robert.moore@intel.com>, <linux-acpi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<acpica-devel@lists.linux.dev>, <zhanjie9@hisilicon.com>,
	<zhenglifeng1@huawei.com>, <lihuisong@huawei.com>,
	<yubowen8@huawei.com>, <linhongye@h-partners.com>,
	<linuxarm@huawei.com>, <jonathan.cameron@huawei.com>,
	<wangzhi12@huawei.com>
Subject: Re: [PATCH v2] ACPI: CPPC: Move reference performance to capabilities
Date: Tue, 10 Mar 2026 13:05:04 +0800	[thread overview]
Message-ID: <70469192-ab9e-406a-999d-a72d0f2ce0fe@huawei.com> (raw)
In-Reply-To: <20260310003026.GA2639793@ax162>



Hi Nathan,

On 3/10/2026 8:30 AM, Nathan Chancellor wrote:
> Hi Pengjie,
>
> On Fri, Feb 13, 2026 at 06:09:35PM +0800, Pengjie Zhang wrote:
>> Currently, the `Reference Performance` register is read every time
>> the CPU frequency is sampled in `cppc_get_perf_ctrs()`. This function
>> is on the hot path of the cpufreq driver.
>>
>> Reference Performance indicates the performance level that corresponds
>> to the Reference Counter incrementing and is not expected to change
>> dynamically during runtime (unlike the Delivered and Reference counters).
>>
>> Reading this register in the hot path incurs unnecessary overhead,
>> particularly on platforms where CPC registers are located in the PCC
>> (Platform Communication Channel) subspace. This patch moves
>> `reference_perf` from the dynamic feedback counters structure
>> (`cppc_perf_fb_ctrs`) to the static capabilities structure
>> (`cppc_perf_caps`).
>>
>> Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
> After this change landed in -next as commit 8505bfb4e4ec ("ACPI: CPPC:
> Move reference performance to capabilities"), I am seeing the following
> dmesg errors on one of my test machines.
>
>    Could not retrieve perf counters (-14)
>    amd_pstate: Failed to initialize CPU 0: -14
>    amd_pstate: Failed to initialize CPU 1: -14
>    amd_pstate: Failed to initialize CPU 2: -14
>    amd_pstate: Failed to initialize CPU 3: -14
>    amd_pstate: Failed to initialize CPU 4: -14
>    amd_pstate: Failed to initialize CPU 5: -14
>    amd_pstate: Failed to initialize CPU 6: -14
>    amd_pstate: Failed to initialize CPU 7: -14
>    amd_pstate: Failed to initialize CPU 8: -14
>    amd_pstate: Failed to initialize CPU 9: -14
>    amd_pstate: Failed to initialize CPU 10: -14
>    amd_pstate: Failed to initialize CPU 11: -14
>    amd_pstate: Failed to initialize CPU 12: -14
>    amd_pstate: Failed to initialize CPU 13: -14
>    amd_pstate: Failed to initialize CPU 14: -14
>    amd_pstate: Failed to initialize CPU 15: -14
>    amd_pstate: Failed to initialize CPU 16: -14
>    amd_pstate: Failed to initialize CPU 17: -14
>    amd_pstate: Failed to initialize CPU 18: -14
>    amd_pstate: Failed to initialize CPU 19: -14
>    amd_pstate: Failed to initialize CPU 20: -14
>    amd_pstate: Failed to initialize CPU 21: -14
>    amd_pstate: Failed to initialize CPU 22: -14
>    amd_pstate: Failed to initialize CPU 23: -14
>    amd_pstate: Failed to initialize CPU 24: -14
>    amd_pstate: Failed to initialize CPU 25: -14
>    amd_pstate: Failed to initialize CPU 26: -14
>    amd_pstate: Failed to initialize CPU 27: -14
>    amd_pstate: Failed to initialize CPU 28: -14
>    amd_pstate: Failed to initialize CPU 29: -14
>    amd_pstate: Failed to initialize CPU 30: -14
>    amd_pstate: Failed to initialize CPU 31: -14
>    amd_pstate: failed to register with return -19
>
> At the parent change, there are no errors from amd_pstate and I see
>
>    $ cat /sys/devices/system/cpu/amd_pstate/status
>    active
>
> in sysfs. Is this expected? If not, I am happy to provide any additional
> information and test patches. I have attached dmesg outputs from the
> good and bad revisions, in case they would be helpful for gathering
> information.
>
> Cheers,
> Nathan
Thanks for testing and reporting this! The error code -14 (-EFAULT)
you are seeing is exactly due to a logical flaw introduced in that commit
  when handling the local `ref` variable. On platforms that do not support
  the reference performance register, the code falls into the `else` branch
and correctly assigns `perf_caps->reference_perf = nom;`.
However, it forgets to update the local `ref` variable. Because `ref` 
remains
uninitialized (or 0), the subsequent sanity check
  `if (!high || !low || !nom || !ref || !min_nonlinear)`  fails and 
mistakenly returns
  `-EFAULT` (-14).  Could you please apply the following diff and see if 
it resolves
  the amd_pstate initialization failure on your test machine?

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 07bbf5b366a4..ac90c0c55c14 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -1411,7 +1411,8 @@ int cppc_get_perf_caps(int cpunum, struct 
cppc_perf_caps *perf_caps)
                 cpc_read(cpunum, reference_reg, &ref);
                 perf_caps->reference_perf = ref;
         } else {
-               perf_caps->reference_perf = nom;
+               ref = nom;
+               perf_caps->reference_perf = ref;
         }

         if (guaranteed_reg->type != ACPI_TYPE_BUFFER  ||

---

Thanks, Pengjie


> # bad: [ea4134533224d500b2985d30cde106aa3680905d] Add linux-next specific files for 20260309
> # good: [1f318b96cc84d7c2ab792fcc0bfd42a7ca890681] Linux 7.0-rc3
> git bisect start 'ea4134533224d500b2985d30cde106aa3680905d' '1f318b96cc84d7c2ab792fcc0bfd42a7ca890681'
> # bad: [57a0c77d3b89916ae8a01266ed6773038daba7e6] Merge branch 'main' of https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
> git bisect bad 57a0c77d3b89916ae8a01266ed6773038daba7e6
> # good: [2254ba55816e189211a37c14cf4022db826c17ba] Merge branch 'riscv-dt-for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git
> git bisect good 2254ba55816e189211a37c14cf4022db826c17ba
> # good: [57c49b297b6134e349418ad439895acb2b5fdd05] Merge branch 'i2c/for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
> git bisect good 57c49b297b6134e349418ad439895acb2b5fdd05
> # good: [8d282b680c729203d04d4eee396f3216f29b35aa] eth: fbnic: Fetch TX pause storm stats
> git bisect good 8d282b680c729203d04d4eee396f3216f29b35aa
> # bad: [397b4a14684942a64d32ca767816f42c8199bee0] Merge branch 'devfreq-next' of https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
> git bisect bad 397b4a14684942a64d32ca767816f42c8199bee0
> # good: [44f09a027369c62cf5dbe74ef359f41debbbce7c] Merge branch 'docs-next' of git://git.lwn.net/linux.git
> git bisect good 44f09a027369c62cf5dbe74ef359f41debbbce7c
> # bad: [ef5af3b0263db70168ad2d1be317d79568411ad4] Merge branches 'acpi-tad' and 'acpi-cppc' into linux-next
> git bisect bad ef5af3b0263db70168ad2d1be317d79568411ad4
> # good: [9c8e43e3ee8de15d29c2536540de53011e6760bb] Merge branch 'acpi-cmos-rtc' into linux-next
> git bisect good 9c8e43e3ee8de15d29c2536540de53011e6760bb
> # good: [da0f602a7202a65a6029c8e5c2e92a621a473f5b] Merge branch 'acpi-cppc' into linux-next
> git bisect good da0f602a7202a65a6029c8e5c2e92a621a473f5b
> # good: [76f9d5b4246705f45d254353cb55a7d598a87591] ACPI: TAD: Rearrange RT data validation checking
> git bisect good 76f9d5b4246705f45d254353cb55a7d598a87591
> # good: [2fc2d223e9809504089ab2cec334d82940e985d9] ACPI: TAD: Add RTC class device interface
> git bisect good 2fc2d223e9809504089ab2cec334d82940e985d9
> # good: [c30c96dc51e51cf77e2eea5ab1f26fc3177163b2] ACPI: TAD: Update the driver description comment
> git bisect good c30c96dc51e51cf77e2eea5ab1f26fc3177163b2
> # bad: [8505bfb4e4eca28ef1b20d3369435ec2d6a125c6] ACPI: CPPC: Move reference performance to capabilities
> git bisect bad 8505bfb4e4eca28ef1b20d3369435ec2d6a125c6
> # first bad commit: [8505bfb4e4eca28ef1b20d3369435ec2d6a125c6] ACPI: CPPC: Move reference performance to capabilities

  reply	other threads:[~2026-03-10  5:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 10:09 Pengjie Zhang
2026-03-10  0:30 ` Nathan Chancellor
2026-03-10  5:05   ` zhangpengjie (A) [this message]
2026-03-10 21:29     ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70469192-ab9e-406a-999d-a72d0f2ce0fe@huawei.com \
    --to=zhangpengjie2@huawei.com \
    --cc=acpica-devel@lists.linux.dev \
    --cc=jonathan.cameron@huawei.com \
    --cc=lenb@kernel.org \
    --cc=lihuisong@huawei.com \
    --cc=linhongye@h-partners.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=nathan@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    --cc=viresh.kumar@linaro.org \
    --cc=wangzhi12@huawei.com \
    --cc=yubowen8@huawei.com \
    --cc=zhanjie9@hisilicon.com \
    --cc=zhenglifeng1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®