diff mbox series

[1/1] amd-pmu: fix s2idle failures on certain AMD laptops

Message ID CADtzkx7TdfbwtaVEXUdD6YXPey52E-nZVQNs+Z41DTx7gqMqtw@mail.gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/1] amd-pmu: fix s2idle failures on certain AMD laptops | expand

Commit Message

Fabrizio Bertocci Nov. 30, 2021, 4:15 a.m. UTC
On some AMD hardware laptops, the system fails communicating with the
PMU when entering s2idle and the machine is battery powered.

Hardware description: HP Pavilion Aero Laptop 13-be0097nr
CPU: AMD Ryzen 7 5800U with Radeon Graphics
GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
Inc. [AMD/ATI] Device [1002:1638] (rev c1)

Detailed description of the problem (and investigation) here:
https://gitlab.freedesktop.org/drm/amd/-/issues/1799

Patch is a single line: reduce the polling delay in half, from 100uSec
to 50uSec when waiting for a change in state from the PMC after a
write command operation.

Tested on kernel tree detached at tag 5.14
(7d2a07b769330c34b4deabeed939325c77a7ec2f)
After changing the delay, I did not see a single failure on this
machine (I have this fix for now more than one week and s2idle worked
every single time on battery power).

Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>
---
---

Comments

Hans de Goede Nov. 30, 2021, 11:27 a.m. UTC | #1
Hi,

On 11/30/21 05:15, Fabrizio Bertocci wrote:
> On some AMD hardware laptops, the system fails communicating with the
> PMU when entering s2idle and the machine is battery powered.
> 
> Hardware description: HP Pavilion Aero Laptop 13-be0097nr
> CPU: AMD Ryzen 7 5800U with Radeon Graphics
> GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
> Inc. [AMD/ATI] Device [1002:1638] (rev c1)
> 
> Detailed description of the problem (and investigation) here:
> https://gitlab.freedesktop.org/drm/amd/-/issues/1799
> 
> Patch is a single line: reduce the polling delay in half, from 100uSec
> to 50uSec when waiting for a change in state from the PMC after a
> write command operation.
> 
> Tested on kernel tree detached at tag 5.14
> (7d2a07b769330c34b4deabeed939325c77a7ec2f)
> After changing the delay, I did not see a single failure on this
> machine (I have this fix for now more than one week and s2idle worked
> every single time on battery power).
> 
> Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>

Thank you for your patch. I've added a couple of AMD developers who
work on this driver to the Cc.

AMD folks, can you review/ack this patch please?

Regards,

Hans

> ---
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
> index b7e50ed050a8..841c44cd64c2 100644
> --- a/drivers/platform/x86/amd-pmc.c
> +++ b/drivers/platform/x86/amd-pmc.c
> @@ -76,7 +76,7 @@
>  #define AMD_CPU_ID_CZN                 AMD_CPU_ID_RN
>  #define AMD_CPU_ID_YC                  0x14B5
> 
> -#define PMC_MSG_DELAY_MIN_US           100
> +#define PMC_MSG_DELAY_MIN_US           50
>  #define RESPONSE_REGISTER_LOOP_MAX     20000
> 
>  #define SOC_SUBSYSTEM_IP_MAX   12
> ---
>
Shyam Sundar S K Nov. 30, 2021, 12:29 p.m. UTC | #2
On 11/30/2021 4:57 PM, Hans de Goede wrote:
> Hi,
> 
> On 11/30/21 05:15, Fabrizio Bertocci wrote:
>> On some AMD hardware laptops, the system fails communicating with the
>> PMU when entering s2idle and the machine is battery powered.
>>
>> Hardware description: HP Pavilion Aero Laptop 13-be0097nr
>> CPU: AMD Ryzen 7 5800U with Radeon Graphics
>> GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
>> Inc. [AMD/ATI] Device [1002:1638] (rev c1)
>>
>> Detailed description of the problem (and investigation) here:
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1799&amp;data=04%7C01%7Cshyam-sundar.s-k%40amd.com%7Ce8ed4219951f4df1dbe708d9b3f4761c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637738684806355205%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=EwYxPgELsgQ2YpNQROFyptvt2Z0jQ0Yso8wptp6Dz4g%3D&amp;reserved=0
>>
>> Patch is a single line: reduce the polling delay in half, from 100uSec
>> to 50uSec when waiting for a change in state from the PMC after a
>> write command operation.
>>
>> Tested on kernel tree detached at tag 5.14
>> (7d2a07b769330c34b4deabeed939325c77a7ec2f)
>> After changing the delay, I did not see a single failure on this
>> machine (I have this fix for now more than one week and s2idle worked
>> every single time on battery power).
>>
>> Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>
> 
> Thank you for your patch. I've added a couple of AMD developers who
> work on this driver to the Cc.
> 
> AMD folks, can you review/ack this patch please?

