2022-11-10 06:58:09

by Mario Limonciello

[permalink] [raw]
Subject: [RFC v2 0/3] Introduce infrastructure to report time in hardware sleep state

Sven van Ashbrook brought a patch to the kernel mailing list that
attempted to change the reporting level of a s0ix entry issue to a
different debugging level so that infastructure used by Google could
better scan logs to catch problems.

This approach was rejected, but during the conversation another
suggestion was made by David E. Box to introduce some infrastructure
into the kernel to report this information.

As it's information that is reported by both AMD and Intel platforms
over s2idle, this seems to make sense.

This series introduces new sysfs files representing duration in a hardware
sleep state and total sleep duration.

The expectation is that userspace could read these file after s2idle
occurred to infer whta percentage of time was spent in a hardware sleep
state.

RFC v1->v2:
* Rename sysfs file for time in hardware state
* Export a sysfs file for total time in suspend
* Only export sysfs file for hardware state if system supports low
power idle.

Mario Limonciello (3):
PM: Add a sysfs files to represent sleep duration
platform/x86/amd: pmc: Report duration of time in deepest hw state
platform/x86/intel/pmc: core: Report duration of time in deepest HW
state

Documentation/ABI/testing/sysfs-power | 17 +++++++++++
drivers/platform/x86/amd/pmc.c | 4 +--
drivers/platform/x86/intel/pmc/core.c | 2 ++
include/linux/suspend.h | 5 ++++
kernel/power/main.c | 42 +++++++++++++++++++++++++++
kernel/power/suspend.c | 2 ++
kernel/time/timekeeping.c | 2 ++
7 files changed, 71 insertions(+), 3 deletions(-)

--
2.34.1



2022-11-10 07:19:27

by Mario Limonciello

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

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 <[email protected]>
---
drivers/platform/x86/intel/pmc/core.c | 2 ++
1 file changed, 2 insertions(+)

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;

--
2.34.1


2022-11-14 00:07:22

by Thomas Gleixner

[permalink] [raw]
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...


2022-11-14 19:31:40

by Mario Limonciello

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

[Public]



> -----Original Message-----
> From: Thomas Gleixner <[email protected]>
> Sent: Sunday, November 13, 2022 17:57
> To: Limonciello, Mario <[email protected]>; Sven van Ashbrook
> <[email protected]>; Rafael J Wysocki <[email protected]>; linux-
> [email protected]; [email protected]; Rajneesh
> Bhardwaj <[email protected]>; David E Box
> <[email protected]>
> Cc: S-k, Shyam-sundar <[email protected]>;
> [email protected]; Rajat Jain <[email protected]>; Hans de Goede
> <[email protected]>; [email protected]; Limonciello, Mario
> <[email protected]>; Mark Gross <[email protected]>
> 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)"