Skip to contentSkip to conversation

x86/VPMU: implement ipc and arch filter flags

PATCH Superseded Brendan Gregg 4 participants 7 messages Jan 5, 2016 – Jan 8, 2016

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 x86/VPMU: implement ipc and arch filter flags

This introduces a way to have a restricted VPMU, by specifying one of two predefined groups of PMCs to make available. For secure environments, this allows the VPMU to be used without needing to enable all PMCs.

---
Changes in v5:
* addressing review comments from Kevin:
* simplified BTS DS_AREA filter
* improvements to comments, incl. matching Intel SDM descriptions

Changes in v4:
* changed table reference in comments, suggested by Dietmar

Changes in v3:
* addressing review comments from Boris:
* ensure final flag is validated
* code tidy

Changes in v2:
* feature flags can now be combined (eg, "vpmu=ipc,bts")
* addressing review comments from Boris:
* restrict DS_AREA and PEBS_ENABLE access when filters are in use
* better variable types
* include MSR_IA32_CMT_EVTSEL_UE_MASK flag

---
 docs/misc/xen-command-line.markdown | 15 ++++++++++-
 xen/arch/x86/cpu/vpmu.c             | 51 +++++++++++++++++++++++++++++--------
 xen/arch/x86/cpu/vpmu_intel.c       | 48 ++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/msr-index.h     |  1 +
 xen/include/public/pmu.h            | 14 ++++++++--
 5 files changed, 115 insertions(+), 14 deletions(-)
docs/misc/xen-command-line.markdown +14 -1
index 467dc8f..5ed0730 100644
@@ -1476,7 +1476,7 @@ Use Virtual Processor ID support if available.  This prevents the need for TLB
 flushes on VM entry and exit, increasing performance.
 
 ### vpmu
-> `= ( bts )`
+> `= ( <boolean> | { bts | ipc | arch [, ...] } )`
 
 > Default: `off`
 
@@ -1492,6 +1492,19 @@ wrong behaviour (see handle\_pmc\_quirk()).
 If 'vpmu=bts' is specified the virtualisation of the Branch Trace Store (BTS)
 feature is switched on on Intel processors supporting this feature.
 
+vpmu=ipc enables performance monitoring, but restricts the counters to the
+most minimum set possible: instructions, cycles, and reference cycles. These
+can be used to calculate instructions per cycle (IPC).
+
+vpmu=arch enables performance monitoring, but restricts the counters to the
+pre-defined architectural events only. These are exposed by cpuid, and listed
+in the Pre-Defined Architectural Performance Events table from the Intel 64
+and IA-32 Architectures Software Developer's Manual, Volume 3B, System
+Programming Guide, Part 2.
+
+If a boolean is not used, combinations of flags are allowed, comma separated.
+For example, vpmu=arch,bts.
+
 Note that if **watchdog** option is also specified vpmu will be turned off.
 
 *Warning:*
xen/arch/x86/cpu/vpmu.c +40 -11

80 lines not on this page · raw message

xen/arch/x86/cpu/vpmu_intel.c +48 -0

72 lines not on this page · raw message

xen/include/asm-x86/msr-index.h +1 -0
index 2b97861..84da631 100644
@@ -329,6 +329,7 @@
 
 /* Platform Shared Resource MSRs */
 #define MSR_IA32_CMT_EVTSEL		0x00000c8d
+#define MSR_IA32_CMT_EVTSEL_UE_MASK	0x0000ffff
 #define MSR_IA32_CMT_CTR		0x00000c8e
 #define MSR_IA32_PSR_ASSOC		0x00000c8f
 #define MSR_IA32_PSR_L3_QOS_CFG	0x00000c81