Looks good to me.

Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Thanks,
Shyam
Mario Limonciello Nov. 30, 2021, 2:04 p.m. UTC | #3
On 11/30/2021 06:29, Shyam Sundar S K wrote:
> 
> 
> On 11/30/2021 4:57 PM, Hans de Goede wrote:
>> Hi,
>>
>> On 11/30/21 05:15, Fabrizio Bertocci wrote:
>>> On some AMD hardware laptops, the system fails communicating with the
>>> PMU when entering s2idle and the machine is battery powered.
>>>
>>> Hardware description: HP Pavilion Aero Laptop 13-be0097nr
>>> CPU: AMD Ryzen 7 5800U with Radeon Graphics
>>> GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
>>> Inc. [AMD/ATI] Device [1002:1638] (rev c1)
>>>
>>> Detailed description of the problem (and investigation) here:
>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1799&amp;data=04%7C01%7Cshyam-sundar.s-k%40amd.com%7Ce8ed4219951f4df1dbe708d9b3f4761c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637738684806355205%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=EwYxPgELsgQ2YpNQROFyptvt2Z0jQ0Yso8wptp6Dz4g%3D&amp;reserved=0
>>>
>>> Patch is a single line: reduce the polling delay in half, from 100uSec
>>> to 50uSec when waiting for a change in state from the PMC after a
>>> write command operation.
>>>
>>> Tested on kernel tree detached at tag 5.14
>>> (7d2a07b769330c34b4deabeed939325c77a7ec2f)
>>> After changing the delay, I did not see a single failure on this
>>> machine (I have this fix for now more than one week and s2idle worked
>>> every single time on battery power).
>>>
>>> Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>
>>
>> Thank you for your patch. I've added a couple of AMD developers who
>> work on this driver to the Cc.
>>
>> AMD folks, can you review/ack this patch please?
> 
> Looks good to me.
> 
> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> 
> Thanks,
> Shyam
> 

Fabrizio,

Thanks!

Hans,

Can you please add Cc: stable@vger.kernel.org when you commit this?
Shyam Sundar S K Nov. 30, 2021, 3:42 p.m. UTC | #4
On 11/30/2021 7:34 PM, Limonciello, Mario wrote:
> On 11/30/2021 06:29, Shyam Sundar S K wrote:
>>
>>
>> On 11/30/2021 4:57 PM, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 11/30/21 05:15, Fabrizio Bertocci wrote:
>>>> On some AMD hardware laptops, the system fails communicating with the
>>>> PMU when entering s2idle and the machine is battery powered.
>>>>
>>>> Hardware description: HP Pavilion Aero Laptop 13-be0097nr
>>>> CPU: AMD Ryzen 7 5800U with Radeon Graphics
>>>> GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
>>>> Inc. [AMD/ATI] Device [1002:1638] (rev c1)
>>>>
>>>> Detailed description of the problem (and investigation) here:
>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1799&amp;data=04%7C01%7Cshyam-sundar.s-k%40amd.com%7Ce8ed4219951f4df1dbe708d9b3f4761c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637738684806355205%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=EwYxPgELsgQ2YpNQROFyptvt2Z0jQ0Yso8wptp6Dz4g%3D&amp;reserved=0
>>>>
>>>>
>>>> Patch is a single line: reduce the polling delay in half, from 100uSec
>>>> to 50uSec when waiting for a change in state from the PMC after a
>>>> write command operation.
>>>>
>>>> Tested on kernel tree detached at tag 5.14
>>>> (7d2a07b769330c34b4deabeed939325c77a7ec2f)
>>>> After changing the delay, I did not see a single failure on this
>>>> machine (I have this fix for now more than one week and s2idle worked
>>>> every single time on battery power).
>>>>
>>>> Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>
>>>
>>> Thank you for your patch. I've added a couple of AMD developers who
>>> work on this driver to the Cc.
>>>
>>> AMD folks, can you review/ack this patch please?
>>
>> Looks good to me.
>>
>> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>>
>> Thanks,
>> Shyam
>>
> 
> Fabrizio,
> 
> Thanks!
> 
> Hans,
> 
> Can you please add Cc: stable@vger.kernel.org when you commit this?

