mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 6/9] ACPI: processor: idle: Do not change power states if get power info failed
Date: Fri, 24 Oct 2025 17:10:14 +0800	[thread overview]
Message-ID: <e1d440bd-23c0-434c-a771-5c0907c5d3ab@huawei.com> (raw)
In-Reply-To: <CAJZ5v0jBqPLjK2v7A-8Qd6ERhwz47jP3YCiTHJhD8vAgRHVjcQ@mail.gmail.com>


在 2025/10/22 3:49, Rafael J. Wysocki 写道:
> On Mon, Sep 29, 2025 at 11:38 AM Huisong Li <lihuisong@huawei.com> wrote:
>> Driver will update power states when processor power states have been
>> changed. To prevent any other abnormal issues, here add the verification
>> for the result of getting power information, don't change power states
>> and one error log when get power information failed.
> But the old states may not be usable any more in that case.
Yes
>
> If you want to check the acpi_processor_get_power_info(), it should
> disable ACPi idle entirely on failures.
 From the modification of this patch, this cpuidle device will be 
disabled if the acpi_processor_get_power_info()fails to get on this device.
And the cpuidle of the device will be disabled according to the 
definition of cpuidle_not_available().
We should not call disable_cpuidle() to disable cpuidle of all CPUs.
So the modification in this patch is enough, right?
>
>> Fixes: f427e5f1cf75 ("ACPI / processor: Get power info before updating the C-states")
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> ---
>>   drivers/acpi/processor_idle.c | 15 ++++++++++-----
>>   1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
>> index b0d6b51ee363..92b231f5d514 100644
>> --- a/drivers/acpi/processor_idle.c
>> +++ b/drivers/acpi/processor_idle.c
>> @@ -1315,6 +1315,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
>>          int cpu;
>>          struct acpi_processor *_pr;
>>          struct cpuidle_device *dev;
>> +       int ret = 0;
>>
>>          if (disabled_by_idle_boot_param())
>>                  return 0;
>> @@ -1344,16 +1345,20 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
>>                  }
>>
>>                  /* Populate Updated C-state information */
>> -               acpi_processor_get_power_info(pr);
>> -               acpi_processor_setup_cpuidle_states(pr);
>> +               ret = acpi_processor_get_power_info(pr);
>> +               if (ret)
>> +                       pr_err("Get processor-%u power information failed.\n",
>> +                              pr->id);
>> +               else
>> +                       acpi_processor_setup_cpuidle_states(pr);
>>
>>                  /* Enable all cpuidle devices */
>>                  for_each_online_cpu(cpu) {
>>                          _pr = per_cpu(processors, cpu);
>>                          if (!_pr || !_pr->flags.power_setup_done)
>>                                  continue;
>> -                       acpi_processor_get_power_info(_pr);
>> -                       if (_pr->flags.power) {
>> +                       ret = acpi_processor_get_power_info(_pr);
>> +                       if (!ret && _pr->flags.power) {
>>                                  dev = per_cpu(acpi_cpuidle_device, cpu);
>>                                  acpi_processor_setup_cpuidle_dev(_pr, dev);
>>                                  cpuidle_enable_device(dev);
>> @@ -1363,7 +1368,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
>>                  cpus_read_unlock();
>>          }
>>
>> -       return 0;
>> +       return ret;
>>   }
>>
>>   void acpi_processor_register_idle_driver(void)
>> --
>> 2.33.0
>>

  reply	other threads:[~2025-10-24  9:10 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)
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) [this message]
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=e1d440bd-23c0-434c-a771-5c0907c5d3ab@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

all inboxes | Powered by JetHome®