From: Nathan Chancellor <nathan@kernel.org>
To: "zhangpengjie (A)" <zhangpengjie2@huawei.com>
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 14:29:36 -0700 [thread overview]
Message-ID: <20260310212936.GA2143491@ax162> (raw)
In-Reply-To: <70469192-ab9e-406a-999d-a72d0f2ce0fe@huawei.com>
On Tue, Mar 10, 2026 at 01:05:04PM +0800, zhangpengjie (A) wrote:
> 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
Thanks for confirming!
> `-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 ||
Yeah, I tested the following slightly different but functionally
equivalent diff and it appears to cure my problems. Thanks for the quick
reply. If it would be helpful for a follow up submission:
Tested-by: Nathan Chancellor <nathan@kernel.org>
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 07bbf5b366a4..5ad922eb937a 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -1407,12 +1407,11 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
* If reference perf register is not supported then we should
* use the nominal perf value
*/
- if (CPC_SUPPORTED(reference_reg)) {
+ if (CPC_SUPPORTED(reference_reg))
cpc_read(cpunum, reference_reg, &ref);
- perf_caps->reference_perf = ref;
- } else {
- perf_caps->reference_perf = nom;
- }
+ else
+ ref = nom;
+ perf_caps->reference_perf = ref;
if (guaranteed_reg->type != ACPI_TYPE_BUFFER ||
IS_NULL_REG(&guaranteed_reg->cpc_entry.reg)) {
prev parent reply other threads:[~2026-03-10 21:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 10:09 [PATCH v2] ACPI: CPPC: Move reference performance to capabilities Pengjie Zhang
2026-03-10 0:30 ` Nathan Chancellor
2026-03-10 5:05 ` zhangpengjie (A)
2026-03-10 21:29 ` Nathan Chancellor [this message]
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=20260310212936.GA2143491@ax162 \
--to=nathan@kernel.org \
--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=rafael@kernel.org \
--cc=robert.moore@intel.com \
--cc=viresh.kumar@linaro.org \
--cc=wangzhi12@huawei.com \
--cc=yubowen8@huawei.com \
--cc=zhangpengjie2@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