xen/include/public/pmu.h +12 -2
index 7753df0..0e1312c 100644
@@ -84,9 +84,19 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t);
 
 /*
  * PMU features:
- * - XENPMU_FEATURE_INTEL_BTS: Intel BTS support (ignored on AMD)
+ * - XENPMU_FEATURE_INTEL_BTS:  Intel BTS support (ignored on AMD)
+ * - XENPMU_FEATURE_IPC_ONLY:   Restrict PMCs to the most minimum set possible.
+ *                              Instructions, cycles, and ref cycles. Can be
+ *                              used to calculate instructions-per-cycle (IPC)
+ *                              (ignored on AMD).
+ * - XENPMU_FEATURE_ARCH_ONLY:  Restrict PMCs to the Intel Pre-Defined
+ *                              Architectural Performance Events exposed by
+ *                              cpuid and listed in the Intel developer's manual
+ *                              (ignored on AMD).
  */
-#define XENPMU_FEATURE_INTEL_BTS  1
+#define XENPMU_FEATURE_INTEL_BTS  (1<<0)
+#define XENPMU_FEATURE_IPC_ONLY   (1<<1)
+#define XENPMU_FEATURE_ARCH_ONLY  (1<<2)
 
 /*
  * Shared PMU data between hypervisor and PV(H) domains.
Signature · 1 line
1.9.1
Acked-by on v5 1/1
#1 lore raw
Quoted 9 lines

From: Brendan Gregg [mailto:[email protected]]
Sent: Tuesday, January 05, 2016 9:44 AM

This introduces a way to have a restricted VPMU, by specifying one of two predefined groups of PMCs to make available. For secure environments, this allows the VPMU to be used without needing to enable all PMCs.

#2 lore raw
In reply to Brendan Gregg
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 05.01.16 at 02:43, <[email protected]> wrote:

This introduces a way to have a restricted VPMU, by specifying one of two predefined groups of PMCs to make available. For secure environments, this allows the VPMU to be used without needing to enable all PMCs.

Does this hold with ...

Quoted 5 lines

---
Changes in v5:
* addressing review comments from Kevin:
* simplified BTS DS_AREA filter
* improvements to comments, incl. matching Intel SDM descriptions

... all of these?

Jan

#3 lore raw
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 05.01.16 at 02:43, <[email protected]> wrote:

This introduces a way to have a restricted VPMU, by specifying one of two predefined groups of PMCs to make available. For secure environments, this allows the VPMU to be used without needing to enable all PMCs.

Quoted 9 lines

Does this hold with ...

Quoted 5 lines

---
Changes in v5:
* addressing review comments from Kevin:
* simplified BTS DS_AREA filter
* improvements to comments, incl. matching Intel SDM descriptions

... all of these?

Yes.

Note that this patch will conflict with http://lists.xenproject.org/archives/html/xen-devel/2015-12/msg02753.html (for 'case MSR_IA32_PEBS_ENABLE' in core2_vpmu_do_wrmsr()). I can rebase it on top of Brendan's if you prefer.

-boris

#4 lore raw
In reply to Brendan Gregg
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 05.01.16 at 02:43, <[email protected]> wrote:

This introduces a way to have a restricted VPMU, by specifying one of two predefined groups of PMCs to make available. For secure environments, this allows the VPMU to be used without needing to enable all PMCs.

I was about to apply with

xen/arch/x86/cpu/vpmu.c CHECK_pmu_data; · line 64

Quoted 4 lines

static DEFINE_PER_CPU(struct vcpu *, last_vcpu);

xen/arch/x86/cpu/vpmu.c +1 -1
-static void __init parse_vpmu_param(char *s)
+static int parse_vpmu_param(char *s, int len)

static bool_t __init parse_vpmu_param(char *s, unsigned int len)

Quoted 2 lines

{
+ if ( ! *s || ! len )

    if ( !*s || !len )
Quoted 24 lines
xen/arch/x86/cpu/vpmu.c +16 -3
+        return 0;
+    if ( !strncmp(s, "bts", len) )
+        vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
+    else if ( !strncmp(s, "ipc", len) )
+        vpmu_features |= XENPMU_FEATURE_IPC_ONLY;
+    else if ( !strncmp(s, "arch", len) )
+        vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
+    else
+        return 1;
+    return 0;
+}
+
+static void __init parse_vpmu_params(char *s)
+{
+    char *sep, *p = s;
+
     switch ( parse_bool(s) )
     {
     case 0:
         break;
     default:
-        if ( !strcmp(s, "bts") )
-            vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
-        else if ( *s )

xen/arch/x86/cpu/vpmu.c CHECK_pmu_data; · line 95

Quoted 10 lines
xen/arch/x86/cpu/vpmu.c +7 -2
+        while (1)
         {
-            printk("VPMU: unknown flag: %s - vpmu disabled!\n", s);
-            break;
+            sep = strchr(p, ',');
+            if ( sep == NULL )
+                sep = strchr(p, 0);
+            if ( parse_vpmu_param(p, sep - p) )
+                goto error;
+            if ( *sep == 0 )
            if ( !*sep )

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, · line 609

Quoted 9 lines
xen/arch/x86/cpu/vpmu_intel.c +2 -0
@@ -604,12 +604,17 @@ static int core2_vpmu_do_wrmsr(unsigned int msr, 
 uint64_t msr_content,
                  "MSR_PERF_GLOBAL_STATUS(0x38E)!\n");
         return -EINVAL;
     case MSR_IA32_PEBS_ENABLE:
+        if ( vpmu_features & (XENPMU_FEATURE_IPC_ONLY |
+             XENPMU_FEATURE_ARCH_ONLY) )

XENPMU_FEATURE_ARCH_ONLY) )

Quoted 6 lines
xen/arch/x86/cpu/vpmu_intel.c +2 -0
@@ -656,12 +661,55 @@ static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,
         tmp = msr - MSR_P6_EVNTSEL(0);
         if ( tmp >= 0 && tmp < arch_pmc_cnt )
         {
+            bool_t blocked = 0;
+            uint64_t umaskevent;

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, · line 675

Quoted 10 lines
xen/arch/x86/cpu/vpmu_intel.c +4 -0
             struct xen_pmu_cntr_pair *xen_pmu_cntr_pair =
                 vpmu_reg_pointer(core2_vpmu_cxt, arch_counters);
 
             if ( msr_content & ARCH_CTRL_MASK )
                 return -EINVAL;
 
+            /* PMC filters */
+            umaskevent = msr_content & MSR_IA32_CMT_EVTSEL_UE_MASK;
+            if ( vpmu_features & XENPMU_FEATURE_IPC_ONLY ||
+                 vpmu_features & XENPMU_FEATURE_ARCH_ONLY )

