Skip to contentSkip to conversation

platform/x86/amd/pmf: Fix a suspend hang on Framework 13

PATCH In review Mario Limonciello 4 participants 5 messages Feb 17, 2024 – Feb 19, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86/amd/pmf: Fix a suspend hang on Framework 13

The buffer is cleared in the suspend handler but used in the delayed work for amd_pmf_get_metrics().

Stop clearing it to fix the hang.

---
 drivers/platform/x86/amd/pmf/core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/platform/x86/amd/pmf/core.c +0 -2
index 853158933510..4f734e049f4a 100644
@@ -299,8 +299,6 @@ static int amd_pmf_suspend_handler(struct device *dev)
 	if (pdev->smart_pc_enabled)
 		cancel_delayed_work_sync(&pdev->pb_work);
 
-	kfree(pdev->buf);
-
 	return 0;
 }
 
Signature · 1 line
2.34.1
#1 lore raw

As the reporter of that issue, I confirm that this fixes suspend and resume for me as well. I've applied the patch on top of 6.8-rc4. Thanks for getting to the bottom of it so quickly.

Quoted 27 lines · Mario Limonciello

The buffer is cleared in the suspend handler but used in the delayed work for amd_pmf_get_metrics().

Stop clearing it to fix the hang.

---
  drivers/platform/x86/amd/pmf/core.c | 2 --
  1 file changed, 2 deletions(-)
drivers/platform/x86/amd/pmf/core.c +0 -2
index 853158933510..4f734e049f4a 100644
@@ -299,8 +299,6 @@ static int amd_pmf_suspend_handler(struct device *dev)
  	if (pdev->smart_pc_enabled)
  		cancel_delayed_work_sync(&pdev->pb_work);
 
-	kfree(pdev->buf);
-
  	return 0;
  }
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Mario Limonciello

Hi,

Quoted 10 lines · Mario Limonciello

The buffer is cleared in the suspend handler but used in the delayed work for amd_pmf_get_metrics().

Stop clearing it to fix the hang.

Ugh, I should have caught this during review. I especially asked for the alloc parameter to amd_pmf_set_dram_addr() to be added for this. Ah well ...

Thanks, patch looks good to me:

Regards,

Hans

Quoted 17 lines
---
 drivers/platform/x86/amd/pmf/core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/platform/x86/amd/pmf/core.c +0 -2
index 853158933510..4f734e049f4a 100644
@@ -299,8 +299,6 @@ static int amd_pmf_suspend_handler(struct device *dev)
 	if (pdev->smart_pc_enabled)
 		cancel_delayed_work_sync(&pdev->pb_work);
 
-	kfree(pdev->buf);
-
 	return 0;
 }
 
maintainer
#3 lore raw

Hi Mario,

This was super quick! Thank you for the help. Seems like lot of action happened over the weekend :-)

Hi Hans,

Quoted 14 lines · Hans de Goede

Hi,

Quoted 10 lines · Mario Limonciello

The buffer is cleared in the suspend handler but used in the delayed work for amd_pmf_get_metrics().

Stop clearing it to fix the hang.

Quoted 5 lines

Ugh, I should have caught this during review. I especially asked for the alloc parameter to amd_pmf_set_dram_addr() to be added for this. Ah well ...

Thanks, patch looks good to me:

Thank you for the support!

Thanks,
Shyam

Quoted 27 lines

Regards,

Hans

Quoted 17 lines
---
 drivers/platform/x86/amd/pmf/core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/platform/x86/amd/pmf/core.c +0 -2
index 853158933510..4f734e049f4a 100644
@@ -299,8 +299,6 @@ static int amd_pmf_suspend_handler(struct device *dev)
 	if (pdev->smart_pc_enabled)
 		cancel_delayed_work_sync(&pdev->pb_work);
 
-	kfree(pdev->buf);
-
 	return 0;
 }
 
#4 lore raw
In reply to Mario Limonciello

Hi,

Quoted 10 lines · Mario Limonciello

The buffer is cleared in the suspend handler but used in the delayed work for amd_pmf_get_metrics().

Stop clearing it to fix the hang.

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.

I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle.

Regards,

Hans

Quoted 17 lines
---
 drivers/platform/x86/amd/pmf/core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/platform/x86/amd/pmf/core.c +0 -2
index 853158933510..4f734e049f4a 100644
@@ -299,8 +299,6 @@ static int amd_pmf_suspend_handler(struct device *dev)
 	if (pdev->smart_pc_enabled)
 		cancel_delayed_work_sync(&pdev->pb_work);
 
-	kfree(pdev->buf);
-
 	return 0;
 }