WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86/cpufreq: fix turbo mode detection

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86/cpufreq: fix turbo mode detection
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Thu, 06 May 2010 14:10:12 +0100
Delivery-date: Thu, 06 May 2010 06:10:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
acpi_cpufreq_cpu_init() does generally not run on the CPU the policy
it deals with is related to, hence using cpuid() directly works only
as long as all CPUs in the system are identical (which admittedly
is commonly the case).

Also fix a minor glitch in xenpm, which I noticed while looking into
the original inconsistencies on one of my systems.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2010-05-04.orig/tools/misc/xenpm.c  2010-04-14 14:05:14.000000000 +0200
+++ 2010-05-04/tools/misc/xenpm.c       2010-05-06 13:37:30.000000000 +0200
@@ -499,10 +499,7 @@ static void print_cpufreq_para(int cpuid
 
     printf("affected_cpus        :");
     for ( i = 0; i < p_cpufreq->cpu_num; i++ )
-        if ( i == cpuid )
-            printf(" *%d", p_cpufreq->affected_cpus[i]);
-        else
-            printf(" %d", p_cpufreq->affected_cpus[i]);
+        printf(" %d", p_cpufreq->affected_cpus[i]);
     printf("\n");
 
     printf("cpuinfo frequency    : max [%u] min [%u] cur [%u]\n",
--- 2010-05-04.orig/xen/arch/x86/acpi/cpufreq/cpufreq.c 2010-04-12 
11:28:20.000000000 +0200
+++ 2010-05-04/xen/arch/x86/acpi/cpufreq/cpufreq.c      2010-05-06 
13:24:41.000000000 +0200
@@ -377,6 +377,23 @@ static unsigned int get_cur_freq_on_cpu(
     return freq;
 }
 
+static void feature_detect(void *info)
+{
+    struct cpufreq_policy *policy = info;
+    unsigned int eax, ecx;
+
+    ecx = cpuid_ecx(6);
+    if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY)
+        acpi_cpufreq_driver.getavg = get_measured_perf;
+    eax = cpuid_eax(6);
+    if (eax & 0x2) {
+        policy->turbo = CPUFREQ_TURBO_ENABLED;
+        if (cpufreq_verbose)
+            printk(XENLOG_INFO "CPU%u: Turbo Mode detected and enabled\n",
+                   smp_processor_id());
+    }
+}
+
 static unsigned int check_freqs(cpumask_t mask, unsigned int freq,
                                 struct acpi_cpufreq_data *data)
 {
@@ -615,18 +632,8 @@ acpi_cpufreq_cpu_init(struct cpufreq_pol
 
     /* Check for APERF/MPERF support in hardware
      * also check for boost support */
-    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) {
-        unsigned int ecx;
-        unsigned int eax;
-        ecx = cpuid_ecx(6);
-        if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY)
-            acpi_cpufreq_driver.getavg = get_measured_perf;
-        eax = cpuid_eax(6);
-        if ( eax & 0x2 ) {
-            policy->turbo = CPUFREQ_TURBO_ENABLED;
-            printk(XENLOG_INFO "Turbo Mode detected and enabled!\n");
-        }
-    }
+    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
+        on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
 
     /*
      * the first call to ->target() should result in us actually



Attachment: cpufreq-turbo-detect.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel