vpmu intel: move setting alloc flag
PATCH 1/1 vpmu intel: move setting alloc flag
Hi,
This simple patch moves the setting of the ALLOCATED flag to where the allocation gets done.
Dietmar.
xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Mar 12 14:30:37 2013 +0100 renamed from xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Mar 11 16:13:42 2013 +0000 +1 -1
@@ -346,6 +346,7 @@ static int core2_vpmu_alloc_resource(str goto out2; core2_vpmu_cxt->pmu_enable = pmu_enable; vpmu->context = (void *)core2_vpmu_cxt; + vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED); return 1; out2:
@@ -384,7 +385,6 @@ static int core2_vpmu_msr_common_check(u (vpmu->context != NULL || !core2_vpmu_alloc_resource(current)) ) return 0; - vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED); /* Do the lazy load staff. */ if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) )
Signature · 1 line
Company details: http://ts.fujitsu.com/imprint.html
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Dietmar Hahn
This simple patch moves the setting of the ALLOCATED flag to where the allocation gets done.
While not wrong in any way, isn't the placement before this patch slightly more logical, namely because of ...
xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Mar 12 14:30:37 2013 +0100 static int core2_vpmu_msr_common_check(u
Quoted 15 lines
Signed-off-by Dietmar Hahn <[email protected]>diff -r
a6b81234b189xen/arch/x86/hvm/vmx/vpmu_core2.cxen/arch/x86/hvm/vmx/vpmu_core2.c Tue Mar 12 14:30:37 2013 +0100 renamed from xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Mar 11 16:13:42 2013 +0000 +1
-0@@ -346,6 +346,7 @@ static int core2_vpmu_alloc_resource(str goto out2; core2_vpmu_cxt->pmu_enable = pmu_enable; vpmu->context = (void *)core2_vpmu_cxt; + vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED); return 1; out2:@@ -384,7 +385,6 @@ static int core2_vpmu_msr_common_check(u
... the check here:
if ( unlikely(!vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED)) &&
xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Mar 12 14:30:37 2013 +0100 static int core2_vpmu_msr_common_check(u · line 387
Quoted 3 lines
xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Mar 12 14:30:37 2013 +0100 renamed from xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Mar 11 16:13:42 2013 +0000 +0
-0(vpmu->context != NULL || !core2_vpmu_alloc_resource(current)) ) return 0;
Or as another consistent alternative, I'd suggest to move the two other portions of the if() clause also into that function.
Jan
Quoted 13 lines
xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Mar 12 14:30:37 2013 +0100 renamed from xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Mar 11 16:13:42 2013 +0000 +0
-1- vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED); /* Do the lazy load staff. */ if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED) )Signature · 7 lines
-- Company details: http://ts.fujitsu.com/imprint.html _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel