From: "Jan Beulich" Subject: Re: [PATCH v1 06/13] x86/PMU: Add public xenpmu.h Date: Wed, 11 Sep 2013 09:13:25 +0100 Message-ID: <5230424502000078000F24BC@nat28.tlf.novell.com> References: <1378826470-4085-1-git-send-email-boris.ostrovsky@oracle.com> <1378826470-4085-7-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VJfYI-00078G-Ee for xen-devel@lists.xenproject.org; Wed, 11 Sep 2013 08:13:30 +0000 In-Reply-To: <1378826470-4085-7-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: suravee.suthikulpanit@amd.com, George.Dunlap@eu.citrix.com, jacob.shin@amd.com, eddie.dong@intel.com, dietmar.hahn@ts.fujitsu.com, jun.nakajima@intel.com, xen-devel List-Id: xen-devel@lists.xenproject.org > --- /dev/null > +++ b/xen/include/public/xenpmu.h This new file is completely unacceptable as a public header. > @@ -0,0 +1,101 @@ > +#ifndef __XEN_PUBLIC_XENPMU_H__ > +#define __XEN_PUBLIC_XENPMU_H__ > + > +#include This is a no-go. > + > +#include "xen.h" > + > +#define XENPMU_VER_MAJ 0 > +#define XENPMU_VER_MIN 0 > + > +/* VPMU modes */ > +#define VPMU_MODE_MASK 0xff All of these defines would need XEN_ prefixes (and types would similarly need xen_). And there ought to be some association in the comment to the field(s) that these constants would actually go into: >From a cursory look I can't see this. > +#define VPMU_OFF 0 > +/* guests can profile themselves, (dom0 profiles itself and Xen) */ Comment style. > +#define VPMU_ON (1<<0) > +/* > + * Only dom0 has access to VPMU and it profiles everyone: itself, > + * the hypervisor and the guests. > + */ > +#define VPMU_PRIV (1<<1) > + > +/* VPMU flags */ > +#define VPMU_FLAGS_MASK ((uint32_t)(~VPMU_MODE_MASK)) > +#define VPMU_INTEL_BTS (1<<8) /* Ignored on AMD */ > + > + > +/* AMD PMU registers and structures */ > +#define F10H_NUM_COUNTERS 4 > +#define F15H_NUM_COUNTERS 6 > +/* To accommodate more counters in the future (e.g. NB counters) */ > +#define MAX_NUM_COUNTERS 16 Perhaps better to have the number of counters in the structure? > +struct amd_vpmu_context { > + uint64_t counters[MAX_NUM_COUNTERS]; > + uint64_t ctrls[MAX_NUM_COUNTERS]; > + uint8_t msr_bitmap_set; > +}; > + > + > +/* Intel PMU registers and structures */ > +static const uint32_t core2_fix_counters_msr[] = { You're kidding, aren't you? Jan