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

[Xen-devel] [PATCH] xen: avoid crash enabling turbo mode



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1321356497 0
# Node ID 3cfb8f2c4ce898414279d7162206be812584bd5b
# Parent  955a6c07dc5e9c55316d1678b2b7cc4313f4fd57
xen: avoid crash enabling turbo mode

On a system which has not had P-state information pushed down into the
hypervisor running "xenpm enable-turbo-mode" will reliably crash the host.

(XEN) PM OP 38 on CPU0
(XEN) ----[ Xen-4.2-unstable  x86_64  debug=y  Not tainted ]----
(XEN) CPU:    0
(XEN) RIP:    e008:[<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29
(XEN) RFLAGS: 0000000000010297   CONTEXT: hypervisor
(XEN) rax: 0000000000000000   rbx: ffff82c48029fe40   rcx: 0000000000000000
(XEN) rdx: 0000000000000000   rsi: 000000000000000a   rdi: 0000000000000000
(XEN) rbp: ffff82c48029fd08   rsp: ffff82c48029fd08   r8:  0000000000000004
(XEN) r9:  0000000000000000   r10: 00000000fffffffd   r11: ffff82c480218f20
(XEN) r12: ffff830106e720b0   r13: 0000000000000000   r14: ffff82c4802bff80
(XEN) r15: ffff82c48025c0e4   cr0: 000000008005003b   cr4: 00000000000026f0
(XEN) cr3: 000000011f459000   cr2: 0000000000000051
(XEN) ds: 007b   es: 007b   fs: 00d8   gs: 0033   ss: 0000   cs: e008
(XEN) Xen stack trace from rsp=ffff82c48029fd08:
(XEN)    ffff82c48029fdb8 ffff82c48014c427 ffff82c48029fd98 ffff82c48016b2d6
(XEN)    ffff82c48029fdb8 ffff82c48029fd60 00000000001196c5 0000000116bbe025
(XEN)    0000000116bbe025 ffff8301196c5338 ffff82f6022d77c0 0000000000000000
(XEN)    ffff82f60205edf0 0000000000000000 0000000000000000 ffff8300dffba000
(XEN)    ffff82c48029fdb8 ffff82c48029ff18 0000000008050004 0000000000000000
(XEN)    ffff82c4802bff80 ffff82c48025c0e4 ffff82c48029fef8 ffff82c480124fd8
(XEN)    0000000000000000 ffff83011f48c000 0000000116bbe025 0000000000000025
(XEN)    ffff82c48029fe28 0000000080167722 ffff82c48029ff08 ffff83011f48c000
(XEN)    ffff82f60232d8a0 ffff8300dffba000 ffff83011f48c000 ffff82f60232d8a0
(XEN)    ffff82c48029fed8 ffff82c48017296a 000000080000000c 0000000000000026
(XEN)    bfb338b000000000 bfb33874bfb33868 b78988f800000000 0000008800000000
(XEN)    b787a6e0b78533a0 ffffffff00000001 080487aeb7897ff4 bfb3389000000001
(XEN)    b7898ab0b7889626 0000000100000000 0000000000000001 0804867800000001
(XEN)    000000000804e998 00000000b78533a0 bfb33e70bfb33a7c 0000000000000000
(XEN)    0000000000000000 ffff8300dffba000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 00007d3b7fd600c7 ffff82c48021511e
(XEN)    00000000c1002467 0000000000000023 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 00000000dbf5bef8 0000000008050004
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000023 00000000bfb33874 00000000bfb33868 0000000000000000
(XEN) Xen call trace:
(XEN)    [<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29
(XEN)    [<ffff82c48014c427>] do_pm_op+0x884/0x8e7
(XEN)    [<ffff82c480124fd8>] do_sysctl+0x6d8/0x9f0
(XEN)    [<ffff82c48021511e>] compat_hypercall+0xae/0x107
(XEN)
(XEN) Pagetable walk from 0000000000000051:
(XEN)  L4[0x000] = 0000000116dbc027 000000000001bd22
(XEN)  L3[0x000] = 0000000119ba8027 000000000001eb36
(XEN)  L2[0x000] = 0000000000000000 ffffffffffffffff
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0000]
(XEN) Faulting linear address: 0000000000000051
(XEN) ****************************************
(XEN)

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Winston Wang <winston.l.wang@xxxxxxxxx>
Cc: Gang Wei <gang.wei@xxxxxxxxx>
Cc: Mark Langsdorf <mark.langsdorf@xxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>

diff -r 955a6c07dc5e -r 3cfb8f2c4ce8 xen/drivers/cpufreq/utility.c
--- a/xen/drivers/cpufreq/utility.c     Tue Oct 18 10:33:32 2011 +0100
+++ b/xen/drivers/cpufreq/utility.c     Tue Nov 15 11:28:17 2011 +0000
@@ -396,7 +396,7 @@ void cpufreq_enable_turbo(int cpuid)
     struct cpufreq_policy *policy;
 
     policy = per_cpu(cpufreq_cpu_policy, cpuid);
-    if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
+    if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
         policy->turbo = CPUFREQ_TURBO_ENABLED;
 }
 
@@ -405,7 +405,7 @@ void cpufreq_disable_turbo(int cpuid)
     struct cpufreq_policy *policy;
 
     policy = per_cpu(cpufreq_cpu_policy, cpuid);
-    if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
+    if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
         policy->turbo = CPUFREQ_TURBO_DISABLED;
 }
 
@@ -414,7 +414,7 @@ int cpufreq_get_turbo_status(int cpuid)
     struct cpufreq_policy *policy;
 
     policy = per_cpu(cpufreq_cpu_policy, cpuid);
-    return policy->turbo;
+    return policy && policy->turbo;
 }
 
 /*********************************************************************

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


 


Rackspace

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