rpms/kernel/F-9 linux-2.6-kvm-svm-msr-write.patch, NONE, 1.1.2.1 kernel.spec, 1.648, 1.648.4.1

Chris Wright (chrisw) fedora-extras-commits at redhat.com
Tue May 20 22:49:06 UTC 2008


Author: chrisw

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19093

Modified Files:
      Tag: private-chrisw-bz447636-branch
	kernel.spec 
Added Files:
      Tag: private-chrisw-bz447636-branch
	linux-2.6-kvm-svm-msr-write.patch 
Log Message:
kvm: fake writes to k7 perfcnt msrs


linux-2.6-kvm-svm-msr-write.patch:

--- NEW FILE linux-2.6-kvm-svm-msr-write.patch ---
commit 854d17ee91e87903dc42e8b4506ffd9d023ed47a
Author: Chris Lalancette <clalance at redhat.com>
Date:   Mon May 5 13:05:16 2008 -0400

    KVM: SVM: Fake MSR_K7 performance counters
    
    Attached is a patch that fixes a guest crash when booting older Linux kernels.
    The problem stems from the fact that we are currently emulating
    MSR_K7_EVNTSEL[0-3], but not emulating MSR_K7_PERFCTR[0-3].  Because of this,
    setup_k7_watchdog() in the Linux kernel receives a GPF when it attempts to
    write into MSR_K7_PERFCTR, which causes an OOPs.
    
    The patch fixes it by just "fake" emulating the appropriate MSRs, throwing
    away the data in the process.  This causes the NMI watchdog to not actually
    work, but it's not such a big deal in a virtualized environment.
    
    When we get a write to one of these counters, we printk_ratelimit() a warning.
    I decided to print it out for all writes, even if the data is 0; it doesn't
    seem to make sense to me to special case when data == 0.
    
    Tested by myself on a RHEL-4 guest, and Joerg Roedel on a Windows XP 64-bit
    guest.
    
    Signed-off-by: Chris Lalancette <clalance at redhat.com>
    Signed-off-by: Avi Kivity <avi at qumranet.com>

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 5528121..dc91b09 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1312,16 +1312,19 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
 	case MSR_K7_EVNTSEL1:
 	case MSR_K7_EVNTSEL2:
 	case MSR_K7_EVNTSEL3:
+	case MSR_K7_PERFCTR0:
+	case MSR_K7_PERFCTR1:
+	case MSR_K7_PERFCTR2:
+	case MSR_K7_PERFCTR3:
 		/*
-		 * only support writing 0 to the performance counters for now
-		 * to make Windows happy. Should be replaced by a real
-		 * performance counter emulation later.
+		 * Just discard all writes to the performance counters; this
+		 * should keep both older linux and windows 64-bit guests
+		 * happy
 		 */
-		if (data != 0)
-			goto unhandled;
+		pr_unimpl(vcpu, "unimplemented perfctr wrmsr: 0x%x data 0x%llx\n", ecx, data);
+
 		break;
 	default:
-	unhandled:
 		return kvm_set_msr_common(vcpu, ecx, data);
 	}
 	return 0;


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.648
retrieving revision 1.648.4.1
diff -u -r1.648 -r1.648.4.1
--- kernel.spec	20 May 2008 08:34:58 -0000	1.648
+++ kernel.spec	20 May 2008 22:47:59 -0000	1.648.4.1
@@ -12,7 +12,7 @@
 # that the kernel isn't the stock distribution kernel, for example,
 # by setting the define to ".local" or ".bz123456"
 #
-#% define buildid .local
+%define buildid .bz447636
 
 # fedora_build defines which build revision of this kernel version we're
 # building. Rather than incrementing forever, as with the prior versioning
@@ -634,6 +634,7 @@
 Patch1515: linux-2.6-lirc.patch
 
 Patch1600: linux-2.6-virtio_net-free-transmit-skbs-in-a-timer.patch
+Patch1650: linux-2.6-kvm-svm-msr-write.patch
 
 # nouveau + drm fixes
 Patch1801: linux-2.6-drm-git-mm.patch
@@ -1194,6 +1195,9 @@
 # virtio: dont hang on shutdown
 ApplyPatch linux-2.6-virtio_net-free-transmit-skbs-in-a-timer.patch
 
+# kvm: fake amd msr perfcnt writes
+ApplyPatch linux-2.6-kvm-svm-msr-write.patch
+
 ApplyPatch linux-2.6-e1000-ich9.patch
 
 ApplyPatch linux-2.6-sata-eeepc-faster.patch
@@ -1825,6 +1829,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Tue May 20 2008 Chris Wright <chrisw at redhat.com> 2.6.25.4-29.bz447636
+- kvm: emulate K7 msr perfcnt writes (#447636)
+
 * Tue May 20 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-29
 - virtio_net: free transmit skbs in a timer (#444765)
 




More information about the fedora-extras-commits mailing list