rpms/kernel/F-11 kvm-Fix-PDPTR-reloading-on-CR4-writes.patch, NONE, 1.1 kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch, NONE, 1.1 kernel.spec, 1.1621, 1.1622

Kyle McMartin kyle at fedoraproject.org
Mon May 25 17:27:24 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26849

Modified Files:
	kernel.spec 
Added Files:
	kvm-Fix-PDPTR-reloading-on-CR4-writes.patch 
	kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch 
Log Message:
* Mon May 25 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.3-160
- kvm fixes destined for 2.6.30, rhbz#492838:
   kvm-Fix-PDPTR-reloading-on-CR4-writes.patch
   kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch


kvm-Fix-PDPTR-reloading-on-CR4-writes.patch:

--- NEW FILE kvm-Fix-PDPTR-reloading-on-CR4-writes.patch ---
>From 89fab5a4a4e30049f71976fc7c01829db842080a Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi at redhat.com>
Date: Sun, 24 May 2009 22:19:00 +0300
Subject: KVM: Fix PDPTR reloading on CR4 writes

The processor is documented to reload the PDPTRs while in PAE mode if any
of the CR4 bits PSE, PGE, or PAE change.  Linux relies on this
behaviour when zapping the low mappings of PAE kernels during boot.

The code already handled changes to CR4.PAE; augment it to also notice changes
to PSE and PGE.

This triggered while booting an F11 PAE kernel; the futex initialization code
runs before any CR3 reloads and writes to a NULL pointer; the futex subsystem
ended up uninitialized, killing PI futexes and pulseaudio which uses them.

Cc: stable at kernel.org
Signed-off-by: Avi Kivity <avi at redhat.com>
(cherry picked from commit a2edf57f510cce6a389cc14e58c6ad0a4296d6f9)
---
 arch/x86/kvm/x86.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 425423e..96de927 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -334,6 +334,9 @@ EXPORT_SYMBOL_GPL(kvm_lmsw);
 
 void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 {
+	unsigned long old_cr4 = vcpu->arch.cr4;
+	unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE;
+
 	if (cr4 & CR4_RESERVED_BITS) {
 		printk(KERN_DEBUG "set_cr4: #GP, reserved bits\n");
 		kvm_inject_gp(vcpu, 0);
@@ -347,7 +350,8 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 			kvm_inject_gp(vcpu, 0);
 			return;
 		}
-	} else if (is_paging(vcpu) && !is_pae(vcpu) && (cr4 & X86_CR4_PAE)
+	} else if (is_paging(vcpu) && (cr4 & X86_CR4_PAE)
+		   && ((cr4 ^ old_cr4) & pdptr_bits)
 		   && !load_pdptrs(vcpu, vcpu->arch.cr3)) {
 		printk(KERN_DEBUG "set_cr4: #GP, pdptrs reserved bits\n");
 		kvm_inject_gp(vcpu, 0);
-- 
1.6.2.2


kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch:

--- NEW FILE kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch ---
>From b1c2a57cdda4ddaa8751c558345296742c18cf7b Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi at redhat.com>
Date: Sun, 24 May 2009 22:15:25 +0300
Subject: KVM: Make paravirt tlb flush also reload the PAE PDPTRs

The paravirt tlb flush may be used not only to flush TLBs, but also
to reload the four page-directory-pointer-table entries, as it is used
as a replacement for reloading CR3.  Change the code to do the entire
CR3 reloading dance instead of simply flushing the TLB.

Cc: stable at kernel.org
Signed-off-by: Avi Kivity <avi at redhat.com>
(cherry picked from commit a8cd0244e9cebcf9b358d24c7e7410062f3665cb)
---
 arch/x86/kvm/mmu.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 8005da2..2d2affd 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2906,8 +2906,7 @@ static int kvm_pv_mmu_write(struct kvm_vcpu *vcpu,
 
 static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu)
 {
-	kvm_x86_ops->tlb_flush(vcpu);
-	set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests);
+	kvm_set_cr3(vcpu, vcpu->arch.cr3);
 	return 1;
 }
 
-- 
1.6.2.2



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1621
retrieving revision 1.1622
diff -u -p -r1.1621 -r1.1622
--- kernel.spec	22 May 2009 21:51:32 -0000	1.1621
+++ kernel.spec	25 May 2009 17:26:52 -0000	1.1622
@@ -763,6 +763,9 @@ Patch9304: linux-2.6-xen-check-for-nx-su
 Patch9305: linux-2.6-xen-fix_warning_when_deleting_gendisk.patch
 Patch9306: linux-2.6-xen-xenbus_state_transition_when_not_connected.patch
 Patch9307: linux-2.6.29-xen-disable-gbpages.patch
+Patch9308: kvm-Fix-PDPTR-reloading-on-CR4-writes.patch
+Patch9309: kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch
+
 
 %endif
 
@@ -1418,6 +1421,9 @@ ApplyPatch linux-2.6-xen-check-for-nx-su
 ApplyPatch linux-2.6-xen-fix_warning_when_deleting_gendisk.patch
 ApplyPatch linux-2.6-xen-xenbus_state_transition_when_not_connected.patch
 ApplyPatch linux-2.6.29-xen-disable-gbpages.patch
+ApplyPatch kvm-Fix-PDPTR-reloading-on-CR4-writes.patch
+ApplyPatch kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch
+
 
 
 # END OF PATCH APPLICATIONS
@@ -2006,6 +2012,11 @@ fi
 # and build.
 
 %changelog
+* Mon May 25 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.3-160
+- kvm fixes destined for 2.6.30, rhbz#492838:
+   kvm-Fix-PDPTR-reloading-on-CR4-writes.patch
+   kvm-Make-paravirt-tlb-flush-also-reload-the-PAE-PDP.patch
+
 * Fri May 22 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.3-159
 - drm-copyback-ioctl-data-to-userspace-regardless-of-retcode.patch:
   Fix possible hang in drmWaitVblank.




More information about the scm-commits mailing list