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-changelog

[Xen-changelog] [xen-unstable] x86: Fix APERF/MPERF query bug on non-cur

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Fix APERF/MPERF query bug on non-current cpu
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Jul 2008 07:30:14 -0700
Delivery-date: Fri, 18 Jul 2008 07:30:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216376653 -3600
# Node ID b896b39470f0e1c957c82db30d915875b00c3776
# Parent  48be9885d341cc88128f2d3fa7e9d8ab0cf031f5
x86: Fix APERF/MPERF query bug on non-current cpu

Currently xen hypervisor cpufreq can only query APERF/MPERF on running
cpu, which will result in system broken when query on non-current
cpu. This patch fix the APERF/MPERF query bug on non-current cpu.

Signed-off-by: Liu Jinsong <jinsong.liu@xxxxxxxxx>
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff -r 48be9885d341 -r b896b39470f0 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c       Fri Jul 18 11:23:25 2008 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c       Fri Jul 18 11:24:13 2008 +0100
@@ -237,9 +237,9 @@ static u32 get_cur_val(cpumask_t mask)
  * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and
  * no meaning should be associated with absolute values of these MSRs.
  */
-/* FIXME: handle query on non-current cpu later */
-static unsigned int get_measured_perf(unsigned int cpu)
-{
+static void  __get_measured_perf(void *perf_percent)
+{
+    unsigned int *ratio = perf_percent;
     union {
         struct {
             uint32_t lo;
@@ -248,9 +248,6 @@ static unsigned int get_measured_perf(un
         uint64_t whole;
     } aperf_cur, mperf_cur;
 
-    unsigned int perf_percent;
-    unsigned int retval;
-
     rdmsr(MSR_IA32_APERF, aperf_cur.split.lo, aperf_cur.split.hi);
     rdmsr(MSR_IA32_MPERF, mperf_cur.split.lo, mperf_cur.split.hi);
 
@@ -264,10 +261,21 @@ static unsigned int get_measured_perf(un
     }
 
     if (aperf_cur.whole && mperf_cur.whole)
-        perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole;
+        *ratio = (aperf_cur.whole * 100) / mperf_cur.whole;
     else
-        perf_percent = 0;
-
+        *ratio = 0;
+}
+
+static unsigned int get_measured_perf(unsigned int cpu)
+{
+    unsigned int retval, perf_percent;
+    cpumask_t cpumask;
+
+    if (!cpu_online(cpu))
+        return 0;
+
+    cpumask = cpumask_of_cpu(cpu);
+    on_selected_cpus(cpumask, __get_measured_perf, (void *)&perf_percent,0,1);
 
     retval = drv_data[cpu]->max_freq * perf_percent / 100;
     return retval;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: Fix APERF/MPERF query bug on non-current cpu, Xen patchbot-unstable <=