platform/x86/amd: Stop counting intermediate cycles with metrics table
Subsystems (3)
PATCH 1/1 platform/x86/amd: Stop counting intermediate cycles with metrics table
The metrics table doesn't increment for all cases that can cause an intermediate wakeup if the cycle is very fast. This can make the intent from commit 9f5595d5f03fd ("platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles") not work properly.
That commit originally was measured to work properly, but it was accidental due to a logic error. The logic error was fixed in commit 4dbd11796f3a8 ("platform/x86/amd: pmc: Clear metrics table at start of cycle") but this now masked the table doesn't always update.
Since that code was introduced, Daniel Gibson added a number of changes to the logic which includes a state variable introduced in commit 037f0b03c663a ("platform/x86/amd/pmc: Don't log during intermediate wakeups").
Utilize that state variable to instead decide if a single sequence has started.
--- drivers/platform/x86/amd/pmc/pmc.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/platform/x86/amd/pmc/pmc.c +1 -14
@@ -701,19 +701,6 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)return rc; } -static bool amd_pmc_intermediate_wakeup_need_delay (struct amd_pmc_dev *pdev) -{ -/* -* Starting a new HW sleep cycle right after waking from one -* can cause electrical problems triggering the over voltage protection. -* That is avoided by delaying the next suspend a bit, see also -* https://lore.kernel.org/all/[email protected]/ -*/ -struct smu_metrics table; - -return get_metrics_table (pdev, &table) ==0 && table.s0i3_last_entry_status; -} -static bool amd_pmc_want_suspend_delay (struct amd_pmc_dev *pdev) {/*
@@ -804,7 +791,7 @@ static void amd_pmc_s2idle_check(void)struct amd_pmc_dev *pdev = &pmc;int rc; -if (amd_pmc_intermediate_wakeup_need_delay (pdev) || +if (!pdev->is_first_check_after_suspend ||amd_pmc_want_suspend_delay (pdev))msleep (2500 );
Signature · 1 line
2.43.0
Quoted 10 lines · Mario Limonciello
The metrics table doesn't increment for all cases that can cause an intermediate wakeup if the cycle is very fast. This can make the intent from commit
9f5595d5f03fd("platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles") not work properly.That commit originally was measured to work properly, but it was accidental due to a logic error. The logic error was fixed in commit
4dbd11796f3a8("platform/x86/amd: pmc: Clear metrics table at start of cycle") but this now masked the table doesn't always update.
Quoted 7 lines
Since that code was introduced, Daniel Gibson added a number of changes to the logic which includes a state variable introduced in commit
037f0b03c663a("platform/x86/amd/pmc: Don't log during intermediate wakeups").Utilize that state variable to instead decide if a single sequence has started.
This patch fixes my resume issue with TB4 dock.
Thanks.
Quoted 46 lines
Cc Daniel Gibson <[email protected]>Cc [email protected] # 7.1.y: 037f0b03c663a platform/x86/amd/pmc: Don't log during intermediate wakeupsCc [email protected] # 6.18.y: 037f0b03c663a platform/x86/amd/pmc: Don't log during intermediate wakeupsFixes 4dbd11796f3a8 ("platform/x86/amd: pmc: Clear metrics table at start of cycle")Signed-off-by Mario Limonciello <[email protected]>--- drivers/platform/x86/amd/pmc/pmc.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)drivers/platform/x86/amd/pmc/pmc.c +1
-15@@ -701,19 +701,6 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)return rc; } -static bool amd_pmc_intermediate_wakeup_need_delay (struct amd_pmc_dev *pdev) -{ -/* -* Starting a new HW sleep cycle right after waking from one -* can cause electrical problems triggering the over voltage protection. -* That is avoided by delaying the next suspend a bit, see also -* https://lore.kernel.org/all/[email protected]/ -*/ -struct smu_metrics table; - -return get_metrics_table (pdev, &table) ==0 && table.s0i3_last_entry_status; -} -static bool amd_pmc_want_suspend_delay (struct amd_pmc_dev *pdev) {/* @@ -804,7 +791,7 @@ static void amd_pmc_s2idle_check(void)struct amd_pmc_dev *pdev = &pmc;int rc; -if (amd_pmc_intermediate_wakeup_need_delay (pdev) || +if (!pdev->is_first_check_after_suspend ||amd_pmc_want_suspend_delay (pdev))msleep (2500 ); --2.43.0
Ilpo Järvinen
maintainerQuoted 11 lines · Mario Limonciello
The metrics table doesn't increment for all cases that can cause an intermediate wakeup if the cycle is very fast. This can make the intent from commit
9f5595d5f03fd("platform/x86/amd: pmc: Require at least 2.5 seconds between HW sleep cycles") not work properly.That commit originally was measured to work properly, but it was accidental due to a logic error. The logic error was fixed in commit
4dbd11796f3a8("platform/x86/amd: pmc: Clear metrics table at start of cycle") but this now masked the table doesn't always update.[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.
The list of commits applied:
[1/1] platform/x86/amd: Stop counting intermediate cycles with metrics table
commit: 9d45679a02f5e434ec48b27f671e22243a5c99cc
--
i.