All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
	Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Sven van Ashbrook <svenva@chromium.org>,
	Raul Rangel <rrangel@chromium.org>, <linux-pm@vger.kernel.org>,
	<platform-driver-x86@vger.kernel.org>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	John Stultz <jstultz@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Stephen Boyd <sboyd@kernel.org>,
	Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>,
	Rajat Jain <rajatja@google.com>,
	David E Box <david.e.box@intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: [RFC v3 4/4] platform/x86/amd: pmc: Populate cpuidle sysfs file with hw sleep data
Date: Tue, 15 Nov 2022 14:01:56 -0600	[thread overview]
Message-ID: <20221115200156.12218-5-mario.limonciello@amd.com> (raw)
In-Reply-To: <20221115200156.12218-1-mario.limonciello@amd.com>

AMD platforms don't provide an ACPI LPIT table, but the data about
duration of time in a hardware sleep state is part of the SMU metrics
table.

To allow userspace to query this from a standard location, export this
information to the standard
`/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us`.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
RFC v2->v3:
 * New patch
---
 drivers/platform/x86/amd/pmc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
index 2550ba6d28f5..ef5c23df1a5b 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -787,6 +787,11 @@ static void amd_pmc_s2idle_restore(void)
 
 	/* Notify on failed entry */
 	amd_pmc_validate_deepest(pdev);
+
+	/* Silently fail, if cpuidle attribute group is not present */
+	sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
+				&dev_attr_low_power_idle_system_residency_us.attr,
+				"cpuidle");
 }
 
 static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
-- 
2.34.1


  parent reply	other threads:[~2022-11-15 20:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 20:01 [RFC v3 0/4] Make it easier to measure % in HW sleep state Mario Limonciello
2022-11-15 20:01 ` [RFC v3 1/4] PM: Add a sysfs file to represent the total sleep duration Mario Limonciello
2022-11-15 20:44   ` John Stultz
2022-11-16  2:40     ` Limonciello, Mario
2022-11-16  7:32   ` kernel test robot
2022-11-16  9:43   ` kernel test robot
2022-11-15 20:01 ` [RFC v3 2/4] platform/x86/intel/pmc: core: Drop check_counters Mario Limonciello
2022-11-15 20:01 ` [RFC v3 3/4] platform/x86/amd: pmc: Report duration of time in deepest hw state Mario Limonciello
2022-11-15 20:01 ` Mario Limonciello [this message]
2022-11-17 14:10 ` [RFC v3 0/4] Make it easier to measure % in HW sleep state Hans de Goede

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=20221115200156.12218-5-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=david.e.box@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=irenic.rajneesh@gmail.com \
    --cc=jstultz@google.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rajatja@google.com \
    --cc=rrangel@chromium.org \
    --cc=sboyd@kernel.org \
    --cc=svenva@chromium.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.