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

[Xen-changelog] [xen master] x86: disable VPMU for PVH guests



commit 6d35f0f0cf072fe6313e6cc90ad5ed314a05e0c4
Author:     Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
AuthorDate: Thu Nov 27 14:02:45 2014 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Nov 27 14:02:45 2014 +0100

    x86: disable VPMU for PVH guests
    
    Currently when VPMU is enabled on a system both HVM and PVH VPCUs will
    initialize their VPMUs, including setting up vpmu_ops. As result even
    though VPMU will not work for PVH guests (APIC is not supported there),
    the guest may decide to perform a write to a PMU MSR. This will cause a
    call to is_vlapic_lvtpc_enabled() which will crash the hypervisor, e.g.:
    
     (XEN) Xen call trace:
     (XEN)    [<ffff82d0801ca06f>] is_vlapic_lvtpc_enabled+0x13/0x22
     (XEN)    [<ffff82d0801e2a15>] core2_vpmu_do_wrmsr+0x415/0x589
     (XEN)    [<ffff82d0801cedaa>] vpmu_do_wrmsr+0x2a/0x33
     (XEN)    [<ffff82d0801dd648>] vmx_msr_write_intercept+0x268/0x557
     (XEN)    [<ffff82d0801bcd2e>] hvm_msr_write_intercept+0x36c/0x39b
     (XEN)    [<ffff82d0801e0a0e>] vmx_vmexit_handler+0x1082/0x185b
     (XEN)    [<ffff82d0801e74c1>] vmx_asm_vmexit_handler+0x41/0xc0
    
    If we prevent VPMU from being initialized on PVH guests we will avoid
    those accesses.
    
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vpmu.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c
index 265fc0e..1df74c2 100644
--- a/xen/arch/x86/hvm/vpmu.c
+++ b/xen/arch/x86/hvm/vpmu.c
@@ -219,6 +219,9 @@ void vpmu_initialise(struct vcpu *v)
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     uint8_t vendor = current_cpu_data.x86_vendor;
 
+    if ( is_pvh_vcpu(v) )
+        return;
+
     if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         vpmu_destroy(v);
     vpmu_clear(vpmu);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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