From: Chen Yu <yu.c.chen@intel.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Chen Yu <yu.c.chen@intel.com>,
Todd Brandt <todd.e.brandt@intel.com>
Subject: [RFC PATCH] tools/power turbostat: Do not print negative LPI residency
Date: Sun, 22 Oct 2023 13:52:21 +0800 [thread overview]
Message-ID: <20231022055221.569634-1-yu.c.chen@intel.com> (raw)
turbostat prints the abnormal SYS%LPI across suspend-to-idle:
SYS%LPI = 114479815993277.50
This is reproduced by:
Run a freeze cycle, e.g. "sleepgraph -m freeze -rtcwake 15".
Then do a reboot. After boot up, launch the suspend-idle-idle
and check the SYS%LPI field.
The slp_so residence counter is in LPIT table, and BIOS does not
clears this register across reset. The PMC expects the OS to calculate
the LPI residency based on the delta. However, there is an firmware
issue that the LPIT gets cleared to 0 during the second suspend
to idle after the reboot, which brings negative delta value.
Prints a simple 0 to indicate this error to not confuse the user.
Reported-by: Todd Brandt <todd.e.brandt@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
tools/power/x86/turbostat/turbostat.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 9a10512e3407..3fa5f9a0218a 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -1472,8 +1472,16 @@ int delta_package(struct pkg_data *new, struct pkg_data *old)
old->pc8 = new->pc8 - old->pc8;
old->pc9 = new->pc9 - old->pc9;
old->pc10 = new->pc10 - old->pc10;
- old->cpu_lpi = new->cpu_lpi - old->cpu_lpi;
- old->sys_lpi = new->sys_lpi - old->sys_lpi;
+ if (new->cpu_lpi > old->cpu_lpi) {
+ old->cpu_lpi = new->cpu_lpi - old->cpu_lpi;
+ } else {
+ old->cpu_lpi = 0;
+ }
+ if (new->sys_lpi > old->sys_lpi) {
+ old->sys_lpi = new->sys_lpi - old->sys_lpi;
+ } else {
+ old->sys_lpi = 0;
+ }
old->pkg_temp_c = new->pkg_temp_c;
/* flag an error when rc6 counter resets/wraps */
--
2.25.1
next reply other threads:[~2023-10-22 5:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-22 5:52 Chen Yu [this message]
2023-10-22 7:40 ` [RFC PATCH] tools/power turbostat: Do not print negative LPI residency kernel test robot
2023-11-28 1:10 ` Len Brown
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=20231022055221.569634-1-yu.c.chen@intel.com \
--to=yu.c.chen@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=todd.e.brandt@intel.com \
/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.