From: "Jan Beulich" Subject: Re: [PATCH v7 05/19] intel/VPMU: Clean up Intel VPMU code Date: Tue, 10 Jun 2014 09:19:27 +0100 Message-ID: <5396DBAF0200007800019519@mail.emea.novell.com> References: <1402076415-26475-1-git-send-email-boris.ostrovsky@oracle.com> <1402076415-26475-6-git-send-email-boris.ostrovsky@oracle.com> <539209AC.4070607@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <539209AC.4070607@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper , Boris Ostrovsky Cc: kevin.tian@intel.com, keir@xen.org, suravee.suthikulpanit@amd.com, tim@xen.org, dietmar.hahn@ts.fujitsu.com, xen-devel@lists.xen.org, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 06.06.14 at 20:34, wrote: > On 06/06/14 18:40, Boris Ostrovsky wrote: >> -static int arch_pmc_cnt; >> + eax = cpuid_eax(0xa); >> + return ( (eax & PMU_GENERAL_NR_MASK) >> PMU_GENERAL_NR_SHIFT ); >> +} > > This (and later) can be made much simpler. The style guidelines easily > permit: > > static int core2_get_arch_pmc_count(void) > { > return (cpuid_eax(0xa) & PMU_GENERAL_NR_MASK) >> PMU_GENERAL_NR_SHIFT; > } The above can be further simplified using MASK_EXTR(), at once eliminating the need for *_SHIFT constants. > Unrelated to this code itself, I wonder whether Xen should gain some > mnemonics for cpuid leaves. We already have XSTATE_CPUID, so it would indeed seem desirable to name 0xa too. Jan