[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/3] x86/vpmu: Decrement vpmu_count early in vpmu_destroy()
vpmu_count should be decremented even if VPMU_CONTEXT_ALLOCATED is not set because on Intel processors the context is allocated lazily and, in fact, might never happen. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> --- xen/arch/x86/cpu/vpmu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c index 0252171..9fa8a18 100644 --- a/xen/arch/x86/cpu/vpmu.c +++ b/xen/arch/x86/cpu/vpmu.c @@ -536,6 +536,11 @@ void vpmu_destroy(struct vcpu *v) { struct vpmu_struct *vpmu = vcpu_vpmu(v); + spin_lock(&vpmu_lock); + if ( !is_hardware_domain(v->domain) ) + vpmu_count--; + spin_unlock(&vpmu_lock); + if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) ) return; @@ -557,11 +562,6 @@ void vpmu_destroy(struct vcpu *v) vpmu_save_force, v, 1); vpmu->arch_vpmu_ops->arch_vpmu_destroy(v); } - - spin_lock(&vpmu_lock); - if ( !is_hardware_domain(v->domain) ) - vpmu_count--; - spin_unlock(&vpmu_lock); } static int pvpmu_init(struct domain *d, xen_pmu_params_t *params) -- 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |