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.ostrov...@oracle.com> --- xen/arch/x86/hvm/vpmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c index aec7b5f..4daa993 100644 --- a/xen/arch/x86/hvm/vpmu.c +++ b/xen/arch/x86/hvm/vpmu.c @@ -218,6 +218,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); -- 1.8.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel