From: "lihuisong (C)" <lihuisong@huawei.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: <lenb@kernel.org>, <linux-acpi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <Sudeep.Holla@arm.com>,
<linuxarm@huawei.com>, <jonathan.cameron@huawei.com>,
<zhanjie9@hisilicon.com>, <zhenglifeng1@huawei.com>,
<yubowen8@huawei.com>
Subject: Re: [PATCH v1 5/9] ACPI: processor: idle: Add the verification of processor FFH LPI state
Date: Mon, 27 Oct 2025 09:42:47 +0800 [thread overview]
Message-ID: <37fb4e84-d404-449e-986a-e5ccb327bd78@huawei.com> (raw)
In-Reply-To: <CAJZ5v0hHO_vuQ71sQ2=vmjEMNr3jYh6Wx_nk55gQVdGgWFDHKQ@mail.gmail.com>
在 2025/10/26 20:40, Rafael J. Wysocki 写道:
> On Fri, Oct 24, 2025 at 11:40 AM lihuisong (C) <lihuisong@huawei.com> wrote:
>>
>> 在 2025/10/23 18:35, Rafael J. Wysocki 写道:
>>> On Thu, Oct 23, 2025 at 12:17 PM lihuisong (C) <lihuisong@huawei.com> wrote:
>>>> 在 2025/10/22 3:42, Rafael J. Wysocki 写道:
>>>>> On Mon, Sep 29, 2025 at 11:38 AM Huisong Li <lihuisong@huawei.com> wrote:
>>>>>> Both ARM64 and RISCV architecture would validate Entry Method of LPI
>>>>>> state and SBI HSM or PSCI cpu suspend. Driver should return failure
>>>>>> if FFH of LPI state are not ok.
>>>>> First of all, I cannot parse this changelog, so I don't know the
>>>>> motivation for the change.
>>>> Sorry for your confusion.
>>>>> Second, if _LPI is ever used on x86, the
>>>>> acpi_processor_ffh_lpi_probe() in acpi_processor_get_power_info() will
>>>>> get in the way.
>>>> AFAICS, it's also ok if X86 platform use LPI.
>>> No, because it returns an error by default as it stands today.
>>>
>>>>> Why does the evaluation in acpi_processor_setup_cpuidle_dev() not work?
>>>> The acpi_processor_ffh_lpi_probe does verify the validity of LPI for ARM
>>>> and RISCV.
>>>> But the caller of the acpi_processor_setup_cpuidle_dev()don't verify the
>>>> return value.
>>>> In addition, from the name of acpi_processor_setup_cpuidle_dev(), its
>>>> main purpose is to setup cpudile device rather than to verify LPI.
>>> That's fair enough.
>>>
>>> Also, the list of idle states belongs to the cpuidle driver, not to a
>>> cpuidle device.
>>>
>>>> So I move it to a more prominent position and redefine the
>>>> acpi_processor_setup_cpuidle_dev to void in patch 9/9.
>>>>>> Fixes: a36a7fecfe60 ("ACPI / processor_idle: Add support for Low Power Idle(LPI) states")
>>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>>> ---
>>>>>> drivers/acpi/processor_idle.c | 10 ++++++++--
>>>>>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
>>>>>> index 5684925338b3..b0d6b51ee363 100644
>>>>>> --- a/drivers/acpi/processor_idle.c
>>>>>> +++ b/drivers/acpi/processor_idle.c
>>>>>> @@ -1264,7 +1264,7 @@ static int acpi_processor_setup_cpuidle_dev(struct acpi_processor *pr,
>>>>>>
>>>>>> dev->cpu = pr->id;
>>>>>> if (pr->flags.has_lpi)
>>>>>> - return acpi_processor_ffh_lpi_probe(pr->id);
>>>>>> + return 0;
>>>>>>
>>>>>> return acpi_processor_setup_cpuidle_cx(pr, dev);
>>>>>> }
>>>>>> @@ -1275,7 +1275,13 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
>>>>>>
>>>>>> ret = acpi_processor_get_lpi_info(pr);
>>>>>> if (ret)
>>> So I think it would be better to check it here, that is
>>>
>>> if (!ret) {
>>> ret = acpi_processor_ffh_lpi_probe(pr->id));
>>> if (!ret)
>>> return 0;
>>>
>>> pr_info("CPU%d: FFH LPI state is invalid\n", pr->id);
>>> pr->flags.has_lpi = 0;
>>> }
>>>
>>> return acpi_processor_get_cstate_info(pr);
>>>
>>> And the default acpi_processor_ffh_lpi_probe() needs to be changed to return 0.
>> Sorry, I don't understand why pr->flags.has_lpi is true if
>> acpi_processor_ffh_lpi_probe() return failure.
> It is set by acpi_processor_get_lpi_info() on success and
> acpi_processor_ffh_lpi_probe() does not update it.
The acpi_processor_get_lpi_info() will return failure on X86 platform
because this function first call acpi_processor_ffh_lpi_probe().
And acpi_processor_ffh_lpi_probe return EOPNOTSUPP because X86 platform
doesn't implement it.
So I think pr->flags.has_lpi is false on X86 plaform.
>
>> In addition, X86 platform doesn't define acpi_processor_ffh_lpi_probe().
>> this function will return EOPNOTSUPP.
> Which is exactly why it is a problem. x86 has no reason to implement
> it because FFH always works there.
Sorry, I still don't understand why X86 has no reason to implement it.
I simply think that X86 doesn't need it.
AFAICS, the platform doesn't need to get LPI info if this platform
doesn't implement acpi_processor_ffh_lpi_probe().
>
>>>>>> - ret = acpi_processor_get_cstate_info(pr);
>>>>>> + return acpi_processor_get_cstate_info(pr);
>>>>>> +
>>>>>> + if (pr->flags.has_lpi) {
>>>>>> + ret = acpi_processor_ffh_lpi_probe(pr->id);
>>>>>> + if (ret)
>>>>>> + pr_err("Processor FFH LPI state is invalid.\n");
>>>>>> + }
>>>>>>
>>>>>> return ret;
>>>>>> }
>>>>>> --
next prev parent reply other threads:[~2025-10-27 1:42 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 9:37 [PATCH v1 0/9] ACPI: processor: idle: enhance and cleancode for cpuidle state Huisong Li
2025-09-29 9:37 ` [PATCH v1 1/9] ACPI: processor: idle: raise up log level when evaluate LPI failed Huisong Li
2025-10-21 19:29 ` Rafael J. Wysocki
2025-10-23 9:09 ` lihuisong (C)
2025-09-29 9:37 ` [PATCH v1 2/9] ACPI: processor: idle: Return failure if entry method is not buffer or integer type Huisong Li
2025-10-21 19:34 ` Rafael J. Wysocki
2025-10-23 9:25 ` lihuisong (C)
2025-10-23 10:07 ` Rafael J. Wysocki
2025-10-24 9:25 ` lihuisong (C)
2025-10-26 12:35 ` Rafael J. Wysocki
2025-09-29 9:37 ` [PATCH v1 3/9] ACPI: processor: idle: Return failure when get lpi_state->arch_flags failed Huisong Li
2025-10-21 19:36 ` Rafael J. Wysocki
2025-10-23 9:59 ` lihuisong (C)
2025-10-23 10:09 ` Rafael J. Wysocki
2025-10-24 9:27 ` lihuisong (C)
2025-09-29 9:37 ` [PATCH v1 4/9] ACPI: processor: idle: Move the initialization of state->flags to acpi_processor_setup_cstates Huisong Li
2025-10-22 14:49 ` Rafael J. Wysocki
2025-09-29 9:37 ` [PATCH v1 5/9] ACPI: processor: idle: Add the verification of processor FFH LPI state Huisong Li
2025-10-21 19:42 ` Rafael J. Wysocki
2025-10-23 10:17 ` lihuisong (C)
2025-10-23 10:35 ` Rafael J. Wysocki
2025-10-24 9:40 ` lihuisong (C)
2025-10-26 12:40 ` Rafael J. Wysocki
2025-10-27 1:42 ` lihuisong (C) [this message]
2025-10-27 12:28 ` Rafael J. Wysocki
2025-10-28 12:45 ` lihuisong (C)
2025-10-28 14:10 ` Rafael J. Wysocki
2025-09-29 9:37 ` [PATCH v1 6/9] ACPI: processor: idle: Do not change power states if get power info failed Huisong Li
2025-10-21 19:49 ` Rafael J. Wysocki
2025-10-24 9:10 ` lihuisong (C)
2025-10-26 12:34 ` Rafael J. Wysocki
2025-10-27 3:01 ` lihuisong (C)
2025-10-27 12:31 ` Rafael J. Wysocki
2025-09-29 9:37 ` [PATCH v1 7/9] ACPI: processor: idle: Remove died codes about the verification of cstate count Huisong Li
2025-10-21 19:51 ` Rafael J. Wysocki
2025-10-23 10:19 ` lihuisong (C)
2025-09-29 9:37 ` [PATCH v1 8/9] ACPI: processor: idle: Redefine setup idle functions to void Huisong Li
2025-09-29 9:37 ` [PATCH v1 9/9] ACPI: processor: idle: Redefine acpi_processor_setup_cpuidle_dev " Huisong Li
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=37fb4e84-d404-449e-986a-e5ccb327bd78@huawei.com \
--to=lihuisong@huawei.com \
--cc=Sudeep.Holla@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=rafael@kernel.org \
--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