From patchwork Wed Feb 17 14:37:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 8339631 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 201A69F38B for ; Wed, 17 Feb 2016 14:40:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6898203C3 for ; Wed, 17 Feb 2016 14:40:29 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1251203B6 for ; Wed, 17 Feb 2016 14:40:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aW3Eo-0004wl-Gg; Wed, 17 Feb 2016 14:37:54 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aW3Em-0004wc-Lc for xen-devel@lists.xen.org; Wed, 17 Feb 2016 14:37:52 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 33/77-03225-FB584C65; Wed, 17 Feb 2016 14:37:51 +0000 X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1455719870!22806841!1 X-Originating-IP: [209.85.161.174] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23689 invoked from network); 17 Feb 2016 14:37:51 -0000 Received: from mail-yw0-f174.google.com (HELO mail-yw0-f174.google.com) (209.85.161.174) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Feb 2016 14:37:51 -0000 Received: by mail-yw0-f174.google.com with SMTP id u200so14317283ywf.0 for ; Wed, 17 Feb 2016 06:37:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cardoe.com; s=google; h=from:to:cc:subject:date:message-id; bh=hJy1/YNJnWXHFS5yZUQO0XgZU6Fwm9A0ksEzk2jmHxA=; b=ikhLktb/io9wdSJzVAoknkQhSwKg0vs+lHaXezdbl2V5/fUtbbvw1yH/INeA+n3rr6 LQlmI3ybRR3QF1WpHmJylyAn0DQHFbd1ZBGBCqSbfgp7D7BkMAMBSCPQs55nPWqs/kvX soHLxjoiLsovpZll8Q0EZiRO8mo+ueWCGnSfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hJy1/YNJnWXHFS5yZUQO0XgZU6Fwm9A0ksEzk2jmHxA=; b=L9eGA1taQAe/WawtJFCiTyTwY16CVeOg55VWHYZUm6QkwMpi4JjJ8pA1ggCZy+HA1j CvLEuiR1RW4M1V//AFyWV8dAk78zZwFTVAOQncwk+ZP9FoOMtb8KcApA1tqXSAALjF1U pwHmaWQD3WpTHgPNp6yqN4kEAvsBJuxm2RpJhuhFgMEqRSk8Bz/9AG0rz+MZV6Ey6w1I KtOdyC8ecFWgk98RKBy2Rsbx5LGq+RWi9nF7YWtePdkvYiQeEQ5yGFOwAihiVjfMXNyM TooN6J2+VlvsXk5AIMIyVqu5XjuC/mm+K1Y2Pvmrg+xn7mV0VImd4v2h3P5Jh0XozgLD W1Xg== X-Gm-Message-State: AG10YOSguSQzDgIxc9+TDLgUKRc2YuJr6uau6tEPBrfUr0zL9K2f0Yp2cwklMjHPzW5t/g== X-Received: by 10.13.237.132 with SMTP id w126mr1113426ywe.211.1455719870188; Wed, 17 Feb 2016 06:37:50 -0800 (PST) Received: from swanson.lan (c-68-46-196-185.hsd1.al.comcast.net. [68.46.196.185]) by smtp.gmail.com with ESMTPSA id r84sm926178ywe.54.2016.02.17.06.37.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 06:37:48 -0800 (PST) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Wed, 17 Feb 2016 08:37:31 -0600 Message-Id: <1455719856-20465-1-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.4.10 Cc: Kevin Tian , Keir Fraser , Suravee Suthikulpanit , Jun Nakajima , Andrew Cooper , Doug Goldstein , Aravind Gopalakrishnan , Jan Beulich , Boris Ostrovsky Subject: [Xen-devel] [PATCH v3 1/3] PMU: make {acquire, release}_pmu_ownership names consistent X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Andrew Cooper Reviewed-by: Boris Ostrovsky Acked-by: Kevin Tian --- CC: Boris Ostrovsky CC: Suravee Suthikulpanit CC: Aravind Gopalakrishnan CC: Keir Fraser CC: Jan Beulich CC: Andrew Cooper CC: Jun Nakajima CC: Kevin Tian 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(-) 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);