[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bcda4bbb-ef20-448f-a2ad-fbe9f3bbbd20@amd.com>
Date: Thu, 14 Nov 2024 21:22:23 -0600
From: Mario Limonciello <mario.limonciello@....com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux PM <linux-pm@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, x86 Maintainers <x86@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Patryk Wlazlyn <patryk.wlazlyn@...ux.intel.com>,
"Gautham R. Shenoy" <gautham.shenoy@....com>,
Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>
Subject: Re: [PATCH v1] cpuidle: Do not return from cpuidle_play_dead() on
callback failures
On 11/14/2024 11:46, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> If the :enter_dead() idle state callback fails for a certain state,
> there may be still a shallower state for which it will work.
>
> Because the only caller of cpuidle_play_dead(), native_play_dead(),
> falls back to hlt_play_dead() if it returns an error, it should
> better try all of the idle states for which :enter_dead() is present
> before failing, so change it accordingly.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Reviewed-by: Mario Limonciello <mario.limonciello@....com>
Tested-by: Mario Limonciello <mario.limonciello@....com> # 6.12-rc7
> ---
> drivers/cpuidle/cpuidle.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> Index: linux-pm/drivers/cpuidle/cpuidle.c
> ===================================================================
> --- linux-pm.orig/drivers/cpuidle/cpuidle.c
> +++ linux-pm/drivers/cpuidle/cpuidle.c
> @@ -70,9 +70,10 @@ int cpuidle_play_dead(void)
> return -ENODEV;
>
> /* Find lowest-power state that supports long-term idle */
> - for (i = drv->state_count - 1; i >= 0; i--)
> - if (drv->states[i].enter_dead)
> - return drv->states[i].enter_dead(dev, i);
> + for (i = drv->state_count - 1; i >= 0; i--) {
> + if (drv->states[i].enter_dead && !drv->states[i].enter_dead(dev, i))
> + return 0;
> + }
>
> return -ENODEV;
> }
>
>
>
Powered by blists - more mailing lists