diff mbox

[v3,1/3] PMU: make {acquire, release}_pmu_ownership names consistent

Message ID 1455719856-20465-1-git-send-email-cardoe@cardoe.com (mailing list archive)
State New, archived
Headers show

Commit Message

Douglas Goldstein Feb. 17, 2016, 2:37 p.m. UTC
The function names were inconsistent with acquire and release being
called acquire_pmu_ownership() and release_pmu_ownship() respectively.
Function prototypes were available for both spellings so this change
makes them consistent and drops the dual function prototypes.
Additionally change the internal variable names within those functions
to ownership as well.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
CC: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jun Nakajima <jun.nakajima@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>

change since v2:
- new in this series based on review
---
 xen/arch/x86/cpu/vpmu_amd.c   |  4 ++--
 xen/arch/x86/cpu/vpmu_intel.c |  4 ++--
 xen/common/xenoprof.c         | 12 ++++++------
 xen/include/asm-x86/vpmu.h    |  3 ---
 xen/include/xen/xenoprof.h    |  4 ++--
 5 files changed, 12 insertions(+), 15 deletions(-)

Comments

Andrew Cooper Feb. 17, 2016, 2:50 p.m. UTC | #1
On 17/02/16 14:37, Doug Goldstein wrote:
> The function names were inconsistent with acquire and release being
> called acquire_pmu_ownership() and release_pmu_ownship() respectively.
> Function prototypes were available for both spellings so this change
> makes them consistent and drops the dual function prototypes.
> Additionally change the internal variable names within those functions
> to ownership as well.
>
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Boris Ostrovsky Feb. 17, 2016, 2:52 p.m. UTC | #2
On 02/17/2016 09:37 AM, Doug Goldstein wrote:
> The function names were inconsistent with acquire and release being
> called acquire_pmu_ownership() and release_pmu_ownship() respectively.
> Function prototypes were available for both spellings so this change
> makes them consistent and drops the dual function prototypes.
> Additionally change the internal variable names within those functions
> to ownership as well.

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

although I think

>
> diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c
> index 19b4605..7a3fc86 100644
> --- a/xen/common/xenoprof.c
> +++ b/xen/common/xenoprof.c
> @@ -50,16 +50,16 @@ static u64 passive_samples;
>   static u64 idle_samples;
>   static u64 others_samples;
>   
> -int acquire_pmu_ownership(int pmu_ownship)
> +int acquire_pmu_ownership(int pmu_ownership)
>   {
>       

using 'new_pmu_owner' as argument might be slightly better.

-boris
Tian, Kevin Feb. 18, 2016, 6:36 a.m. UTC | #3
> From: Doug Goldstein [mailto:cardoe@cardoe.com]
> Sent: Wednesday, February 17, 2016 10:38 PM
> 
> The function names were inconsistent with acquire and release being
> called acquire_pmu_ownership() and release_pmu_ownship() respectively.
> Function prototypes were available for both spellings so this change
> makes them consistent and drops the dual function prototypes.
> Additionally change the internal variable names within those functions
> to ownership as well.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Acked-by: Kevin Tian <kevin.tian@intel.com>
diff mbox

Patch

diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index 990e6f3..55d03b3 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -393,7 +393,7 @@  static int amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,
         vpmu_reset(vpmu, VPMU_RUNNING);
         if ( has_hvm_container_vcpu(v) && is_msr_bitmap_on(vpmu) )
              amd_vpmu_unset_msr_bitmap(v);
-        release_pmu_ownship(PMU_OWNER_HVM);
+        release_pmu_ownership(PMU_OWNER_HVM);
     }
 
     if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_LOADED)
@@ -442,7 +442,7 @@  static void amd_vpmu_destroy(struct vcpu *v)
     vpmu->priv_context = NULL;
 
     if ( vpmu_is_set(vpmu, VPMU_RUNNING) )