if ( vpmu_features & (XENPMU_FEATURE_IPC_ONLY |
XENPMU_FEATURE_ARCH_ONLY) )

Quoted 6 lines
xen/arch/x86/cpu/vpmu_intel.c +6 -0
+            {
+                blocked = 1;
+                switch ( umaskevent )
+                {
+                /*
+                 * See the Pre-Defined Architectural Performance Events table

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, · line 691

Quoted 10 lines
xen/arch/x86/cpu/vpmu_intel.c +10 -0
+                 * from the Intel 64 and IA-32 Architectures Software
+                 * Developer's Manual, Volume 3B, System Programming Guide,
+                 * Part 2.
+                 */
+                case 0x003c:	/* UnHalted Core Cycles */
+                case 0x013c:	/* UnHalted Reference Cycles */
+                case 0x00c0:	/* Instructions Retired */
+                    blocked = 0;
+                default:
+                    break;

dropped last two lines

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, · line 697

Quoted 6 lines
xen/arch/x86/cpu/vpmu_intel.c +6 -0
+                }
+            }
+
+            if ( vpmu_features & XENPMU_FEATURE_ARCH_ONLY )
+            {
+                /* additional counters beyond IPC only; blocked already set */
                /* Additional counters beyond IPC only; blocked already set. */

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, · line 706

Quoted 9 lines
xen/arch/x86/cpu/vpmu_intel.c +9 -0
+                switch ( umaskevent )
+                {
+                case 0x4f2e:	/* Last Level Cache References */
+                case 0x412e:	/* Last Level Cache Misses */
+                case 0x00c4:	/* Branch Instructions Retired */
+                case 0x00c5:	/* All Branch Mispredict Retired */
+                    blocked = 0;
+                default:
+                    break;

Again

Quoted 11 lines
xen/include/public/pmu.h +4 -1
@@ -84,9 +84,19 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t);
 
 /*
  * PMU features:
- * - XENPMU_FEATURE_INTEL_BTS: Intel BTS support (ignored on AMD)
+ * - XENPMU_FEATURE_INTEL_BTS:  Intel BTS support (ignored on AMD)
+ * - XENPMU_FEATURE_IPC_ONLY:   Restrict PMCs to the most minimum set possible.
+ *                              Instructions, cycles, and ref cycles. Can be
+ *                              used to calculate instructions-per-cycle (IPC)

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t); · line 99

Quoted 10 lines
xen/include/public/pmu.h +8 -1
+ *                              (ignored on AMD).
+ * - XENPMU_FEATURE_ARCH_ONLY:  Restrict PMCs to the Intel Pre-Defined
+ *                              Architectural Performance Events exposed by
+ *                              cpuid and listed in the Intel developer's manual
+ *                              (ignored on AMD).
  */
-#define XENPMU_FEATURE_INTEL_BTS  1
+#define XENPMU_FEATURE_INTEL_BTS  (1<<0)
+#define XENPMU_FEATURE_IPC_ONLY   (1<<1)
+#define XENPMU_FEATURE_ARCH_ONLY  (1<<2)

when I reached this: Do these additions really need to go here? And if they do, why does do_xenpmu_op()'s XENPMU_feature_set case not get altered?

Jan

#5 lore raw
Quoted 9 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 05.01.16 at 02:43, <[email protected]> wrote:

This introduces a way to have a restricted VPMU, by specifying one of two predefined groups of PMCs to make available. For secure environments,

this

Quoted 4 lines

allows the VPMU to be used without needing to enable all PMCs.

Quoted 9 lines

I was about to apply with

xen/arch/x86/cpu/vpmu.c CHECK_pmu_data; · line 64

Quoted 4 lines

static DEFINE_PER_CPU(struct vcpu *, last_vcpu);

xen/arch/x86/cpu/vpmu.c +1 -1
-static void __init parse_vpmu_param(char *s)
+static int parse_vpmu_param(char *s, int len)

static bool_t __init parse_vpmu_param(char *s, unsigned int len)

Ok.

Quoted 7 lines
Quoted 3 lines

{
+ if ( ! *s || ! len )

    if ( !*s || !len )

Ok.

Quoted 28 lines
Quoted 28 lines
xen/arch/x86/cpu/vpmu.c +17 -5
+        return 0;
+    if ( !strncmp(s, "bts", len) )
+        vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
+    else if ( !strncmp(s, "ipc", len) )
+        vpmu_features |= XENPMU_FEATURE_IPC_ONLY;
+    else if ( !strncmp(s, "arch", len) )
+        vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
+    else
+        return 1;
+    return 0;
+}
+
+static void __init parse_vpmu_params(char *s)
+{
+    char *sep, *p = s;
+
     switch ( parse_bool(s) )
     {
     case 0:
         break;
     default:
-        if ( !strcmp(s, "bts") )
-            vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
-        else if ( *s )
+        while (1)
         {
-            printk("VPMU: unknown flag: %s - vpmu disabled!\n", s);
-            break;
Quoted 10 lines

xen/arch/x86/cpu/vpmu.c CHECK_pmu_data; · line 95

Quoted 6 lines
xen/arch/x86/cpu/vpmu.c +6 -0
+            sep = strchr(p, ',');
+            if ( sep == NULL )
+                sep = strchr(p, 0);
+            if ( parse_vpmu_param(p, sep - p) )
+                goto error;
+            if ( *sep == 0 )
            if ( !*sep )

Ok.

Quoted 13 lines

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, · line 609

Quoted 9 lines
xen/arch/x86/cpu/vpmu_intel.c +2 -0
@@ -604,12 +604,17 @@ static int core2_vpmu_do_wrmsr(unsigned int msr,
 uint64_t msr_content,
                  "MSR_PERF_GLOBAL_STATUS(0x38E)!\n");
         return -EINVAL;
     case MSR_IA32_PEBS_ENABLE:
+        if ( vpmu_features & (XENPMU_FEATURE_IPC_ONLY |
+             XENPMU_FEATURE_ARCH_ONLY) )

XENPMU_FEATURE_ARCH_ONLY) )

Ok, yes, neater.

Quoted 13 lines

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr,

Quoted 1 line
xen/arch/x86/cpu/vpmu_intel.c +0 -0
@@ -656,12 +661,55 @@ static int core2_vpmu_do_wrmsr(unsigned int msr,

uint64_t msr_content,

Quoted 11 lines
xen/arch/x86/cpu/vpmu_intel.c +2 -0
         tmp = msr - MSR_P6_EVNTSEL(0);
         if ( tmp >= 0 && tmp < arch_pmc_cnt )
         {
+            bool_t blocked = 0;
+            uint64_t umaskevent;
             struct xen_pmu_cntr_pair *xen_pmu_cntr_pair =
                 vpmu_reg_pointer(core2_vpmu_cxt, arch_counters);
 
             if ( msr_content & ARCH_CTRL_MASK )
                 return -EINVAL;
 
Quoted 9 lines

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, · line 675

Quoted 4 lines
xen/arch/x86/cpu/vpmu_intel.c +4 -0
+            /* PMC filters */
+            umaskevent = msr_content & MSR_IA32_CMT_EVTSEL_UE_MASK;
+            if ( vpmu_features & XENPMU_FEATURE_IPC_ONLY ||
+                 vpmu_features & XENPMU_FEATURE_ARCH_ONLY )

if ( vpmu_features & (XENPMU_FEATURE_IPC_ONLY |
XENPMU_FEATURE_ARCH_ONLY) )

Ok.

Quoted 19 lines

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,

Quoted 6 lines
xen/arch/x86/cpu/vpmu_intel.c +6 -0
+            {
+                blocked = 1;
+                switch ( umaskevent )
+                {
+                /*
+                 * See the Pre-Defined Architectural Performance Events

table

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, · line 683

Quoted 2 lines
xen/arch/x86/cpu/vpmu_intel.c +2 -0
+                 * from the Intel 64 and IA-32 Architectures Software
+                 * Developer's Manual, Volume 3B, System Programming

Guide,

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, · line 691

Quoted 8 lines
xen/arch/x86/cpu/vpmu_intel.c +8 -0
+                 * Part 2.
+                 */
+                case 0x003c: /* UnHalted Core Cycles */
+                case 0x013c: /* UnHalted Reference Cycles */
+                case 0x00c0: /* Instructions Retired */
+                    blocked = 0;
+                default:
+                    break;
Quoted 3 lines

dropped last two lines

Ok.

Quoted 21 lines

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,

Quoted 6 lines
xen/arch/x86/cpu/vpmu_intel.c +6 -0
+                }
+            }
+
+            if ( vpmu_features & XENPMU_FEATURE_ARCH_ONLY )
+            {
+                /* additional counters beyond IPC only; blocked already

set */

                /* Additional counters beyond IPC only; blocked already

set. */

xen/arch/x86/cpu/vpmu_intel.c static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, · line 706

Quoted 9 lines
xen/arch/x86/cpu/vpmu_intel.c +9 -0
+                switch ( umaskevent )
+                {
+                case 0x4f2e: /* Last Level Cache References */
+                case 0x412e: /* Last Level Cache Misses */
+                case 0x00c4: /* Branch Instructions Retired */
+                case 0x00c5: /* All Branch Mispredict Retired */
+                    blocked = 0;
+                default:
+                    break;
Quoted 2 lines

Again

Ok.

Quoted 21 lines

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t); · line 88

Quoted 10 lines
xen/include/public/pmu.h +2 -1
@@ -84,9 +84,19 @@ DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t);
 
 /*
  * PMU features:
- * - XENPMU_FEATURE_INTEL_BTS: Intel BTS support (ignored on AMD)
+ * - XENPMU_FEATURE_INTEL_BTS:  Intel BTS support (ignored on AMD)
+ * - XENPMU_FEATURE_IPC_ONLY:   Restrict PMCs to the most minimum set

possible.

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t); · line 89

Quoted 1 line
xen/include/public/pmu.h +1 -0
+ *                              Instructions, cycles, and ref cycles.

Can be

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t); · line 90

Quoted 1 line
xen/include/public/pmu.h +1 -0
+ *                              used to calculate

instructions-per-cycle (IPC)

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t);

Quoted 3 lines
xen/include/public/pmu.h +3 -0
+ *                              (ignored on AMD).
+ * - XENPMU_FEATURE_ARCH_ONLY:  Restrict PMCs to the Intel Pre-Defined
+ *                              Architectural Performance Events

exposed by

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t); · line 94

Quoted 1 line
xen/include/public/pmu.h +1 -0
+ *                              cpuid and listed in the Intel

developer's manual

Quoted 11 lines

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t); · line 99

Quoted 6 lines
xen/include/public/pmu.h +4 -1
+ *                              (ignored on AMD).
  */
-#define XENPMU_FEATURE_INTEL_BTS  1
+#define XENPMU_FEATURE_INTEL_BTS  (1<<0)
+#define XENPMU_FEATURE_IPC_ONLY   (1<<1)
+#define XENPMU_FEATURE_ARCH_ONLY  (1<<2)

when I reached this: Do these additions really need to go here? And if they do, why does do_xenpmu_op()'s XENPMU_feature_set case not get altered?

I'd say they do, as it's pmu.h, and it places them with the BTS feature, other PMU modes, etc. Unless I'm missing some consideration.

Yes, I missed the new sysfs PMU interface, so do_xenpmu_op() should do:

case XENPMU_feature_set:
if ( pmu_params.val & ~(XENPMU_FEATURE_INTEL_BTS |
XENPMU_FEATURE_IPC_ONLY | XENPMU_FEATURE_ARCH_ONLY))
return -EINVAL;

I can send along a v6 patch with the other changes too if that's desirable. Thanks, and sorry for the nuisance.

Brendan

Signature · 1 line
Brendan Gregg, Senior Performance Architect, Netflix

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 07.01.16 at 22:40, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich

xen/include/public/pmu.h DEFINE_XEN_GUEST_HANDLE(xen_pmu_params_t); · line 99

Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 05.01.16 at 02:43, <[email protected]> wrote:
xen/include/public/pmu.h +3 -1
-#define XENPMU_FEATURE_INTEL_BTS  1
+#define XENPMU_FEATURE_INTEL_BTS  (1<<0)
+#define XENPMU_FEATURE_IPC_ONLY   (1<<1)
+#define XENPMU_FEATURE_ARCH_ONLY  (1<<2)

when I reached this: Do these additions really need to go here? And if they do, why does do_xenpmu_op()'s XENPMU_feature_set case not get altered?

I'd say they do, as it's pmu.h, and it places them with the BTS feature, other PMU modes, etc. Unless I'm missing some consideration.

Yes, I missed the new sysfs PMU interface, so do_xenpmu_op() should do:

Quoted 7 lines

case XENPMU_feature_set:
if ( pmu_params.val & ~(XENPMU_FEATURE_INTEL_BTS |
XENPMU_FEATURE_IPC_ONLY | XENPMU_FEATURE_ARCH_ONLY))
return -EINVAL;

I can send along a v6 patch with the other changes too if that's desirable.

That's not just desirable, but what I would expect to happen. I'm certainly not going to have a second go at fixing up the patch for you.

Jan