From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Lalancette Subject: [PATCH]: Let dom0 write to the APERF and MPERF MSR's Date: Fri, 16 Jan 2009 15:32:34 +0100 Message-ID: <49709A82.5000706@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020902010001030800040209" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020902010001030800040209 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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. Signed-off-by: Chris Lalancette --------------020902010001030800040209 Content-Type: text/x-patch; name="xen-allow_APERF-WRMSR.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xen-allow_APERF-WRMSR.patch" diff -urp xen.orig/arch/x86/traps.c xen/arch/x86/traps.c --- xen.orig/arch/x86/traps.c 2009-01-16 14:22:09.000000000 +0100 +++ xen/arch/x86/traps.c 2009-01-16 14:55:11.000000000 +0100 @@ -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; diff -urp xen.orig/include/asm-x86/msr.h xen/include/asm-x86/msr.h --- xen.orig/include/asm-x86/msr.h 2009-01-16 14:22:09.000000000 +0100 +++ xen/include/asm-x86/msr.h 2009-01-16 14:24:42.000000000 +0100 @@ -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 --------------020902010001030800040209 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------020902010001030800040209--