mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joshua Crofts <crofts@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,  Pavel Machek <pavel@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Danilo Krummrich <dakr@kernel.org>,
	Johan Hovold <johan@kernel.org>
Cc: linux-pm@vger.kernel.org, driver-core@lists.linux.dev,
	 linux-kernel@vger.kernel.org, Joshua Crofts <crofts@kernel.org>,
	 Dominik Brodowski <linux@dominikbrodowski.net>
Subject: [PATCH 0/3] PM: runtime: add new runtime metrics and summary
Date: Tue, 10 Nov 2026 11:43:19 +0100	[thread overview]
Message-ID: <20261110-pm-runtime-summary-v1-0-12ebf283db78@kernel.org> (raw)

Add a new set additional PM runtime metrics to improve power management
debugging and reporting (these metrics may be useful to userspace
utilities such as Powertop).

MOTIVATION:
The current implementation only measures the duration a device spends in
suspended or active mode, which is very limiting. We can't find out how
many times a device changed state or what its shortest suspend cycle
was (to detect a sort of power "thrashing" behaviour).

NEW FEATURES:
This series introduces the following new metrics:
- resume_count : number of successful transitions to active
- suspend_count: number of successful transitions to suspended
- last_suspended_time: duration of the most recent sleep cycle (ns)
- min_suspended_time / max_suspended_sleep: shortest and longest sleep
  cycle durations to help detect power thrashing (ns)

By reading the debugfs file /sys/kernel/debug/pm_runtime_summary, you
get the following table describing the power stats of each device with
runtime PM enabled:

Device                           Status        Resumes Suspends   Active(ms)  Suspend(ms)   Last(ms)    Min(ms)    Max(ms)
--------------------------------------------------------------------------------------------------------------------------
0000:00:02.0                     active              1        0        45688            0          0          0          0
0000:00:1f.0                     active              1        0        45687            0          0          0          0
0000:00:1f.2                     active              1        0        45686            0          0          0          0
0000:00:1f.3                     suspended           1        1         1658        44028          0          0          0
00:03:0                          active             15       14        19627        25899         42          5      14811
00:03:0.0                        active             14       13        19626        25900         42          5      14811

TESTING:
Tested with an x86_64 defconfig kernel and QEMU.

AI ASSISTANCE:
Gemini was used to prepare this series.

Signed-off-by: Joshua Crofts <crofts@kernel.org>
---
Joshua Crofts (3):
      PM: runtime: add additional suspend/resume metrics
      PM: add sysfs attributes for additional suspend/resume metrics
      PM: runtime: add debugfs entry for pm_runtime_summary

 Documentation/ABI/testing/sysfs-devices-power |  36 ++++++
 drivers/base/power/runtime.c                  | 156 +++++++++++++++++++++++++-
 drivers/base/power/sysfs.c                    |  81 +++++++++++++
 include/linux/pm.h                            |  12 ++
 4 files changed, 281 insertions(+), 4 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261110-pm-runtime-summary-8dd29a1383bc

Best regards,
-- 
Joshua Crofts <crofts@kernel.org>


             reply	other threads:[~2026-11-10 10:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 10:43 Joshua Crofts [this message]
2026-11-10 10:43 ` [PATCH 1/3] PM: runtime: add additional suspend/resume metrics Joshua Crofts
2026-11-10 10:43 ` [PATCH 2/3] PM: add sysfs attributes for " Joshua Crofts
2026-11-10 10:43 ` [PATCH 3/3] PM: runtime: add debugfs entry for pm_runtime_summary Joshua Crofts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261110-pm-runtime-summary-v1-0-12ebf283db78@kernel.org \
    --to=crofts@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®