Also, please help on the subject-line correction, from
amd-pmu to amd-pmc.

Thanks,
Shyam
Hans de Goede Nov. 30, 2021, 3:46 p.m. UTC | #5
Hi,

On 11/30/21 05:15, Fabrizio Bertocci wrote:
> On some AMD hardware laptops, the system fails communicating with the
> PMU when entering s2idle and the machine is battery powered.
> 
> Hardware description: HP Pavilion Aero Laptop 13-be0097nr
> CPU: AMD Ryzen 7 5800U with Radeon Graphics
> GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
> Inc. [AMD/ATI] Device [1002:1638] (rev c1)
> 
> Detailed description of the problem (and investigation) here:
> https://gitlab.freedesktop.org/drm/amd/-/issues/1799
> 
> Patch is a single line: reduce the polling delay in half, from 100uSec
> to 50uSec when waiting for a change in state from the PMC after a
> write command operation.
> 
> Tested on kernel tree detached at tag 5.14
> (7d2a07b769330c34b4deabeed939325c77a7ec2f)
> After changing the delay, I did not see a single failure on this
> machine (I have this fix for now more than one week and s2idle worked
> every single time on battery power).
> 
> Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans

> ---
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
> index b7e50ed050a8..841c44cd64c2 100644
> --- a/drivers/platform/x86/amd-pmc.c
> +++ b/drivers/platform/x86/amd-pmc.c
> @@ -76,7 +76,7 @@
>  #define AMD_CPU_ID_CZN                 AMD_CPU_ID_RN
>  #define AMD_CPU_ID_YC                  0x14B5
> 
> -#define PMC_MSG_DELAY_MIN_US           100
> +#define PMC_MSG_DELAY_MIN_US           50
>  #define RESPONSE_REGISTER_LOOP_MAX     20000
> 
>  #define SOC_SUBSYSTEM_IP_MAX   12
> ---
>
Hans de Goede Nov. 30, 2021, 3:47 p.m. UTC | #6
Hi,

On 11/30/21 16:42, Shyam Sundar S K wrote:
> 
> 
> On 11/30/2021 7:34 PM, Limonciello, Mario wrote:
>> On 11/30/2021 06:29, Shyam Sundar S K wrote:
>>>
>>>
>>> On 11/30/2021 4:57 PM, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 11/30/21 05:15, Fabrizio Bertocci wrote:
>>>>> On some AMD hardware laptops, the system fails communicating with the
>>>>> PMU when entering s2idle and the machine is battery powered.
>>>>>
>>>>> Hardware description: HP Pavilion Aero Laptop 13-be0097nr
>>>>> CPU: AMD Ryzen 7 5800U with Radeon Graphics
>>>>> GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
>>>>> Inc. [AMD/ATI] Device [1002:1638] (rev c1)
>>>>>
>>>>> Detailed description of the problem (and investigation) here:
>>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1799&amp;data=04%7C01%7Cshyam-sundar.s-k%40amd.com%7Ce8ed4219951f4df1dbe708d9b3f4761c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637738684806355205%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=EwYxPgELsgQ2YpNQROFyptvt2Z0jQ0Yso8wptp6Dz4g%3D&amp;reserved=0
>>>>>
>>>>>
>>>>> Patch is a single line: reduce the polling delay in half, from 100uSec
>>>>> to 50uSec when waiting for a change in state from the PMC after a
>>>>> write command operation.
>>>>>
>>>>> Tested on kernel tree detached at tag 5.14
>>>>> (7d2a07b769330c34b4deabeed939325c77a7ec2f)
>>>>> After changing the delay, I did not see a single failure on this
>>>>> machine (I have this fix for now more than one week and s2idle worked
>>>>> every single time on battery power).
>>>>>
>>>>> Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>
>>>>
>>>> Thank you for your patch. I've added a couple of AMD developers who
>>>> work on this driver to the Cc.
>>>>
>>>> AMD folks, can you review/ack this patch please?
>>>
>>> Looks good to me.
>>>
>>> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>>>
>>> Thanks,
>>> Shyam
>>>
>>
>> Fabrizio,
>>
>> Thanks!
>>
>> Hans,
>>
>> Can you please add Cc: stable@vger.kernel.org when you commit this?
> 
> Also, please help on the subject-line correction, from
> amd-pmu to amd-pmc.

Good point, I've added the Cc: stable and also fixed the Subject.

I will also include this patch in my next fixes pull-req for 5.16.

Regards,

Hans
Fabrizio Bertocci Nov. 30, 2021, 4:14 p.m. UTC | #7
Awesome. Thank you all.
I am looking forward to the 5.16 release.
Regards,
Fabrizio

On Tue, Nov 30, 2021 at 10:47 AM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 11/30/21 16:42, Shyam Sundar S K wrote:
> >
> >
> > On 11/30/2021 7:34 PM, Limonciello, Mario wrote:
> >> On 11/30/2021 06:29, Shyam Sundar S K wrote:
> >>>
> >>>
> >>> On 11/30/2021 4:57 PM, Hans de Goede wrote:
> >>>> Hi,
> >>>>
> >>>> On 11/30/21 05:15, Fabrizio Bertocci wrote:
> >>>>> On some AMD hardware laptops, the system fails communicating with the
> >>>>> PMU when entering s2idle and the machine is battery powered.
> >>>>>
> >>>>> Hardware description: HP Pavilion Aero Laptop 13-be0097nr
> >>>>> CPU: AMD Ryzen 7 5800U with Radeon Graphics
> >>>>> GPU: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
> >>>>> Inc. [AMD/ATI] Device [1002:1638] (rev c1)
> >>>>>
> >>>>> Detailed description of the problem (and investigation) here:
> >>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1799&amp;data=04%7C01%7Cshyam-sundar.s-k%40amd.com%7Ce8ed4219951f4df1dbe708d9b3f4761c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637738684806355205%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=EwYxPgELsgQ2YpNQROFyptvt2Z0jQ0Yso8wptp6Dz4g%3D&amp;reserved=0
> >>>>>
> >>>>>
> >>>>> Patch is a single line: reduce the polling delay in half, from 100uSec
> >>>>> to 50uSec when waiting for a change in state from the PMC after a
> >>>>> write command operation.
> >>>>>
> >>>>> Tested on kernel tree detached at tag 5.14
> >>>>> (7d2a07b769330c34b4deabeed939325c77a7ec2f)
> >>>>> After changing the delay, I did not see a single failure on this
> >>>>> machine (I have this fix for now more than one week and s2idle worked
> >>>>> every single time on battery power).
> >>>>>
> >>>>> Signed-off-by: Fabrizio Bertocci <fabriziobertocci@gmail.com>
> >>>>
> >>>> Thank you for your patch. I've added a couple of AMD developers who
> >>>> work on this driver to the Cc.
> >>>>
> >>>> AMD folks, can you review/ack this patch please?
> >>>
> >>> Looks good to me.
> >>>
> >>> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> >>>
> >>> Thanks,
> >>> Shyam
> >>>
> >>
> >> Fabrizio,
> >>
> >> Thanks!
> >>
> >> Hans,
> >>
> >> Can you please add Cc: stable@vger.kernel.org when you commit this?
> >
> > Also, please help on the subject-line correction, from
> > amd-pmu to amd-pmc.
>
> Good point, I've added the Cc: stable and also fixed the Subject.
>
> I will also include this patch in my next fixes pull-req for 5.16.
>
> Regards,
>
> Hans
>
diff mbox series

Patch

diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
index b7e50ed050a8..841c44cd64c2 100644
--- a/drivers/platform/x86/amd-pmc.c
+++ b/drivers/platform/x86/amd-pmc.c
@@ -76,7 +76,7 @@ 
 #define AMD_CPU_ID_CZN                 AMD_CPU_ID_RN
 #define AMD_CPU_ID_YC                  0x14B5

-#define PMC_MSG_DELAY_MIN_US           100
+#define PMC_MSG_DELAY_MIN_US           50
 #define RESPONSE_REGISTER_LOOP_MAX     20000

 #define SOC_SUBSYSTEM_IP_MAX   12