-        release_pmu_ownship(PMU_OWNER_HVM);
+        release_pmu_ownership(PMU_OWNER_HVM);
 
     vpmu_clear(vpmu);
 }
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 50b5831..e8049ed 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -517,7 +517,7 @@  static int core2_vpmu_alloc_resource(struct vcpu *v)
     return 1;
 
 out_err:
-    release_pmu_ownship(PMU_OWNER_HVM);
+    release_pmu_ownership(PMU_OWNER_HVM);
 
     xfree(core2_vpmu_cxt);
     xfree(p);
@@ -892,7 +892,7 @@  static void core2_vpmu_destroy(struct vcpu *v)
     vpmu->priv_context = NULL;
     if ( has_hvm_container_vcpu(v) && cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v->arch.hvm_vmx.msr_bitmap);
-    release_pmu_ownship(PMU_OWNER_HVM);
+    release_pmu_ownership(PMU_OWNER_HVM);
     vpmu_clear(vpmu);
 }
 
diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c
index 19b4605..7a3fc86 100644
--- a/xen/common/xenoprof.c
+++ b/xen/common/xenoprof.c
@@ -50,16 +50,16 @@  static u64 passive_samples;
 static u64 idle_samples;
 static u64 others_samples;
 
-int acquire_pmu_ownership(int pmu_ownship)
+int acquire_pmu_ownership(int pmu_ownership)
 {
     spin_lock(&pmu_owner_lock);
     if ( pmu_owner == PMU_OWNER_NONE )
     {
-        pmu_owner = pmu_ownship;
+        pmu_owner = pmu_ownership;
         goto out;
     }
 
-    if ( pmu_owner == pmu_ownship )
+    if ( pmu_owner == pmu_ownership )
         goto out;
 
     spin_unlock(&pmu_owner_lock);
@@ -71,10 +71,10 @@  int acquire_pmu_ownership(int pmu_ownship)
     return 1;
 }
 
-void release_pmu_ownship(int pmu_ownship)
+void release_pmu_ownership(int pmu_ownership)
 {
     spin_lock(&pmu_owner_lock);
-    if ( pmu_ownship == PMU_OWNER_HVM )
+    if ( pmu_ownership == PMU_OWNER_HVM )
         pmu_hvm_refcount--;
     if ( !pmu_hvm_refcount )
         pmu_owner = PMU_OWNER_NONE;
@@ -847,7 +847,7 @@  ret_t do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg)
             break;
         x = current->domain->xenoprof;
         unshare_xenoprof_page_with_guest(x);
-        release_pmu_ownship(PMU_OWNER_XENOPROF);
+        release_pmu_ownership(PMU_OWNER_XENOPROF);
         break;
     }
 
diff --git a/xen/include/asm-x86/vpmu.h b/xen/include/asm-x86/vpmu.h
index 67e73dc..ed9ec07 100644
--- a/xen/include/asm-x86/vpmu.h
+++ b/xen/include/asm-x86/vpmu.h
@@ -121,9 +121,6 @@  static inline int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
     return vpmu_do_msr(msr, msr_content, 0, 0);
 }
 
-extern int acquire_pmu_ownership(int pmu_ownership);
-extern void release_pmu_ownership(int pmu_ownership);
-
 extern unsigned int vpmu_mode;
 extern unsigned int vpmu_features;
 
diff --git a/xen/include/xen/xenoprof.h b/xen/include/xen/xenoprof.h
index 7804e69..9b9ef56 100644
--- a/xen/include/xen/xenoprof.h
+++ b/xen/include/xen/xenoprof.h
@@ -73,8 +73,8 @@  int xenoprof_add_trace(struct vcpu *, uint64_t pc, int mode);
 #define PMU_OWNER_NONE          0
 #define PMU_OWNER_XENOPROF      1
 #define PMU_OWNER_HVM           2
-int acquire_pmu_ownship(int pmu_ownership);
-void release_pmu_ownship(int pmu_ownership);
+int acquire_pmu_ownership(int pmu_ownership);
+void release_pmu_ownership(int pmu_ownership);
 
 void xenoprof_log_event(struct vcpu *, const struct cpu_user_regs *,
                         uint64_t pc, int mode, int event);