Skip to contentSkip to conversation

ACPI: processor idle: Allow playing dead in C3 state

PATCH In review Richard Gong 4 participants 8 messages Sep 22, 2021 – Sep 29, 2021 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: processor idle: Allow playing dead in C3 state

When some cores are disabled on AMD platforms, the system will no longer be able to enter suspend-to-idle s0ix.

Update to allow playing dead in C3 state so that the CPUs can enter the deepest state on AMD platforms.

---
 drivers/acpi/processor_idle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/processor_idle.c +2 -1
index f37fba9e5ba0..61d5a72d218e 100644
@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
 		state->enter = acpi_idle_enter;
 
 		state->flags = 0;
-		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) {
+		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2
+			|| cx->type == ACPI_STATE_C3) {
 			state->enter_dead = acpi_idle_play_dead;
 			drv->safe_state_index = count;
 		}
Signature · 1 line
2.25.1
#1 lore raw
Quoted 19 lines · Richard Gong

When some cores are disabled on AMD platforms, the system will no longer be able to enter suspend-to-idle s0ix.

Update to allow playing dead in C3 state so that the CPUs can enter the deepest state on AMD platforms.

---
 drivers/acpi/processor_idle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/processor_idle.c +0 -0
index f37fba9e5ba0..61d5a72d218e 100644

drivers/acpi/processor_idle.c static int acpi_processor_setup_cstates(struct acpi_processor *pr)

Quoted 10 lines
drivers/acpi/processor_idle.c +2 -2
@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
                state->enter = acpi_idle_enter;
 
                state->flags = 0;
-               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) {
+               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2
+                       || cx->type == ACPI_STATE_C3) {
                        state->enter_dead = acpi_idle_play_dead;
                        drv->safe_state_index = count;
                }
--

Tentatively applied as 5.16 material, but have you done any research on why this restriction has been there in the first place?

#2 lore raw

Hi Rafael,

Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Richard Gong

When some cores are disabled on AMD platforms, the system will no longer be able to enter suspend-to-idle s0ix.

Update to allow playing dead in C3 state so that the CPUs can enter the deepest state on AMD platforms.

---
  drivers/acpi/processor_idle.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/processor_idle.c +0 -0
index f37fba9e5ba0..61d5a72d218e 100644
@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
                 state->enter = acpi_idle_enter;
 
Quoted 10 lines

drivers/acpi/processor_idle.c static int acpi_processor_setup_cstates(struct acpi_processor *pr)

Quoted 8 lines
drivers/acpi/processor_idle.c +2 -2
                 state->flags = 0;
-               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) {
+               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2
+                       || cx->type == ACPI_STATE_C3) {
                         state->enter_dead = acpi_idle_play_dead;
                         drv->safe_state_index = count;
                 }
--

Tentatively applied as 5.16 material, but have you done any research on why this restriction has been there in the first place?

Yes, we need this change to align with the updated firmware on AMD platforms.

Regards,

Richard

#3 lore raw
Quoted 36 lines · Richard

Hi Rafael,

Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Richard Gong

When some cores are disabled on AMD platforms, the system will no longer be able to enter suspend-to-idle s0ix.

Update to allow playing dead in C3 state so that the CPUs can enter the deepest state on AMD platforms.

---
  drivers/acpi/processor_idle.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/processor_idle.c +0 -0
index f37fba9e5ba0..61d5a72d218e 100644
@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
                 state->enter = acpi_idle_enter;
 
Quoted 10 lines

drivers/acpi/processor_idle.c static int acpi_processor_setup_cstates(struct acpi_processor *pr)

Quoted 8 lines
drivers/acpi/processor_idle.c +2 -2
                 state->flags = 0;
-               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) {
+               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2
+                       || cx->type == ACPI_STATE_C3) {
                         state->enter_dead = acpi_idle_play_dead;
                         drv->safe_state_index = count;
                 }
--

Tentatively applied as 5.16 material, but have you done any research on why this restriction has been there in the first place?

Quoted 2 lines

Yes, we need this change to align with the updated firmware on AMD platforms.

Well, it wouldn't be necessary to change the code otherwise.

Still, without the patch it is not allowed to play dead in deep idle states (C3 type) and do you know why?

Or IOW how likely is this change to break anything on legacy platforms?

#4 lore raw
Quoted 37 lines · Rafael J. Wysocki
Quoted 36 lines · Richard

Hi Rafael,

Quoted 31 lines · Rafael J. Wysocki
Quoted 18 lines · Richard Gong

When some cores are disabled on AMD platforms, the system will no longer be able to enter suspend-to-idle s0ix.

Update to allow playing dead in C3 state so that the CPUs can enter the deepest state on AMD platforms.

---
   drivers/acpi/processor_idle.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/processor_idle.c +0 -0
index f37fba9e5ba0..61d5a72d218e 100644

drivers/acpi/processor_idle.c static int acpi_processor_setup_cstates(struct acpi_processor *pr)

Quoted 10 lines
drivers/acpi/processor_idle.c +2 -2
@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
                  state->enter = acpi_idle_enter;
 
                  state->flags = 0;
-               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) {
+               if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2
+                       || cx->type == ACPI_STATE_C3) {
                          state->enter_dead = acpi_idle_play_dead;
                          drv->safe_state_index = count;
                  }
--

Tentatively applied as 5.16 material, but have you done any research on why this restriction has been there in the first place?

Quoted 8 lines
Quoted 2 lines

Yes, we need this change to align with the updated firmware on AMD platforms.

Well, it wouldn't be necessary to change the code otherwise.

Still, without the patch it is not allowed to play dead in deep idle states (C3 type) and do you know why?

Found the original patch thread, unfortunately there is no discussion on why C3 was skipped or not allowed - https://www.spinics.net/lists/linux-pm/msg27003.html

Maybe, Intel CPU offlining worked through MWAITs and AMD bothered only till C2.

Thanks,
Lijo

Quoted 2 lines

Or IOW how likely is this change to break anything on legacy platforms?

#5 lore raw
Quoted 49 lines · Lijo
Quoted 46 lines · Rafael J. Wysocki
Quoted 40 lines · Richard

Hi Rafael,

Quoted 23 lines · Rafael J. Wysocki
Quoted 22 lines · Richard Gong

When some cores are disabled on AMD platforms, the system will no longer be able to enter suspend-to-idle s0ix.

Update to allow playing dead in C3 state so that the CPUs can enter the deepest state on AMD platforms.

---
   drivers/acpi/processor_idle.c | 3 ++-

   1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/processor_idle.c +0 -0
index f37fba9e5ba0..61d5a72d218e 100644
@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct 
 acpi_processor *pr)
                   state->enter = acpi_idle_enter;
 
Quoted 12 lines
Quoted 10 lines
drivers/acpi/processor_idle.c +1 -1
                   state->flags = 0;
-               if (cx->type == ACPI_STATE_C1 || cx->type == 
 ACPI_STATE_C2) {
+               if (cx->type == ACPI_STATE_C1 || cx->type == 

ACPI_STATE_C2
+                       || cx->type == ACPI_STATE_C3) { state->enter_dead = acpi_idle_play_dead; drv->safe_state_index = count; }

Tentatively applied as 5.16 material, but have you done any research on why this restriction has been there in the first place?

Quoted 2 lines

Yes, we need this change to align with the updated firmware on AMD platforms.

Well, it wouldn't be necessary to change the code otherwise.

Quoted 8 lines
Quoted 3 lines

Still, without the patch it is not allowed to play dead in deep idle states (C3 type) and do you know why?

Found the original patch thread, unfortunately there is no discussion on why C3 was skipped or not allowed - https://www.spinics.net/lists/linux-pm/msg27003.html

Maybe, Intel CPU offlining worked through MWAITs and AMD bothered only till C2.

Hi Boris/Len,

Apologies to barge in. This is regarding the patch you added years back - https://www.spinics.net/lists/linux-pm/msg27003.html

Do you recall why C3 was not considered for offline/play dead scenarios in the original patch?

For newer AMD processors, power management controller expects all cores to request C3 as a precondition for s2idle. When cores are offlined, they request only C2 and that prevents s2idle in such cases.

This new patch series is to consider C3 also for offline purpose.

https://lore.kernel.org/linux-acpi/[email protected]/T/#ma818870a8272a3755de896dd79d478cf944d1555

Please take a look and also at the questions from Rafael.

Thanks,
Lijo

Quoted 2 lines
Quoted 2 lines

Or IOW how likely is this change to break anything on legacy platforms?

#6 lore raw
Quoted 6 lines · Lijo

Apologies to barge in. This is regarding the patch you added years back - https://www.spinics.net/lists/linux-pm/msg27003.html

Do you recall why C3 was not considered for offline/play dead scenarios in the original patch?

Not really. Perhaps processors from that time (at least AMD ones) did not support C3?

-boris

#7 lore raw
Quoted 6 lines · Boris Ostrovsky
Quoted 3 lines · Lijo
Quoted 6 lines
Quoted 3 lines

Apologies to barge in. This is regarding the patch you added years back - https://www.spinics.net/lists/linux-pm/msg27003.html

Do you recall why C3 was not considered for offline/play dead scenarios in the original patch?

Not really. Perhaps processors from that time (at least AMD ones) did not support C3?

OK, thanks!

I guess the only way to find out is to try it and see then.