[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 1/3] x86/vpmu: Add get/put_vpmu() and VPMU_AVAILABLE
On 02/21/2017 06:00 AM, Andrew Cooper wrote: > On 17/02/17 17:40, Boris Ostrovsky wrote: >> @@ -509,15 +498,63 @@ void vpmu_initialise(struct vcpu *v) >> if ( ret ) >> printk(XENLOG_G_WARNING "VPMU: Initialization failed for %pv\n", v); >> >> - /* Intel needs to initialize VPMU ops even if VPMU is not in use */ >> - if ( !is_priv_vpmu && >> - (ret || (vpmu_mode == XENPMU_MODE_OFF) || >> - (vpmu_mode == XENPMU_MODE_ALL)) ) >> + return ret; >> +} >> + >> +static void get_vpmu(struct vcpu *v) >> +{ >> + spin_lock(&vpmu_lock); >> + >> + /* >> + * Count active VPMUs so that we won't try to change vpmu_mode while >> + * they are in use. >> + * vpmu_mode can be safely updated while dom0's VPMUs are active and >> + * so we don't need to include it in the count. >> + */ >> + if ( !is_hardware_domain(v->domain) && >> + (vpmu_mode & (XENPMU_MODE_SELF | XENPMU_MODE_HV)) ) >> + { >> + vpmu_count++; >> + vpmu_set(vcpu_vpmu(v), VPMU_AVAILABLE); >> + } >> + else if ( is_hardware_domain(v->domain) && >> + (vpmu_mode != XENPMU_MODE_OFF) ) >> + vpmu_set(vcpu_vpmu(v), VPMU_AVAILABLE); > Why do we recalculate AVAILABLE on every get()? > > (In the absence of toolstack control from the CPUID side), surely it > should be set (or not) exactly once during domain creation, and be > unchanged thereafter? Yes, that's exactly what's happening -- get_vpmu() is only called from vcpu_initialise() -> vpmu_initialise() and so we set VPMU_AVAILABLE only once for a VCPU. I am not sure what you are asking. -boris _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |