public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacob Tanenbaum <jtanenba@redhat.com>
To: linux-pm@vger.kernel.org
Cc: trenn@suse.com, prarit@redhat.com, Jacob Tanenbaum <jtanenba@redhat.com>
Subject: [PATCH 2/2] fix how "cpupower frequency-info" interprets latency
Date: Mon,  9 Nov 2015 14:26:59 -0500	[thread overview]
Message-ID: <1447097219-31370-3-git-send-email-jtanenba@redhat.com> (raw)
In-Reply-To: <1447097219-31370-1-git-send-email-jtanenba@redhat.com>

the intel-pstate driver does not support the ondemand governor and does not
have a valid value in
/sys/devices/system/cpu/cpu[x]/cpufreq/cpuinfo_transition_latency. The
intel-pstate driver sets cpuinfo_transition_latency to CPUFREQ_ETERNAL (-1),
the value written into cpuinfo_transition_latency is defind as an unsigned
int so checking the read value against max unsigned int will determine if the
value is valid.

output before the patch set is applied
[jtanenba@dhcp-17-90 cpupower]$ ./cpupower frequency-info -d
analyzing CPU 0:
intel_pstate
[jtanenba@dhcp-17-90 cpupower]$ ./cpupower frequency-info -y
analyzing CPU 0:
4294967295
[jtanenba@dhcp-17-90 cpupower]$ ./cpupower frequency-info -y -m
analyzing CPU 0:
0.97 ms

output after patch set is applied
[jtanenba@dhcp-17-90 cpupower]$ ./cpupower frequency-info -d
analyzing CPU 0:
  driver: intel_pstate
[jtanenba@dhcp-17-90 cpupower]$ ./cpupower frequency-info -y
analyzing CPU 0:
  maximum transition latency:  Cannot determine or is not supported.
[jtanenba@dhcp-17-90 cpupower]$ ./cpupower frequency-info -y -m
analyzing CPU 0:
  maximum transition latency:  Cannot determine or is not supported.

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
---
 tools/power/cpupower/utils/cpufreq-info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index 8f40b79..a6efb6a 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -433,8 +433,8 @@ static int get_latency(unsigned int cpu, unsigned int human)
 	unsigned long latency = cpufreq_get_transition_latency(cpu);
 
 	printf(_("  maximum transition latency: "));
-	if (!latency) {
-		printf(_(" Cannot determine latency.\n"));
+	if (!latency || latency == UINT_MAX) {
+		printf(_(" Cannot determine or is not supported.\n"));
 		return -EINVAL;
 	}
 
-- 
2.4.3


  parent reply	other threads:[~2015-11-09 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 19:26 [PATCH 0/2] Some changes to "cpupower frequency-info" command Jacob Tanenbaum
2015-11-09 19:26 ` [PATCH 1/2] rework the " Jacob Tanenbaum
2015-11-09 19:26 ` Jacob Tanenbaum [this message]
2015-11-10 16:12 ` [PATCH 0/2] Some changes to " Thomas Renninger

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=1447097219-31370-3-git-send-email-jtanenba@redhat.com \
    --to=jtanenba@redhat.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=trenn@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox