[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v6 08/19] x86/VPMU: Add public xenpmu.h
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|