[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH V2 1/2] cpufreq, xenpm: fix cpufreq and xenpm mismatch



Currently cpufreq and xenpm are out of sync. Fix cpufreq reporting of
if turbo mode is enabled or not. Fix xenpm to not decode for tristate,
but a boolean.

Signed-off-by: Jacob Shin <jacob.shin@xxxxxxx>
---
 tools/misc/xenpm.c            |   14 +++-----------
 xen/drivers/cpufreq/utility.c |    2 +-
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index b5f1383..2e57f1f 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -31,10 +31,6 @@
 
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
 
-#define CPUFREQ_TURBO_DISABLED      -1
-#define CPUFREQ_TURBO_UNSUPPORTED   0
-#define CPUFREQ_TURBO_ENABLED       1
-
 static xc_interface *xc_handle;
 static unsigned int max_cpu_nr;
 
@@ -699,13 +695,9 @@ static void print_cpufreq_para(int cpuid, struct 
xc_get_cpufreq_para *p_cpufreq)
            p_cpufreq->scaling_max_freq,
            p_cpufreq->scaling_min_freq,
            p_cpufreq->scaling_cur_freq);
-    if (p_cpufreq->turbo_enabled != CPUFREQ_TURBO_UNSUPPORTED) {
-           printf("turbo mode           : ");
-           if (p_cpufreq->turbo_enabled == CPUFREQ_TURBO_ENABLED)
-               printf("enabled\n");
-           else
-               printf("disabled\n");
-    }
+
+    printf("turbo mode           : %s\n",
+           p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a");
     printf("\n");
 }
 
diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index 3dd70e2..519f862 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -428,7 +428,7 @@ int cpufreq_get_turbo_status(int cpuid)
     struct cpufreq_policy *policy;
 
     policy = per_cpu(cpufreq_cpu_policy, cpuid);
-    return policy && policy->turbo;
+    return policy && policy->turbo == CPUFREQ_TURBO_ENABLED;
 }
 
 /*********************************************************************
-- 
1.7.9.5



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.