From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v6 08/19] x86/VPMU: Add public xenpmu.h Date: Tue, 20 May 2014 13:28:18 -0400 Message-ID: <537B90B2.2040405@oracle.com> References: <1399996413-1998-1-git-send-email-boris.ostrovsky@oracle.com> <1399996413-1998-9-git-send-email-boris.ostrovsky@oracle.com> <537B8FD3020000780001435C@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <537B8FD3020000780001435C@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: kevin.tian@intel.com, keir@xen.org, jun.nakajima@intel.com, andrew.cooper3@citrix.com, donald.d.dugger@intel.com, xen-devel@lists.xen.org, dietmar.hahn@ts.fujitsu.com, suravee.suthikulpanit@amd.com List-Id: xen-devel@lists.xenproject.org On 05/20/2014 11:24 AM, Jan Beulich wrote: > >> --- /dev/null >> +++ b/xen/include/public/arch-x86/pmu.h >> @@ -0,0 +1,62 @@ >> +#ifndef __XEN_PUBLIC_ARCH_X86_PMU_H__ >> +#define __XEN_PUBLIC_ARCH_X86_PMU_H__ >> + >> +/* x86-specific PMU definitions */ >> + >> +/* AMD PMU registers and structures */ >> +struct xen_pmu_amd_ctxt { >> + uint32_t counters; /* Offset to counter MSRs */ >> + uint32_t ctrls; /* Offset to control MSRs */ >> +}; >> + >> +/* Intel PMU registers and structures */ >> +struct xen_pmu_cntr_pair { >> + uint64_t counter; >> + uint64_t control; >> +}; >> + >> +struct xen_pmu_intel_ctxt { >> + uint64_t global_ctrl; >> + uint64_t global_ovf_ctrl; >> + uint64_t global_status; >> + uint64_t fixed_ctrl; >> + uint64_t ds_area; >> + uint64_t pebs_enable; >> + uint64_t debugctl; >> + uint32_t fixed_counters; /* Offset to fixed counter MSRs */ >> + uint32_t arch_counters; /* Offset to architectural counter MSRs */ >> +}; >> + >> +#define XENPMU_MAX_CTXT_SZ (sizeof(struct xen_pmu_amd_ctxt) > \ >> + sizeof(struct xen_pmu_intel_ctxt) ? \ >> + sizeof(struct xen_pmu_amd_ctxt) : \ >> + sizeof(struct xen_pmu_intel_ctxt)) >> +#define XENPMU_CTXT_PAD_SZ (((XENPMU_MAX_CTXT_SZ + 64) & ~63) + 128) > Is this really usefully derived from XENPMU_MAX_CTXT_SZ? I.e. is it > okay for this value to change when one of the structures grows big > enough? I would have thought that the padding below is to fix the > size of the structure once and for all (and if that's right, I suppose > a respective BUILD_BUG_ON() would be quite desirable). Yes, the way XENPMU_CTXT_PAD_SZ is calculated is wrong, it should be a fixed value, not derived from arch-specific structures sizes. >> --- /dev/null >> +++ b/xen/include/public/pmu.h >> @@ -0,0 +1,38 @@ >> +#ifndef __XEN_PUBLIC_PMU_H__ >> +#define __XEN_PUBLIC_PMU_H__ >> + >> +#include "xen.h" >> +#if defined(__i386__) || defined(__x86_64__) >> +#include "arch-x86/pmu.h" >> +#elif defined (__arm__) || defined (__aarch64__) >> +#include "arch-arm.h" >> +#else >> +#error "Unsupported architecture" >> +#endif >> + >> +#define XENPMU_VER_MAJ 0 >> +#define XENPMU_VER_MIN 0 > Do you really want to start at 0.0? Right, I'll start with 0.1 -boris