Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH v1] ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states
@ 2024-11-14 17:47 Rafael J. Wysocki
  2024-11-15  3:22 ` Mario Limonciello
  2024-11-15 10:18 ` Peter Zijlstra
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2024-11-14 17:47 UTC (permalink / raw)
  To: Linux PM
  Cc: LKML, x86 Maintainers, Peter Zijlstra, Patryk Wlazlyn,
	Gautham R. Shenoy, Artem Bityutskiy, Mario Limonciello

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Notice that acpi_processor_setup_cstates() can set state->enter_dead to acpi_idle_play_dead() for all C-states unconditionally and remove the
confusing C-state type check done before setting it.

No intentional functional impact.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/processor_idle.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/acpi/processor_idle.c
===================================================================
--- linux-pm.orig/drivers/acpi/processor_idle.c
+++ linux-pm/drivers/acpi/processor_idle.c
@@ -803,12 +803,12 @@ static int acpi_processor_setup_cstates(
 		state->enter = acpi_idle_enter;
 
 		state->flags = 0;
-		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
-		    cx->type == ACPI_STATE_C3) {
-			state->enter_dead = acpi_idle_play_dead;
-			if (cx->type != ACPI_STATE_C3)
-				drv->safe_state_index = count;
-		}
+
+		state->enter_dead = acpi_idle_play_dead;
+
+		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2)
+			drv->safe_state_index = count;
+
 		/*
 		 * Halt-induced C1 is not good for ->enter_s2idle, because it
 		 * re-enables interrupts on exit.  Moreover, C1 is generally not




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states
  2024-11-14 17:47 [PATCH v1] ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states Rafael J. Wysocki
@ 2024-11-15  3:22 ` Mario Limonciello
  2024-11-15 10:18 ` Peter Zijlstra
  1 sibling, 0 replies; 3+ messages in thread
From: Mario Limonciello @ 2024-11-15  3:22 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM
  Cc: LKML, x86 Maintainers, Peter Zijlstra, Patryk Wlazlyn,
	Gautham R. Shenoy, Artem Bityutskiy

On 11/14/2024 11:47, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Notice that acpi_processor_setup_cstates() can set state->enter_dead to acpi_idle_play_dead() for all C-states unconditionally and remove the
> confusing C-state type check done before setting it.
> 
> No intentional functional impact.
> 
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: Mario Limonciello <mario.limonciello@amd.com> # 6.12-rc7

> ---
>   drivers/acpi/processor_idle.c |   12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> Index: linux-pm/drivers/acpi/processor_idle.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/processor_idle.c
> +++ linux-pm/drivers/acpi/processor_idle.c
> @@ -803,12 +803,12 @@ static int acpi_processor_setup_cstates(
>   		state->enter = acpi_idle_enter;
>   
>   		state->flags = 0;
> -		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
> -		    cx->type == ACPI_STATE_C3) {
> -			state->enter_dead = acpi_idle_play_dead;
> -			if (cx->type != ACPI_STATE_C3)
> -				drv->safe_state_index = count;
> -		}
> +
> +		state->enter_dead = acpi_idle_play_dead;
> +
> +		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2)
> +			drv->safe_state_index = count;
> +
>   		/*
>   		 * Halt-induced C1 is not good for ->enter_s2idle, because it
>   		 * re-enables interrupts on exit.  Moreover, C1 is generally not
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states
  2024-11-14 17:47 [PATCH v1] ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states Rafael J. Wysocki
  2024-11-15  3:22 ` Mario Limonciello
@ 2024-11-15 10:18 ` Peter Zijlstra
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2024-11-15 10:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PM, LKML, x86 Maintainers, Patryk Wlazlyn,
	Gautham R. Shenoy, Artem Bityutskiy, Mario Limonciello

On Thu, Nov 14, 2024 at 06:47:55PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Notice that acpi_processor_setup_cstates() can set state->enter_dead to acpi_idle_play_dead() for all C-states unconditionally and remove the
> confusing C-state type check done before setting it.
> 
> No intentional functional impact.
> 
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/acpi/processor_idle.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> Index: linux-pm/drivers/acpi/processor_idle.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/processor_idle.c
> +++ linux-pm/drivers/acpi/processor_idle.c
> @@ -803,12 +803,12 @@ static int acpi_processor_setup_cstates(
>  		state->enter = acpi_idle_enter;
>  
>  		state->flags = 0;
> -		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
> -		    cx->type == ACPI_STATE_C3) {
> -			state->enter_dead = acpi_idle_play_dead;
> -			if (cx->type != ACPI_STATE_C3)
> -				drv->safe_state_index = count;
> -		}
> +
> +		state->enter_dead = acpi_idle_play_dead;
> +
> +		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2)
> +			drv->safe_state_index = count;
> +

Thanks!

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-15 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-14 17:47 [PATCH v1] ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states Rafael J. Wysocki
2024-11-15  3:22 ` Mario Limonciello
2024-11-15 10:18 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox