linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
@ 2021-09-22 13:31 Richard Gong
  2021-09-24 16:31 ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Gong @ 2021-09-22 13:31 UTC (permalink / raw)
  To: rafael, lenb
  Cc: linux-acpi, linux-kernel, lijo.lazar, Richard Gong, Mario Limonciello

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.

BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1708
Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Richard Gong <richard.gong@amd.com>
---
 drivers/acpi/processor_idle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f37fba9e5ba0..61d5a72d218e 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -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;
 		}
-- 
2.25.1


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

* Re: [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
  2021-09-22 13:31 [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state Richard Gong
@ 2021-09-24 16:31 ` Rafael J. Wysocki
  2021-09-28 13:00   ` Gong, Richard
  0 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2021-09-24 16:31 UTC (permalink / raw)
  To: Richard Gong
  Cc: Rafael J. Wysocki, Len Brown, ACPI Devel Maling List,
	Linux Kernel Mailing List, lijo.lazar, Mario Limonciello

On Wed, Sep 22, 2021 at 3:31 PM Richard Gong <richard.gong@amd.com> wrote:
>
> 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.
>
> BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1708
> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
> Signed-off-by: Richard Gong <richard.gong@amd.com>
> ---
>  drivers/acpi/processor_idle.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index f37fba9e5ba0..61d5a72d218e 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -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?

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

* Re: [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
  2021-09-24 16:31 ` Rafael J. Wysocki
@ 2021-09-28 13:00   ` Gong, Richard
  2021-09-28 13:48     ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: Gong, Richard @ 2021-09-28 13:00 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, ACPI Devel Maling List, Linux Kernel Mailing List,
	lijo.lazar, Mario Limonciello

Hi Rafael,

On 9/24/2021 11:31 AM, Rafael J. Wysocki wrote:
> On Wed, Sep 22, 2021 at 3:31 PM Richard Gong <richard.gong@amd.com> wrote:
>> 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.
>>
>> BugLink: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1708&amp;data=04%7C01%7Crichard.gong%40amd.com%7Ca5c0db9ce02b4cd0864f08d97f78d33f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637680980065602427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=dIO5PDjpncLFIt0aGaTrKJHYIkJm8A4YByGn1%2FsHrtM%3D&amp;reserved=0
>> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
>> Signed-off-by: Richard Gong <richard.gong@amd.com>
>> ---
>>   drivers/acpi/processor_idle.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
>> index f37fba9e5ba0..61d5a72d218e 100644
>> --- a/drivers/acpi/processor_idle.c
>> +++ b/drivers/acpi/processor_idle.c
>> @@ -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?

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

Regards,

Richard


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

* Re: [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
  2021-09-28 13:00   ` Gong, Richard
@ 2021-09-28 13:48     ` Rafael J. Wysocki
  2021-09-28 15:08       ` Lazar, Lijo
  0 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2021-09-28 13:48 UTC (permalink / raw)
  To: Gong, Richard
  Cc: Rafael J. Wysocki, Len Brown, ACPI Devel Maling List,
	Linux Kernel Mailing List, lijo.lazar, Mario Limonciello

On Tue, Sep 28, 2021 at 3:00 PM Gong, Richard <richard.gong@amd.com> wrote:
>
> Hi Rafael,
>
> On 9/24/2021 11:31 AM, Rafael J. Wysocki wrote:
> > On Wed, Sep 22, 2021 at 3:31 PM Richard Gong <richard.gong@amd.com> wrote:
> >> 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.
> >>
> >> BugLink: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1708&amp;data=04%7C01%7Crichard.gong%40amd.com%7Ca5c0db9ce02b4cd0864f08d97f78d33f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637680980065602427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=dIO5PDjpncLFIt0aGaTrKJHYIkJm8A4YByGn1%2FsHrtM%3D&amp;reserved=0
> >> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
> >> Signed-off-by: Richard Gong <richard.gong@amd.com>
> >> ---
> >>   drivers/acpi/processor_idle.c | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> >> index f37fba9e5ba0..61d5a72d218e 100644
> >> --- a/drivers/acpi/processor_idle.c
> >> +++ b/drivers/acpi/processor_idle.c
> >> @@ -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?
>
> 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?

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

* Re: [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
  2021-09-28 13:48     ` Rafael J. Wysocki
@ 2021-09-28 15:08       ` Lazar, Lijo
  2021-09-29  5:37         ` Lazar, Lijo
  0 siblings, 1 reply; 8+ messages in thread
From: Lazar, Lijo @ 2021-09-28 15:08 UTC (permalink / raw)
  To: Rafael J. Wysocki, Gong, Richard
  Cc: Len Brown, ACPI Devel Maling List, Linux Kernel Mailing List,
	Mario Limonciello



On 9/28/2021 7:18 PM, Rafael J. Wysocki wrote:
> On Tue, Sep 28, 2021 at 3:00 PM Gong, Richard <richard.gong@amd.com> wrote:
>>
>> Hi Rafael,
>>
>> On 9/24/2021 11:31 AM, Rafael J. Wysocki wrote:
>>> On Wed, Sep 22, 2021 at 3:31 PM Richard Gong <richard.gong@amd.com> wrote:
>>>> 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.
>>>>
>>>> BugLink: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1708&amp;data=04%7C01%7Clijo.lazar%40amd.com%7C44c85e9ae1dd4bec087e08d98286aa72%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637684337168161919%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Qoh%2BwD%2B1JzPYBc0rrGfNCdQWY1pKo8WBhLPmsmQ6G%2Bo%3D&amp;reserved=0
>>>> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
>>>> Signed-off-by: Richard Gong <richard.gong@amd.com>
>>>> ---
>>>>    drivers/acpi/processor_idle.c | 3 ++-
>>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
>>>> index f37fba9e5ba0..61d5a72d218e 100644
>>>> --- a/drivers/acpi/processor_idle.c
>>>> +++ b/drivers/acpi/processor_idle.c
>>>> @@ -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?
>>
>> 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

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

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

* Re: [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
  2021-09-28 15:08       ` Lazar, Lijo
@ 2021-09-29  5:37         ` Lazar, Lijo
  2021-09-29 14:09           ` Boris Ostrovsky
  0 siblings, 1 reply; 8+ messages in thread
From: Lazar, Lijo @ 2021-09-29  5:37 UTC (permalink / raw)
  To: Rafael J. Wysocki, boris.ostrovsky, Len Brown
  Cc: ACPI Devel Maling List, Linux Kernel Mailing List,
	Mario Limonciello, Gong, Richard



On 9/28/2021 8:38 PM, Lazar, Lijo wrote:
> 
> 
> On 9/28/2021 7:18 PM, Rafael J. Wysocki wrote:
>> On Tue, Sep 28, 2021 at 3:00 PM Gong, Richard <richard.gong@amd.com> 
>> wrote:
>>>
>>> Hi Rafael,
>>>
>>> On 9/24/2021 11:31 AM, Rafael J. Wysocki wrote:
>>>> On Wed, Sep 22, 2021 at 3:31 PM Richard Gong <richard.gong@amd.com> 
>>>> wrote:
>>>>> 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.
>>>>>
>>>>> BugLink: 
>>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1708&amp;data=04%7C01%7Clijo.lazar%40amd.com%7C44c85e9ae1dd4bec087e08d98286aa72%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637684337168161919%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Qoh%2BwD%2B1JzPYBc0rrGfNCdQWY1pKo8WBhLPmsmQ6G%2Bo%3D&amp;reserved=0 
>>>>>
>>>>> Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
>>>>> Signed-off-by: Richard Gong <richard.gong@amd.com>
>>>>> ---
>>>>>    drivers/acpi/processor_idle.c | 3 ++-
>>>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/acpi/processor_idle.c 
>>>>> b/drivers/acpi/processor_idle.c
>>>>> index f37fba9e5ba0..61d5a72d218e 100644
>>>>> --- a/drivers/acpi/processor_idle.c
>>>>> +++ b/drivers/acpi/processor_idle.c
>>>>> @@ -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?
>>>
>>> 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.
> 

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/7b8a7c2a-027f-16c9-0258-d91917c39bac@amd.com/T/#ma818870a8272a3755de896dd79d478cf944d1555

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

Thanks,
Lijo

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

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

* Re: [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
  2021-09-29  5:37         ` Lazar, Lijo
@ 2021-09-29 14:09           ` Boris Ostrovsky
  2021-09-29 14:45             ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: Boris Ostrovsky @ 2021-09-29 14:09 UTC (permalink / raw)
  To: Lazar, Lijo, Rafael J. Wysocki, Len Brown
  Cc: ACPI Devel Maling List, Linux Kernel Mailing List,
	Mario Limonciello, Gong, Richard


On 9/29/21 1:37 AM, Lazar, Lijo wrote:
>
>
>
> 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

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

* Re: [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state
  2021-09-29 14:09           ` Boris Ostrovsky
@ 2021-09-29 14:45             ` Rafael J. Wysocki
  0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2021-09-29 14:45 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Lazar, Lijo, Rafael J. Wysocki, Len Brown,
	ACPI Devel Maling List, Linux Kernel Mailing List,
	Mario Limonciello, Gong, Richard

On Wed, Sep 29, 2021 at 4:09 PM Boris Ostrovsky
<boris.ostrovsky@oracle.com> wrote:
>
>
> On 9/29/21 1:37 AM, Lazar, Lijo wrote:
> >
> >
> >
> > 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.

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

end of thread, other threads:[~2021-09-29 14:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 13:31 [PATCHv1] ACPI: processor idle: Allow playing dead in C3 state Richard Gong
2021-09-24 16:31 ` Rafael J. Wysocki
2021-09-28 13:00   ` Gong, Richard
2021-09-28 13:48     ` Rafael J. Wysocki
2021-09-28 15:08       ` Lazar, Lijo
2021-09-29  5:37         ` Lazar, Lijo
2021-09-29 14:09           ` Boris Ostrovsky
2021-09-29 14:45             ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).