From: "Jan Beulich" Subject: Re: [PATCH v14 for-xen-4.5 09/21] x86/VPMU: Add public xenpmu.h Date: Fri, 24 Oct 2014 17:00:23 +0100 Message-ID: <544A93B7020000780004209A@mail.emea.novell.com> References: <1413580689-2750-1-git-send-email-boris.ostrovsky@oracle.com> <1413580689-2750-10-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1413580689-2750-10-git-send-email-boris.ostrovsky@oracle.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: Boris Ostrovsky Cc: kevin.tian@intel.com, keir@xen.org, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, tim@xen.org, dietmar.hahn@ts.fujitsu.com, xen-devel@lists.xen.org, Aravind.Gopalakrishnan@amd.com, jun.nakajima@intel.com, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org >>> On 17.10.14 at 23:17, wrote: > @@ -222,6 +215,12 @@ static int is_core2_vpmu_msr(u32 msr_index, int *type, int *index) > } > } > > +static inline int msraddr_to_bitpos(int x) > +{ > + ASSERT(x == (x & 0x1fff)); > + return x; > +} Now this is interesting: I indeed asked you to fix this while you move it, but (a) should such a fix be mentioned in the commit message and (b) even more so when you outright drop support for the other half of the possible MSR ranges. > @@ -367,12 +373,20 @@ static int core2_vpmu_alloc_resource(struct vcpu *v) > goto out_err; > vmx_write_guest_msr(MSR_CORE_PERF_GLOBAL_CTRL, 0); > > - core2_vpmu_cxt = xzalloc_bytes(sizeof(struct core2_vpmu_context) + > - (arch_pmc_cnt-1)*sizeof(struct arch_msr_pair)); > - if ( !core2_vpmu_cxt ) > + core2_vpmu_cxt = xzalloc_bytes(sizeof(*core2_vpmu_cxt) + Okay, you switched this one as I had asked for. But you don't really expect that I repeat this comment in various places, do you? I.e. I would have expected you to fix this uniformly, not just here. > + sizeof(uint64_t) * fixed_pmc_cnt + > + sizeof(struct xen_pmu_cntr_pair) * > + arch_pmc_cnt); > + p = xzalloc(uint64_t); > + if ( !core2_vpmu_cxt || !p ) > goto out_err; > > - vpmu->context = (void *)core2_vpmu_cxt; > + core2_vpmu_cxt->fixed_counters = sizeof(struct xen_pmu_intel_ctxt); I.e. here as well as in the AMD code as well as wherever else. Jan