All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Andryuk <jandryuk@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Jason Andryuk <jandryuk@gmail.com>, Wei Liu <wl@xen.org>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [PATCH v2 05/13] xenpm: Change get-cpufreq-para output for internal
Date: Wed, 10 Aug 2022 15:29:36 -0400	[thread overview]
Message-ID: <20220810192944.102135-6-jandryuk@gmail.com> (raw)
In-Reply-To: <20220810192944.102135-1-jandryuk@gmail.com>

When using HWP, some of the returned data is not applicable.  In that
case, we should just omit it to avoid confusing the user.  So switch to
printing the base and turbo frequencies since those are relevant to HWP.
Similarly, stop printing the CPU frequencies since those do not apply.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
v2:
Use full governor name XEN_HWP_GOVERNOR to change output
Style fixes
---
 tools/misc/xenpm.c | 41 +++++++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 4f8cde690a..179f9f1f96 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -711,6 +711,7 @@ void start_gather_func(int argc, char *argv[])
 /* print out parameters about cpu frequency */
 static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 {
+    bool internal = strstr(p_cpufreq->scaling_governor, XEN_HWP_GOVERNOR);
     int i;
 
     printf("cpu id               : %d\n", cpuid);
@@ -720,10 +721,15 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
         printf(" %d", p_cpufreq->affected_cpus[i]);
     printf("\n");
 
-    printf("cpuinfo frequency    : max [%u] min [%u] cur [%u]\n",
-           p_cpufreq->cpuinfo_max_freq,
-           p_cpufreq->cpuinfo_min_freq,
-           p_cpufreq->cpuinfo_cur_freq);
+    if ( internal )
+        printf("cpuinfo frequency    : base [%u] turbo [%u]\n",
+               p_cpufreq->cpuinfo_min_freq,
+               p_cpufreq->cpuinfo_max_freq);
+    else
+        printf("cpuinfo frequency    : max [%u] min [%u] cur [%u]\n",
+               p_cpufreq->cpuinfo_max_freq,
+               p_cpufreq->cpuinfo_min_freq,
+               p_cpufreq->cpuinfo_cur_freq);
 
     printf("scaling_driver       : %s\n", p_cpufreq->scaling_driver);
 
@@ -750,19 +756,22 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
                p_cpufreq->u.ondemand.up_threshold);
     }
 
-    printf("scaling_avail_freq   :");
-    for ( i = 0; i < p_cpufreq->freq_num; i++ )
-        if ( p_cpufreq->scaling_available_frequencies[i] ==
-             p_cpufreq->scaling_cur_freq )
-            printf(" *%d", p_cpufreq->scaling_available_frequencies[i]);
-        else
-            printf(" %d", p_cpufreq->scaling_available_frequencies[i]);
-    printf("\n");
+    if ( !internal )
+    {
+        printf("scaling_avail_freq   :");
+        for ( i = 0; i < p_cpufreq->freq_num; i++ )
+            if ( p_cpufreq->scaling_available_frequencies[i] ==
+                 p_cpufreq->scaling_cur_freq )
+                printf(" *%d", p_cpufreq->scaling_available_frequencies[i]);
+            else
+                printf(" %d", p_cpufreq->scaling_available_frequencies[i]);
+        printf("\n");
 
-    printf("scaling frequency    : max [%u] min [%u] cur [%u]\n",
-           p_cpufreq->scaling_max_freq,
-           p_cpufreq->scaling_min_freq,
-           p_cpufreq->scaling_cur_freq);
+        printf("scaling frequency    : max [%u] min [%u] cur [%u]\n",
+               p_cpufreq->scaling_max_freq,
+               p_cpufreq->scaling_min_freq,
+               p_cpufreq->scaling_cur_freq);
+    }
 
     printf("turbo mode           : %s\n",
            p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a");
-- 
2.37.1



  parent reply	other threads:[~2022-08-10 19:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 19:29 [PATCH v2 00/13] Intel Hardware P-States (HWP) support Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 01/13] cpufreq: Allow restricting to internal governors only Jason Andryuk
2022-08-15 14:22   ` Jan Beulich
2022-08-15 14:47     ` Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 02/13] cpufreq: Add perf_freq to cpuinfo Jason Andryuk
2022-08-15 14:29   ` Jan Beulich
2022-08-10 19:29 ` [PATCH v2 03/13] cpufreq: Export intel_feature_detect Jason Andryuk
2022-08-15 14:34   ` Jan Beulich
2022-08-15 14:58     ` Jason Andryuk
2022-08-15 15:23       ` Jan Beulich
2022-08-10 19:29 ` [PATCH v2 04/13] cpufreq: Add Hardware P-State (HWP) driver Jason Andryuk
2022-08-10 19:29 ` Jason Andryuk [this message]
2022-08-10 19:29 ` [PATCH v2 06/13] cpufreq: Export HWP parameters to userspace Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 07/13] libxc: Include hwp_para in definitions Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 08/13] xenpm: Print HWP parameters Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 09/13] xen: Add SET_CPUFREQ_HWP xen_sysctl_pm_op Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 10/13] libxc: Add xc_set_cpufreq_hwp Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 11/13] xenpm: Factor out a non-fatal cpuid_parse variant Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 12/13] xenpm: Add set-cpufreq-hwp subcommand Jason Andryuk
2022-08-10 19:29 ` [PATCH v2 13/13] CHANGELOG: Add Intel HWP entry Jason Andryuk
2022-08-11  1:56   ` Henry Wang
2022-08-11  6:51   ` Jan Beulich
2022-08-11 11:30     ` Jason Andryuk
2022-08-11 12:16       ` Henry Wang

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=20220810192944.102135-6-jandryuk@gmail.com \
    --to=jandryuk@gmail.com \
    --cc=anthony.perard@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 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.