diff options
author | Boris Ostrovsky <boris.ostrovsky@oracle.com> | 2014-11-27 14:02:45 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2014-11-27 14:02:45 +0100 |
commit | 6d35f0f0cf072fe6313e6cc90ad5ed314a05e0c4 (patch) | |
tree | c4b47b084b1d67b92d3da94e054cb226b86440cd | |
parent | c5397354b998d030b021810b8202de93b9526818 (diff) |
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@oracle.com>
Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | 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 265fc0ecbb..1df74c2947 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); |