[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-xen-4.5] x86/pvh/vpmu: Disable VPMU for PVH guests
>>> On 24.11.14 at 20:49, <boris.ostrovsky@xxxxxxxxxx> wrote: > 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. I think this fix is too specific; instead we should mark the LAPIC disabled, which will implicitly prevent the issue afaict - see below. Jan x86/PVH: properly disable vLAPIC Rather than guarding higher level operations (like vPMU initialization as suggested by Boris in http://lists.xenproject.org/archives/html/xen-devel/2014-11/msg02278.html) mark the vLAPIC hardware disabled for PVH guests and prevent it from getting moved out of this state. Reported-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2217,8 +2217,7 @@ int hvm_vcpu_initialise(struct vcpu *v) goto fail1; /* NB: vlapic_init must be called before hvm_funcs.vcpu_initialise */ - if ( is_hvm_vcpu(v) ) - rc = vlapic_init(v); + rc = vlapic_init(v); if ( rc != 0 ) /* teardown: vlapic_destroy */ goto fail2; @@ -4483,7 +4482,8 @@ int hvm_msr_write_intercept(unsigned int break; case MSR_IA32_APICBASE: - if ( !vlapic_msr_set(vcpu_vlapic(v), msr_content) ) + if ( unlikely(is_pvh_vcpu(v)) || + !vlapic_msr_set(vcpu_vlapic(v), msr_content) ) goto gp_fault; break; --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -1429,6 +1429,12 @@ int vlapic_init(struct vcpu *v) HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "%d", v->vcpu_id); + if ( is_pvh_vcpu(v) ) + { + vlapic->hw.disabled = VLAPIC_HW_DISABLED; + return 0; + } + vlapic->pt.source = PTSRC_lapic; if (vlapic->regs_page == NULL) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |