[RFC,v2,3/3] platform/x86/intel/pmc: core: Report duration of time in HW sleep state

Message ID 20221110064723.8882-4-mario.limonciello@amd.com
State New
Headers
Series Introduce infrastructure to report time in hardware sleep state |

Commit Message

Mario Limonciello Nov. 10, 2022, 6:47 a.m. UTC
  intel_pmc_core displays a warning when a suspend didn't get to a HW
sleep state.

This information is generally useful to userspace as well which may use
it to collect further debugging data. Report this to the standard kernel
reporting infrastructure that can be accessed from sysfs.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/platform/x86/intel/pmc/core.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Thomas Gleixner Nov. 13, 2022, 11:57 p.m. UTC | #1
On Thu, Nov 10 2022 at 00:47, Mario Limonciello wrote:
> intel_pmc_core displays a warning when a suspend didn't get to a HW
> sleep state.

Where? Copy and paste is wonderful...
  
Mario Limonciello Nov. 14, 2022, 7:06 p.m. UTC | #2
[Public]



> -----Original Message-----
> From: Thomas Gleixner <tglx@linutronix.de>
> Sent: Sunday, November 13, 2022 17:57
> To: Limonciello, Mario <Mario.Limonciello@amd.com>; Sven van Ashbrook
> <svenva@chromium.org>; Rafael J Wysocki <rafael@kernel.org>; linux-
> pm@vger.kernel.org; platform-driver-x86@vger.kernel.org; Rajneesh
> Bhardwaj <irenic.rajneesh@gmail.com>; David E Box
> <david.e.box@intel.com>
> Cc: S-k, Shyam-sundar <Shyam-sundar.S-k@amd.com>;
> rrangel@chromium.org; Rajat Jain <rajatja@google.com>; Hans de Goede
> <hdegoede@redhat.com>; linux-kernel@vger.kernel.org; Limonciello, Mario
> <Mario.Limonciello@amd.com>; Mark Gross <markgross@kernel.org>
> Subject: Re: [RFC v2 3/3] platform/x86/intel/pmc: core: Report duration of
> time in HW sleep state
> 
> On Thu, Nov 10 2022 at 00:47, Mario Limonciello wrote:
> > intel_pmc_core displays a warning when a suspend didn't get to a HW
> > sleep state.
> 
> Where? Copy and paste is wonderful...

In current mainline, drivers/platform/x86/intel/pmc/core.c line 2130 will
show such a warning.

"CPU did not enter SLP_S0!!! (S0ix cnt=%llu)"
  

Patch

diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
index 17ec5825d13d..ef2055209213 100644
--- a/drivers/platform/x86/intel/pmc/core.c
+++ b/drivers/platform/x86/intel/pmc/core.c
@@ -2116,6 +2116,8 @@  static __maybe_unused int pmc_core_resume(struct device *dev)
 	if (!pmcdev->check_counters)
 		return 0;
 
+	pm_set_hw_state_residency(pmcdev->s0ix_counter);
+
 	if (!pmc_core_is_s0ix_failed(pmcdev))
 		return 0;