Skip to contentSkip to conversation

: Let dom0 write to the APERF and MPERF MSR's

PATCH New Chris Lalancette 1 participant 1 message Jan 16, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Let dom0 write to the APERF and MPERF MSR's

All,
If dom0 is controlling the frequency scaling (which it still is in RHEL-5),
and it's using the new acpi-cpufreq code from upstream (which it is in 5.3), then it will attempt to wrmsr() to the MSR_IA32_APERF and MSR_IA32_MPERF MSR's (to do performance measuring, I believe). With the current hypervisor, this results in a lot of:

(XEN) traps.c:1761:d0 Domain attempted WRMSR 00000000000000e8 from 00000029:d7ca940f to 00000000:00000000.

messages. I believe it is safe to let the dom0 do this MSR write, so the attached patch just allows the write to go through. This eliminates the message spam, and probably allows acpi-cpufreq work to a certain extent (although I have not verified the latter).

The patch was generated and tested on a RHEL-5 (3.1-based) hypervisor, but should apply with a little massaging to xen-unstable.

arch/x86/traps.c +6 -0
diff -urp xen.orig/arch/x86/traps.c xen/arch/x86/traps.c
@@ -1751,6 +1751,12 @@ static int emulate_privileged_op(struct 
                  wrmsr_safe(regs->ecx, eax, edx) )
                 goto fail;
             break;
+	case MSR_IA32_MPERF:
+	case MSR_IA32_APERF:
+            if ( (cpufreq_controller != FREQCTL_dom0_kernel) ||
+                 wrmsr_safe(regs->ecx, eax, edx) )
+                goto fail;
+            break;
         default:
             if ( wrmsr_hypervisor_regs(regs->ecx, eax, edx) )
                 break;
include/asm-x86/msr.h +3 -0
diff -urp xen.orig/include/asm-x86/msr.h xen/include/asm-x86/msr.h
@@ -198,6 +198,9 @@ static inline void write_efer(u64 val)
 #define MSR_IA32_PERF_STATUS		0x198
 #define MSR_IA32_PERF_CTL		0x199
 
+#define MSR_IA32_MPERF			0x000000e7
+#define MSR_IA32_APERF			0x000000e8
+
 #define MSR_IA32_THERM_CONTROL		0x19a
 #define MSR_IA32_THERM_INTERRUPT	0x19b
 #define MSR_IA32_THERM_STATUS		0x19c

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel