Blame SOURCES/libpfm-rhbz1440249.patch

4e2f91
From b9709a7866498a84dc4ab60fb006631569bedbf0 Mon Sep 17 00:00:00 2001
4e2f91
From: Stephane Eranian <eranian@gmail.com>
4e2f91
Date: Mon, 3 Apr 2017 22:48:31 -0700
4e2f91
Subject: [PATCH 1/7] Revert "fix struct validation for pfm_event_attr_info_t"
4e2f91
4e2f91
This reverts commit 06b296c72838be44d8950dc03227fe0dc8ca1fb1.
4e2f91
4e2f91
Break ABI compatibility from 4.7 to 4.8.
4e2f91
4e2f91
Signed-off-by: Stephane Eranian <eranian@gmail.com>
4e2f91
---
4e2f91
 include/perfmon/pfmlib.h | 5 ++---
4e2f91
 tests/validate.c         | 3 +--
4e2f91
 2 files changed, 3 insertions(+), 5 deletions(-)
4e2f91
4e2f91
diff --git a/include/perfmon/pfmlib.h b/include/perfmon/pfmlib.h
4e2f91
index 0e370ba50318..d9be4453accf 100644
4e2f91
--- a/include/perfmon/pfmlib.h
4e2f91
+++ b/include/perfmon/pfmlib.h
4e2f91
@@ -490,7 +490,6 @@ typedef struct {
4e2f91
 	size_t			size;	/* struct sizeof */
4e2f91
 	uint64_t		code;	/* attribute code */
4e2f91
 	pfm_attr_t		type;	/* attribute type */
4e2f91
-	int			pad;	/* padding */
4e2f91
 	uint64_t		idx;	/* attribute opaque index */
4e2f91
 	pfm_attr_ctrl_t		ctrl;	/* what is providing attr */
4e2f91
 	struct {
4e2f91
@@ -520,13 +519,13 @@ typedef struct {
4e2f91
 #if __WORDSIZE == 64
4e2f91
 #define PFM_PMU_INFO_ABI0	56
4e2f91
 #define PFM_EVENT_INFO_ABI0	64
4e2f91
-#define PFM_ATTR_INFO_ABI0	72
4e2f91
+#define PFM_ATTR_INFO_ABI0	64
4e2f91
 
4e2f91
 #define PFM_RAW_ENCODE_ABI0	32
4e2f91
 #else
4e2f91
 #define PFM_PMU_INFO_ABI0	44
4e2f91
 #define PFM_EVENT_INFO_ABI0	48
4e2f91
-#define PFM_ATTR_INFO_ABI0	56
4e2f91
+#define PFM_ATTR_INFO_ABI0	48
4e2f91
 
4e2f91
 #define PFM_RAW_ENCODE_ABI0	20
4e2f91
 #endif
4e2f91
diff --git a/tests/validate.c b/tests/validate.c
4e2f91
index 0da0adc4995a..522a6ab7140d 100644
4e2f91
--- a/tests/validate.c
4e2f91
+++ b/tests/validate.c
4e2f91
@@ -201,7 +201,6 @@ static const struct_desc_t pfmlib_structs[]={
4e2f91
 		FIELD(code, pfm_event_attr_info_t),
4e2f91
 		FIELD(type, pfm_event_attr_info_t),
4e2f91
 		FIELD(idx, pfm_event_attr_info_t),
4e2f91
-		FIELD(pad, pfm_event_attr_info_t), /* padding */
4e2f91
 		FIELD(ctrl, pfm_event_attr_info_t),
4e2f91
 		LAST_FIELD
4e2f91
 	 },
4e2f91
@@ -271,7 +270,7 @@ validate_structs(void)
4e2f91
 		}
4e2f91
 
4e2f91
 		if (sz != d->sz) {
4e2f91
-			printf("Failed (invisible padding of %zu bytes, total struct size %zu bytes)\n", d->sz - sz, d->sz);
4e2f91
+			printf("Failed (invisible padding of %zu bytes)\n", d->sz - sz);
4e2f91
 			errors++;
4e2f91
 			continue;
4e2f91
 		}
4e2f91
-- 
4e2f91
2.7.4
4e2f91
4e2f91
From 01c24ef2c781c614544eeb5ce3922313118e3053 Mon Sep 17 00:00:00 2001
4e2f91
From: Stephane Eranian <eranian@gmail.com>
4e2f91
Date: Mon, 3 Apr 2017 22:49:18 -0700
4e2f91
Subject: [PATCH 2/7] Revert "Fix pfmlib_parse_event_attr() parsing of raw
4e2f91
 umask for 32-bit"
4e2f91
4e2f91
This reverts commit bfb9baf1c8a9533fde271d0436ecd465934dfa17.
4e2f91
4e2f91
support for 32-bit umask as implemented breaks ABI between 4.7 and 4.8.
4e2f91
4e2f91
Signed-off-by: Stephane Eranian <eranian@gmail.com>
4e2f91
---
4e2f91
 lib/pfmlib_common.c | 8 ++++----
4e2f91
 1 file changed, 4 insertions(+), 4 deletions(-)
4e2f91
4e2f91
diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
4e2f91
index cff4d2ecbd2c..c88e2aaae274 100644
4e2f91
--- a/lib/pfmlib_common.c
4e2f91
+++ b/lib/pfmlib_common.c
4e2f91
@@ -1011,10 +1011,10 @@ pfmlib_parse_event_attr(char *str, pfmlib_event_desc_t *d)
4e2f91
 			ainfo->name = "RAW_UMASK";
4e2f91
 			ainfo->type = PFM_ATTR_RAW_UMASK;
4e2f91
 			ainfo->ctrl = PFM_ATTR_CTRL_PMU;
4e2f91
-			ainfo->idx  = strtoull(s, &endptr, 0);
4e2f91
+			ainfo->idx  = strtoul(s, &endptr, 0);
4e2f91
 			ainfo->equiv= NULL;
4e2f91
 			if (*endptr) {
4e2f91
-				DPRINT("raw umask (%s) is not a number\n", s);
4e2f91
+				DPRINT("raw umask (%s) is not a number\n");
4e2f91
 				return PFM_ERR_ATTR;
4e2f91
 			}
4e2f91
 
4e2f91
@@ -1368,9 +1368,9 @@ pfmlib_parse_event(const char *event, pfmlib_event_desc_t *d)
4e2f91
 	for (i = 0; i < d->nattrs; i++) {
4e2f91
 		pfm_event_attr_info_t *a = attr(d, i);
4e2f91
 		if (a->type != PFM_ATTR_RAW_UMASK)
4e2f91
-			DPRINT("%d %d %"PRIu64" %s\n", d->event, i, a->idx, d->pattrs[d->attrs[i].id].name);
4e2f91
+			DPRINT("%d %d %d %s\n", d->event, i, a->idx, d->pattrs[d->attrs[i].id].name);
4e2f91
 		else
4e2f91
-			DPRINT("%d %d RAW_UMASK (0x%"PRIx64")\n", d->event, i, a->idx);
4e2f91
+			DPRINT("%d %d RAW_UMASK (0x%x)\n", d->event, i, a->idx);
4e2f91
 	}
4e2f91
 error:
4e2f91
 	free(str);
4e2f91
-- 
4e2f91
2.7.4
4e2f91
4e2f91
From e206315c36e39409b7fc1e4cdd72caa5040b45c4 Mon Sep 17 00:00:00 2001
4e2f91
From: Stephane Eranian <eranian@gmail.com>
4e2f91
Date: Mon, 3 Apr 2017 22:52:22 -0700
4e2f91
Subject: [PATCH 3/7] Revert "Allow raw umask for OFFCORE_RESPONSE on Intel
4e2f91
 core PMUs"
4e2f91
4e2f91
This reverts commit 4dc4c6ada254f30eee8cd2ae27bb0869a111b613.
4e2f91
4e2f91
32-bit raw umask support break ABI between 4.7 and 4.8, so remove
4e2f91
for now.
4e2f91
4e2f91
Signed-off-by: Stephane Eranian <eranian@gmail.com>
4e2f91
---
4e2f91
 include/perfmon/pfmlib.h |   4 +-
4e2f91
 lib/pfmlib_intel_x86.c   |  16 ++--
4e2f91
 tests/validate_x86.c     | 232 -----------------------------------------------
4e2f91
 3 files changed, 9 insertions(+), 243 deletions(-)
4e2f91
4e2f91
diff --git a/include/perfmon/pfmlib.h b/include/perfmon/pfmlib.h
4e2f91
index d9be4453accf..6904c1c79b68 100644
4e2f91
--- a/include/perfmon/pfmlib.h
4e2f91
+++ b/include/perfmon/pfmlib.h
4e2f91
@@ -490,8 +490,8 @@ typedef struct {
4e2f91
 	size_t			size;	/* struct sizeof */
4e2f91
 	uint64_t		code;	/* attribute code */
4e2f91
 	pfm_attr_t		type;	/* attribute type */
4e2f91
-	uint64_t		idx;	/* attribute opaque index */
4e2f91
-	pfm_attr_ctrl_t		ctrl;	/* what is providing attr */
4e2f91
+	int			idx;	/* attribute opaque index */
4e2f91
+	pfm_attr_ctrl_t		ctrl;		/* what is providing attr */
4e2f91
 	struct {
4e2f91
 		unsigned int    is_dfl:1;	/* is default umask */
4e2f91
 		unsigned int    is_precise:1;	/* Intel X86: supports PEBS */
4e2f91
diff --git a/lib/pfmlib_intel_x86.c b/lib/pfmlib_intel_x86.c
4e2f91
index b698144f1da4..497cf1b9246a 100644
4e2f91
--- a/lib/pfmlib_intel_x86.c
4e2f91
+++ b/lib/pfmlib_intel_x86.c
4e2f91
@@ -481,18 +481,16 @@ pfm_intel_x86_encode_gen(void *this, pfmlib_event_desc_t *e)
4e2f91
 				reg.sel_event_select = last_ucode;
4e2f91
 			}
4e2f91
 		} else if (a->type == PFM_ATTR_RAW_UMASK) {
4e2f91
-			uint64_t rmask;
4e2f91
+
4e2f91
 			/* there can only be one RAW_UMASK per event */
4e2f91
-			if (intel_x86_eflag(this, e->event, INTEL_X86_NHM_OFFCORE)) {
4e2f91
-				rmask = (1ULL << 38) - 1;
4e2f91
-			} else {
4e2f91
-				rmask = 0xff;
4e2f91
-			}
4e2f91
-			if (a->idx & ~rmask) {
4e2f91
-				DPRINT("raw umask is too wide\n");
4e2f91
+
4e2f91
+			/* sanity check */
4e2f91
+			if (a->idx & ~0xff) {
4e2f91
+				DPRINT("raw umask is 8-bit wide\n");
4e2f91
 				return PFM_ERR_ATTR;
4e2f91
 			}
4e2f91
-			umask2  = a->idx & rmask;
4e2f91
+			/* override umask */
4e2f91
+			umask2 = a->idx & 0xff;
4e2f91
 			ugrpmsk = grpmsk;
4e2f91
 		} else {
4e2f91
 			uint64_t ival = e->attrs[k].ival;
4e2f91
diff --git a/tests/validate_x86.c b/tests/validate_x86.c
4e2f91
index 790ba585d8e7..906afba636e1 100644
4e2f91
--- a/tests/validate_x86.c
4e2f91
+++ b/tests/validate_x86.c
4e2f91
@@ -4057,238 +4057,6 @@ static const test_event_t x86_test_events[]={
4e2f91
 	  .fstr = "hsw::CYCLE_ACTIVITY:CYCLES_L2_PENDING:k=1:u=1:e=0:i=0:c=1:t=0:intx=0:intxcp=0",
4e2f91
 	},
4e2f91
 	{ SRC_LINE,
4e2f91
-	  .name = "wsm::offcore_response_0:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "wsm::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "wsm::offcore_response_0:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "wsm::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "wsm::offcore_response_0:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "snb::offcore_response_0:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "snb::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "snb::offcore_response_0:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "snb::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "snb::offcore_response_0:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "ivb_ep::offcore_response_0:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "ivb_ep::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "ivb_ep::offcore_response_0:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "ivb_ep::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "ivb_ep::offcore_response_0:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "hsw::offcore_response_0:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "hsw::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "hsw::offcore_response_0:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "hsw::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "hsw::offcore_response_0:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "bdw_ep::offcore_response_0:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "bdw_ep::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "bdw_ep::offcore_response_0:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "bdw_ep::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "bdw_ep::offcore_response_0:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "skl::offcore_response_0:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "skl::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "skl::offcore_response_0:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301b7,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "skl::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "skl::offcore_response_0:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "wsm::offcore_response_1:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "wsm::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "wsm::offcore_response_1:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "snb::offcore_response_1:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "snb::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "snb::offcore_response_1:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "snb::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "snb::offcore_response_1:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "ivb_ep::offcore_response_1:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "ivb_ep::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "ivb_ep::offcore_response_1:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "ivb_ep::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "ivb_ep::offcore_response_1:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "hsw::offcore_response_1:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "hsw::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "hsw::offcore_response_1:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "hsw::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "hsw::offcore_response_1:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "bdw_ep::offcore_response_1:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "bdw_ep::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "bdw_ep::offcore_response_1:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "bdw_ep::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "bdw_ep::offcore_response_1:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "skl::offcore_response_1:0xf",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xf,
4e2f91
-	  .fstr = "skl::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "skl::offcore_response_1:0xfffffffff",
4e2f91
-	  .ret  = PFM_SUCCESS,
4e2f91
-	  .count = 2,
4e2f91
-	  .codes[0] = 0x5301bb,
4e2f91
-	  .codes[1] = 0xfffffffffull,
4e2f91
-	  .fstr = "skl::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
-	  .name = "skl::offcore_response_1:0x7fffffffff",
4e2f91
-	  .ret  = PFM_ERR_ATTR,
4e2f91
-	},
4e2f91
-	{ SRC_LINE,
4e2f91
 	  .name = "glm::offcore_response_1:any_request",
4e2f91
 	  .ret  = PFM_SUCCESS,
4e2f91
 	  .count = 2,
4e2f91
-- 
4e2f91
2.7.4
4e2f91
4e2f91
From 1e01aa2112461ecb67ddc58750316cadd19a8612 Mon Sep 17 00:00:00 2001
4e2f91
From: Stephane Eranian <eranian@gmail.com>
4e2f91
Date: Mon, 3 Apr 2017 22:55:16 -0700
4e2f91
Subject: [PATCH 4/7] improve error message in validate.c
4e2f91
4e2f91
Add more detailed info in czase of size mismatch.
4e2f91
4e2f91
Signed-off-by: Stephane Eranian <eranian@gmail.com>
4e2f91
---
4e2f91
 tests/validate.c | 2 +-
4e2f91
 1 file changed, 1 insertion(+), 1 deletion(-)
4e2f91
4e2f91
diff --git a/tests/validate.c b/tests/validate.c
4e2f91
index 522a6ab7140d..e4a8025f3f14 100644
4e2f91
--- a/tests/validate.c
4e2f91
+++ b/tests/validate.c
4e2f91
@@ -270,7 +270,7 @@ validate_structs(void)
4e2f91
 		}
4e2f91
 
4e2f91
 		if (sz != d->sz) {
4e2f91
-			printf("Failed (invisible padding of %zu bytes)\n", d->sz - sz);
4e2f91
+			printf("Failed (invisible padding of %zu bytes, total struct size %zu bytes)\n", d->sz - sz, d->sz);
4e2f91
 			errors++;
4e2f91
 			continue;
4e2f91
 		}
4e2f91
-- 
4e2f91
2.7.4
4e2f91
4e2f91
From 321133e1486084ea2b1494bc67b38ee085b31f71 Mon Sep 17 00:00:00 2001
4e2f91
From: Stephane Eranian <eranian@gmail.com>
4e2f91
Date: Mon, 3 Apr 2017 23:32:50 -0700
4e2f91
Subject: [PATCH 5/7] create internal type for perf_event_attr_info_t
4e2f91
4e2f91
This patch creates an internal version of the ABI
4e2f91
pfm_event_attr_info structure called pfmlib_event_attr_info_t.
4e2f91
The advantage is that we can change the internal version without
4e2f91
ABI changes. The new struct is just a clone of the external version.
4e2f91
But it can be customized for internal needs.
4e2f91
4e2f91
The pfm_get_event_attr_info() converts the internal version into
4e2f91
the external version.
4e2f91
4e2f91
This patch changes internal interface to use pfmlib_event_attr_info_t
4e2f91
for all architectures.
4e2f91
4e2f91
Signed-off-by: Stephane Eranian <eranian@gmail.com>
4e2f91
---
4e2f91
 lib/pfmlib_amd64.c                |  4 ++--
4e2f91
 lib/pfmlib_amd64_priv.h           |  2 +-
4e2f91
 lib/pfmlib_arm.c                  |  4 ++--
4e2f91
 lib/pfmlib_arm_priv.h             |  2 +-
4e2f91
 lib/pfmlib_common.c               | 32 ++++++++++++++++++++------------
4e2f91
 lib/pfmlib_intel_netburst.c       |  4 ++--
4e2f91
 lib/pfmlib_intel_nhm_unc.c        |  2 +-
4e2f91
 lib/pfmlib_intel_snbep_unc.c      |  4 ++--
4e2f91
 lib/pfmlib_intel_snbep_unc_priv.h |  2 +-
4e2f91
 lib/pfmlib_intel_x86.c            | 10 +++++-----
4e2f91
 lib/pfmlib_intel_x86_perf_event.c |  6 +++---
4e2f91
 lib/pfmlib_intel_x86_priv.h       |  2 +-
4e2f91
 lib/pfmlib_mips.c                 |  4 ++--
4e2f91
 lib/pfmlib_mips_priv.h            |  2 +-
4e2f91
 lib/pfmlib_perf_event.c           |  4 ++--
4e2f91
 lib/pfmlib_perf_event_pmu.c       |  6 +++---
4e2f91
 lib/pfmlib_perf_event_raw.c       |  2 +-
4e2f91
 lib/pfmlib_power_priv.h           |  2 +-
4e2f91
 lib/pfmlib_powerpc.c              |  2 +-
4e2f91
 lib/pfmlib_priv.h                 | 26 ++++++++++++++++++++++++--
4e2f91
 lib/pfmlib_sparc.c                |  4 ++--
4e2f91
 lib/pfmlib_sparc_priv.h           |  2 +-
4e2f91
 lib/pfmlib_torrent.c              |  2 +-
4e2f91
 23 files changed, 80 insertions(+), 50 deletions(-)
4e2f91
4e2f91
diff --git a/lib/pfmlib_amd64.c b/lib/pfmlib_amd64.c
4e2f91
index 13838040b55a..be2a4ef86faf 100644
4e2f91
--- a/lib/pfmlib_amd64.c
4e2f91
+++ b/lib/pfmlib_amd64.c
4e2f91
@@ -426,7 +426,7 @@ pfm_amd64_get_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
 	const amd64_entry_t *pe = this_pe(this);
4e2f91
 	pfm_amd64_reg_t reg;
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	uint64_t umask = 0;
4e2f91
 	unsigned int plmmsk = 0;
4e2f91
 	int k, ret, grpid;
4e2f91
@@ -661,7 +661,7 @@ pfm_amd64_event_is_valid(void *this, int pidx)
4e2f91
 }
4e2f91
 
4e2f91
 int
4e2f91
-pfm_amd64_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_amd64_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	const amd64_entry_t *pe = this_pe(this);
4e2f91
 	int numasks, idx;
4e2f91
diff --git a/lib/pfmlib_amd64_priv.h b/lib/pfmlib_amd64_priv.h
4e2f91
index 66ca49ef1b1d..c3caae514f52 100644
4e2f91
--- a/lib/pfmlib_amd64_priv.h
4e2f91
+++ b/lib/pfmlib_amd64_priv.h
4e2f91
@@ -202,7 +202,7 @@ extern int pfm_amd64_get_encoding(void *this, pfmlib_event_desc_t *e);
4e2f91
 extern int pfm_amd64_get_event_first(void *this);
4e2f91
 extern int pfm_amd64_get_event_next(void *this, int idx);
4e2f91
 extern int pfm_amd64_event_is_valid(void *this, int idx);
4e2f91
-extern int pfm_amd64_get_event_attr_info(void *this, int idx, int attr_idx, pfm_event_attr_info_t *info);
4e2f91
+extern int pfm_amd64_get_event_attr_info(void *this, int idx, int attr_idx, pfmlib_event_attr_info_t *info);
4e2f91
 extern int pfm_amd64_get_event_info(void *this, int idx, pfm_event_info_t *info);
4e2f91
 extern int pfm_amd64_validate_table(void *this, FILE *fp);
4e2f91
 extern int pfm_amd64_detect(void *this);
4e2f91
diff --git a/lib/pfmlib_arm.c b/lib/pfmlib_arm.c
4e2f91
index a49ca4504644..91c35c670ebe 100644
4e2f91
--- a/lib/pfmlib_arm.c
4e2f91
+++ b/lib/pfmlib_arm.c
4e2f91
@@ -180,7 +180,7 @@ pfm_arm_get_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
 
4e2f91
 	const arm_entry_t *pe = this_pe(this);
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	pfm_arm_reg_t reg;
4e2f91
 	unsigned int plm = 0;
4e2f91
 	int i, idx, has_plm = 0;
4e2f91
@@ -305,7 +305,7 @@ pfm_arm_validate_table(void *this, FILE *fp)
4e2f91
 }
4e2f91
 
4e2f91
 int
4e2f91
-pfm_arm_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_arm_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	int idx;
4e2f91
 
4e2f91
diff --git a/lib/pfmlib_arm_priv.h b/lib/pfmlib_arm_priv.h
4e2f91
index 81a9df9afdc7..4fc2e74955e4 100644
4e2f91
--- a/lib/pfmlib_arm_priv.h
4e2f91
+++ b/lib/pfmlib_arm_priv.h
4e2f91
@@ -66,7 +66,7 @@ extern int pfm_arm_get_event_first(void *this);
4e2f91
 extern int pfm_arm_get_event_next(void *this, int idx);
4e2f91
 extern int pfm_arm_event_is_valid(void *this, int pidx);
4e2f91
 extern int pfm_arm_validate_table(void *this, FILE *fp);
4e2f91
-extern int pfm_arm_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info);
4e2f91
+extern int pfm_arm_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info);
4e2f91
 extern int pfm_arm_get_event_info(void *this, int idx, pfm_event_info_t *info);
4e2f91
 extern unsigned int pfm_arm_get_event_nattrs(void *this, int pidx);
4e2f91
 
4e2f91
diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
4e2f91
index c88e2aaae274..f3c6dfa23e55 100644
4e2f91
--- a/lib/pfmlib_common.c
4e2f91
+++ b/lib/pfmlib_common.c
4e2f91
@@ -504,7 +504,7 @@ pfmlib_compact_attrs(pfmlib_event_desc_t *e, int i)
4e2f91
 static inline int
4e2f91
 pfmlib_same_attr(pfmlib_event_desc_t *d, int i, int j)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *a1, *a2;
4e2f91
+	pfmlib_event_attr_info_t *a1, *a2;
4e2f91
 	pfmlib_attr_t *b1, *b2;
4e2f91
 
4e2f91
 	a1 = attr(d, i);
4e2f91
@@ -967,7 +967,7 @@ pfmlib_sanitize_event(pfmlib_event_desc_t *d)
4e2f91
 static int
4e2f91
 pfmlib_parse_event_attr(char *str, pfmlib_event_desc_t *d)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *ainfo;
4e2f91
+	pfmlib_event_attr_info_t *ainfo;
4e2f91
 	char *s, *p, *q, *endptr;
4e2f91
 	char yes[2] = "y";
4e2f91
 	pfm_attr_t type;
4e2f91
@@ -1366,7 +1366,7 @@ pfmlib_parse_event(const char *event, pfmlib_event_desc_t *d)
4e2f91
 		ret = pfmlib_sanitize_event(d);
4e2f91
 
4e2f91
 	for (i = 0; i < d->nattrs; i++) {
4e2f91
-		pfm_event_attr_info_t *a = attr(d, i);
4e2f91
+		pfmlib_event_attr_info_t *a = attr(d, i);
4e2f91
 		if (a->type != PFM_ATTR_RAW_UMASK)
4e2f91
 			DPRINT("%d %d %d %s\n", d->event, i, a->idx, d->pattrs[d->attrs[i].id].name);
4e2f91
 		else
4e2f91
@@ -1549,7 +1549,7 @@ static int
4e2f91
 pfmlib_pmu_validate_encoding(pfmlib_pmu_t *pmu, FILE *fp)
4e2f91
 {
4e2f91
 	pfm_event_info_t einfo;
4e2f91
-	pfm_event_attr_info_t ainfo;
4e2f91
+	pfmlib_event_attr_info_t ainfo;
4e2f91
 	char *buf;
4e2f91
 	size_t maxlen = 0, len;
4e2f91
 	int i, u, n = 0, um;
4e2f91
@@ -1811,7 +1811,7 @@ pfm_get_event_info(int idx, pfm_os_t os, pfm_event_info_t *uinfo)
4e2f91
 int
4e2f91
 pfm_get_event_attr_info(int idx, int attr_idx, pfm_os_t os, pfm_event_attr_info_t *uinfo)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t info;
4e2f91
+	pfmlib_event_attr_info_t info;
4e2f91
 	pfmlib_event_desc_t e;
4e2f91
 	pfmlib_pmu_t *pmu;
4e2f91
 	size_t sz = sizeof(info);
4e2f91
@@ -1857,17 +1857,25 @@ pfm_get_event_attr_info(int idx, int attr_idx, pfm_os_t os, pfm_event_attr_info_
4e2f91
 	info = e.pattrs[attr_idx];
4e2f91
 
4e2f91
 	/*
4e2f91
-	 * rewrite size to reflect what we are returning
4e2f91
-	 */
4e2f91
-	info.size = sz;
4e2f91
-	/*
4e2f91
 	 * info.idx = private, namespace specific index,
4e2f91
 	 * should not be visible externally, so override
4e2f91
 	 * with public index
4e2f91
+	 *
4e2f91
+	 * cannot memcpy() info into uinfo as they do not
4e2f91
+	 * have the same size, cf. idx field (uint64 vs, uint32)
4e2f91
 	 */
4e2f91
-	info.idx  = attr_idx;
4e2f91
-
4e2f91
-	memcpy(uinfo, &info, sz);
4e2f91
+	uinfo->name  = info.name;
4e2f91
+	uinfo->desc  = info.desc;
4e2f91
+	uinfo->equiv = info.equiv;
4e2f91
+	uinfo->size  = sz;
4e2f91
+	uinfo->code  = info.code;
4e2f91
+	uinfo->type  = info.type;
4e2f91
+	uinfo->idx   = attr_idx;
4e2f91
+	uinfo->ctrl  = info.ctrl;
4e2f91
+	uinfo->is_dfl= info.is_dfl;
4e2f91
+	uinfo->is_precise = info.is_precise;
4e2f91
+	uinfo->reserved_bits = 0;
4e2f91
+	uinfo->dfl_val64 = info.dfl_val64;
4e2f91
 
4e2f91
 	ret = PFM_SUCCESS;
4e2f91
 error:
4e2f91
diff --git a/lib/pfmlib_intel_netburst.c b/lib/pfmlib_intel_netburst.c
4e2f91
index 9d8f22b7705d..9b4960583523 100644
4e2f91
--- a/lib/pfmlib_intel_netburst.c
4e2f91
+++ b/lib/pfmlib_intel_netburst.c
4e2f91
@@ -110,7 +110,7 @@ netburst_add_defaults(pfmlib_event_desc_t *e, unsigned int *evmask)
4e2f91
 int
4e2f91
 pfm_netburst_get_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	netburst_escr_value_t escr;
4e2f91
 	netburst_cccr_value_t cccr;
4e2f91
 	unsigned int evmask = 0;
4e2f91
@@ -322,7 +322,7 @@ pfm_netburst_event_is_valid(void *this, int pidx)
4e2f91
 }
4e2f91
 
4e2f91
 static int
4e2f91
-pfm_netburst_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_netburst_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	const netburst_entry_t *pe = this_pe(this);
4e2f91
 	int numasks, idx;
4e2f91
diff --git a/lib/pfmlib_intel_nhm_unc.c b/lib/pfmlib_intel_nhm_unc.c
4e2f91
index 4c27b070f2d6..6731f4045332 100644
4e2f91
--- a/lib/pfmlib_intel_nhm_unc.c
4e2f91
+++ b/lib/pfmlib_intel_nhm_unc.c
4e2f91
@@ -82,7 +82,7 @@ static int
4e2f91
 pfm_nhm_unc_get_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
 	pfm_intel_x86_reg_t reg;
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	const intel_x86_entry_t *pe = this_pe(this);
4e2f91
 	unsigned int grpmsk, ugrpmsk = 0;
4e2f91
 	int umodmsk = 0, modmsk_r = 0;
4e2f91
diff --git a/lib/pfmlib_intel_snbep_unc.c b/lib/pfmlib_intel_snbep_unc.c
4e2f91
index 075ae33b3a57..1e80147fc1a3 100644
4e2f91
--- a/lib/pfmlib_intel_snbep_unc.c
4e2f91
+++ b/lib/pfmlib_intel_snbep_unc.c
4e2f91
@@ -281,7 +281,7 @@ pfm_intel_snbep_unc_get_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 	pfm_snbep_unc_reg_t reg;
4e2f91
 	pfm_snbep_unc_reg_t filters[INTEL_X86_MAX_FILTERS];
4e2f91
 	pfm_snbep_unc_reg_t addr;
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	uint64_t val, umask1, umask2;
4e2f91
 	int k, ret;
4e2f91
 	int has_cbo_tid = 0;
4e2f91
@@ -641,7 +641,7 @@ pfm_intel_snbep_unc_can_auto_encode(void *this, int pidx, int uidx)
4e2f91
 }
4e2f91
 
4e2f91
 int
4e2f91
-pfm_intel_snbep_unc_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_intel_snbep_unc_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	const intel_x86_entry_t *pe = this_pe(this);
4e2f91
 	const pfmlib_attr_desc_t *atdesc = this_atdesc(this);
4e2f91
diff --git a/lib/pfmlib_intel_snbep_unc_priv.h b/lib/pfmlib_intel_snbep_unc_priv.h
4e2f91
index 500ff84cc123..4984242c35bb 100644
4e2f91
--- a/lib/pfmlib_intel_snbep_unc_priv.h
4e2f91
+++ b/lib/pfmlib_intel_snbep_unc_priv.h
4e2f91
@@ -329,7 +329,7 @@ extern int  pfm_intel_hswep_unc_detect(void *this);
4e2f91
 extern int  pfm_intel_knl_unc_detect(void *this);
4e2f91
 extern int  pfm_intel_snbep_unc_get_perf_encoding(void *this, pfmlib_event_desc_t *e);
4e2f91
 extern int  pfm_intel_snbep_unc_can_auto_encode(void *this, int pidx, int uidx);
4e2f91
-extern int pfm_intel_snbep_unc_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info);
4e2f91
+extern int pfm_intel_snbep_unc_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info);
4e2f91
 
4e2f91
 static inline int
4e2f91
 is_cbo_filt_event(void *this, pfm_intel_x86_reg_t reg)
4e2f91
diff --git a/lib/pfmlib_intel_x86.c b/lib/pfmlib_intel_x86.c
4e2f91
index 497cf1b9246a..09a0f50a3a4e 100644
4e2f91
--- a/lib/pfmlib_intel_x86.c
4e2f91
+++ b/lib/pfmlib_intel_x86.c
4e2f91
@@ -296,7 +296,7 @@ static int
4e2f91
 intel_x86_check_pebs(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
 	const intel_x86_entry_t *pe = this_pe(this);
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	int numasks = 0, pebs = 0;
4e2f91
 	int i;
4e2f91
 
4e2f91
@@ -340,7 +340,7 @@ static int
4e2f91
 intel_x86_check_max_grpid(void *this, pfmlib_event_desc_t *e, int max_grpid)
4e2f91
 {
4e2f91
 	const intel_x86_entry_t *pe;
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	int i, grpid;
4e2f91
 
4e2f91
 	DPRINT("check: max_grpid=%d\n", max_grpid);
4e2f91
@@ -366,7 +366,7 @@ pfm_intel_x86_encode_gen(void *this, pfmlib_event_desc_t *e)
4e2f91
 
4e2f91
 {
4e2f91
 	pfmlib_pmu_t *pmu = this;
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	const intel_x86_entry_t *pe;
4e2f91
 	pfm_intel_x86_reg_t reg, reg2;
4e2f91
 	unsigned int grpmsk, ugrpmsk = 0;
4e2f91
@@ -964,7 +964,7 @@ pfm_intel_x86_validate_table(void *this, FILE *fp)
4e2f91
 }
4e2f91
 
4e2f91
 int
4e2f91
-pfm_intel_x86_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_intel_x86_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	const intel_x86_entry_t *pe = this_pe(this);
4e2f91
 	const pfmlib_attr_desc_t *atdesc = this_atdesc(this);
4e2f91
@@ -1029,7 +1029,7 @@ pfm_intel_x86_get_event_info(void *this, int idx, pfm_event_info_t *info)
4e2f91
 int
4e2f91
 pfm_intel_x86_valid_pebs(pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	int i, npebs = 0, numasks = 0;
4e2f91
 
4e2f91
 	/* first check at the event level */
4e2f91
diff --git a/lib/pfmlib_intel_x86_perf_event.c b/lib/pfmlib_intel_x86_perf_event.c
4e2f91
index f346d4f92be5..0735ef9d88c1 100644
4e2f91
--- a/lib/pfmlib_intel_x86_perf_event.c
4e2f91
+++ b/lib/pfmlib_intel_x86_perf_event.c
4e2f91
@@ -60,7 +60,7 @@ find_pmu_type_by_name(const char *name)
4e2f91
 static int
4e2f91
 has_ldlat(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	int i;
4e2f91
 
4e2f91
 	for (i = 0; i < e->nattrs; i++) {
4e2f91
@@ -217,7 +217,7 @@ pfm_intel_nhm_unc_get_perf_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 int
4e2f91
 pfm_intel_x86_requesting_pebs(pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	int i;
4e2f91
 
4e2f91
 	for (i = 0; i < e->nattrs; i++) {
4e2f91
@@ -233,7 +233,7 @@ pfm_intel_x86_requesting_pebs(pfmlib_event_desc_t *e)
4e2f91
 static int
4e2f91
 intel_x86_event_has_pebs(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	int i;
4e2f91
 
4e2f91
 	/* first check at the event level */
4e2f91
diff --git a/lib/pfmlib_intel_x86_priv.h b/lib/pfmlib_intel_x86_priv.h
4e2f91
index 963b41a8a766..e2dfbf3d9b40 100644
4e2f91
--- a/lib/pfmlib_intel_x86_priv.h
4e2f91
+++ b/lib/pfmlib_intel_x86_priv.h
4e2f91
@@ -335,7 +335,7 @@ extern int pfm_intel_x86_get_event_next(void *this, int idx);
4e2f91
 extern int pfm_intel_x86_get_event_umask_first(void *this, int idx);
4e2f91
 extern int pfm_intel_x86_get_event_umask_next(void *this, int idx, int attr);
4e2f91
 extern int pfm_intel_x86_validate_table(void *this, FILE *fp);
4e2f91
-extern int pfm_intel_x86_get_event_attr_info(void *this, int idx, int attr_idx, pfm_event_attr_info_t *info);
4e2f91
+extern int pfm_intel_x86_get_event_attr_info(void *this, int idx, int attr_idx, pfmlib_event_attr_info_t *info);
4e2f91
 extern int pfm_intel_x86_get_event_info(void *this, int idx, pfm_event_info_t *info);
4e2f91
 extern int pfm_intel_x86_valid_pebs(pfmlib_event_desc_t *e);
4e2f91
 extern int pfm_intel_x86_perf_event_encoding(pfmlib_event_desc_t *e, void *data);
4e2f91
diff --git a/lib/pfmlib_mips.c b/lib/pfmlib_mips.c
4e2f91
index 8357ea515045..61db613be433 100644
4e2f91
--- a/lib/pfmlib_mips.c
4e2f91
+++ b/lib/pfmlib_mips.c
4e2f91
@@ -174,7 +174,7 @@ pfm_mips_get_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 
4e2f91
 	pfmlib_pmu_t *pmu = this;
4e2f91
 	const mips_entry_t *pe = this_pe(this);
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	pfm_mips_sel_reg_t reg;
4e2f91
 	uint64_t ival, cntmask = 0;
4e2f91
 	int plmmsk = 0, code;
4e2f91
@@ -333,7 +333,7 @@ pfm_mips_get_event_nattrs(void *this, int pidx)
4e2f91
 }
4e2f91
 
4e2f91
 int
4e2f91
-pfm_mips_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_mips_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	/* no umasks, so all attrs are modifiers */
4e2f91
 
4e2f91
diff --git a/lib/pfmlib_mips_priv.h b/lib/pfmlib_mips_priv.h
4e2f91
index c5112f510acf..1ed2bcba28c8 100644
4e2f91
--- a/lib/pfmlib_mips_priv.h
4e2f91
+++ b/lib/pfmlib_mips_priv.h
4e2f91
@@ -107,7 +107,7 @@ extern int pfm_mips_get_event_first(void *this);
4e2f91
 extern int pfm_mips_get_event_next(void *this, int idx);
4e2f91
 extern int pfm_mips_event_is_valid(void *this, int pidx);
4e2f91
 extern int pfm_mips_validate_table(void *this, FILE *fp);
4e2f91
-extern int pfm_mips_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info);
4e2f91
+extern int pfm_mips_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info);
4e2f91
 extern int pfm_mips_get_event_info(void *this, int idx, pfm_event_info_t *info);
4e2f91
 extern unsigned int pfm_mips_get_event_nattrs(void *this, int pidx);
4e2f91
 
4e2f91
diff --git a/lib/pfmlib_perf_event.c b/lib/pfmlib_perf_event.c
4e2f91
index 8618d6070968..df18821a540d 100644
4e2f91
--- a/lib/pfmlib_perf_event.c
4e2f91
+++ b/lib/pfmlib_perf_event.c
4e2f91
@@ -82,7 +82,7 @@ pfmlib_perf_event_encode(void *this, const char *str, int dfl_plm, void *data)
4e2f91
 	struct perf_event_attr my_attr, *attr;
4e2f91
 	pfmlib_pmu_t *pmu;
4e2f91
 	pfmlib_event_desc_t e;
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	size_t orig_sz, asz, sz = sizeof(arg);
4e2f91
 	uint64_t ival;
4e2f91
 	int has_plm = 0, has_vmx_plm = 0;
4e2f91
@@ -357,7 +357,7 @@ static int
4e2f91
 perf_get_os_attr_info(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
 	pfmlib_os_t *os = this;
4e2f91
-	pfm_event_attr_info_t *info;
4e2f91
+	pfmlib_event_attr_info_t *info;
4e2f91
 	int i, k, j = e->npattrs;
4e2f91
 
4e2f91
 	for (i = k = 0; os->atdesc[i].name; i++) {
4e2f91
diff --git a/lib/pfmlib_perf_event_pmu.c b/lib/pfmlib_perf_event_pmu.c
4e2f91
index 5b2d8104696a..5c81552da71e 100644
4e2f91
--- a/lib/pfmlib_perf_event_pmu.c
4e2f91
+++ b/lib/pfmlib_perf_event_pmu.c
4e2f91
@@ -569,7 +569,7 @@ static int
4e2f91
 pfmlib_perf_encode_tp(pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
 	perf_umask_t *um;
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	int i, nu = 0;
4e2f91
 
4e2f91
 	e->fstr[0] = '\0';
4e2f91
@@ -607,7 +607,7 @@ pfmlib_perf_encode_tp(pfmlib_event_desc_t *e)
4e2f91
 static int
4e2f91
 pfmlib_perf_encode_hw_cache(pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	perf_event_t *ent;
4e2f91
 	unsigned int msk, grpmsk;
4e2f91
 	uint64_t umask = 0;
4e2f91
@@ -733,7 +733,7 @@ pfm_perf_event_is_valid(void *this, int idx)
4e2f91
 }
4e2f91
 
4e2f91
 static int
4e2f91
-pfm_perf_get_event_attr_info(void *this, int idx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_perf_get_event_attr_info(void *this, int idx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	perf_umask_t *um;
4e2f91
 
4e2f91
diff --git a/lib/pfmlib_perf_event_raw.c b/lib/pfmlib_perf_event_raw.c
4e2f91
index e10d215912ea..71d944334876 100644
4e2f91
--- a/lib/pfmlib_perf_event_raw.c
4e2f91
+++ b/lib/pfmlib_perf_event_raw.c
4e2f91
@@ -91,7 +91,7 @@ pfm_perf_raw_event_is_valid(void *this, int idx)
4e2f91
 }
4e2f91
 
4e2f91
 static int
4e2f91
-pfm_perf_raw_get_event_attr_info(void *this, int idx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_perf_raw_get_event_attr_info(void *this, int idx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	return PFM_ERR_ATTR;
4e2f91
 }
4e2f91
diff --git a/lib/pfmlib_power_priv.h b/lib/pfmlib_power_priv.h
4e2f91
index 8b5c3ac0ffcf..3b72d326e3bb 100644
4e2f91
--- a/lib/pfmlib_power_priv.h
4e2f91
+++ b/lib/pfmlib_power_priv.h
4e2f91
@@ -101,7 +101,7 @@ typedef struct {
4e2f91
 #define POWER8_PLM (POWER_PLM|PFM_PLMH)
4e2f91
 
4e2f91
 extern int pfm_gen_powerpc_get_event_info(void *this, int pidx, pfm_event_info_t *info);
4e2f91
-extern int pfm_gen_powerpc_get_event_attr_info(void *this, int pidx, int umask_idx, pfm_event_attr_info_t *info);
4e2f91
+extern int pfm_gen_powerpc_get_event_attr_info(void *this, int pidx, int umask_idx, pfmlib_event_attr_info_t *info);
4e2f91
 extern int pfm_gen_powerpc_get_encoding(void *this, pfmlib_event_desc_t *e);
4e2f91
 extern int pfm_gen_powerpc_get_event_first(void *this);
4e2f91
 extern int pfm_gen_powerpc_get_event_next(void *this, int idx);
4e2f91
diff --git a/lib/pfmlib_powerpc.c b/lib/pfmlib_powerpc.c
4e2f91
index f025dede599d..f32080d63b5e 100644
4e2f91
--- a/lib/pfmlib_powerpc.c
4e2f91
+++ b/lib/pfmlib_powerpc.c
4e2f91
@@ -56,7 +56,7 @@ pfm_gen_powerpc_get_event_info(void *this, int pidx, pfm_event_info_t *info)
4e2f91
 }
4e2f91
 
4e2f91
 int
4e2f91
-pfm_gen_powerpc_get_event_attr_info(void *this, int pidx, int umask_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_gen_powerpc_get_event_attr_info(void *this, int pidx, int umask_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	/* No attributes are supported */
4e2f91
 	return PFM_ERR_ATTR;
4e2f91
diff --git a/lib/pfmlib_priv.h b/lib/pfmlib_priv.h
4e2f91
index 33d7fdf2013d..2f4d2b9d494b 100644
4e2f91
--- a/lib/pfmlib_priv.h
4e2f91
+++ b/lib/pfmlib_priv.h
4e2f91
@@ -56,6 +56,28 @@ typedef struct {
4e2f91
 	pfm_attr_t	type;	/* used to validate value (if any) */
4e2f91
 } pfmlib_attr_desc_t;
4e2f91
 
4e2f91
+typedef struct {
4e2f91
+	const char		*name;	/* attribute symbolic name */
4e2f91
+	const char		*desc;	/* attribute description */
4e2f91
+	const char		*equiv;	/* attribute is equivalent to */
4e2f91
+	size_t			size;	/* struct sizeof */
4e2f91
+	uint64_t		code;	/* attribute code */
4e2f91
+	pfm_attr_t		type;	/* attribute type */
4e2f91
+	int			idx;	/* attribute opaque index */
4e2f91
+	pfm_attr_ctrl_t		ctrl;		/* what is providing attr */
4e2f91
+	struct {
4e2f91
+		unsigned int    is_dfl:1;	/* is default umask */
4e2f91
+		unsigned int    is_precise:1;	/* Intel X86: supports PEBS */
4e2f91
+		unsigned int	reserved_bits:30;
4e2f91
+	};
4e2f91
+	union {
4e2f91
+		uint64_t	dfl_val64;	/* default 64-bit value */
4e2f91
+		const char	*dfl_str;	/* default string value */
4e2f91
+		int		dfl_bool;	/* default boolean value */
4e2f91
+		int		dfl_int;	/* default integer value */
4e2f91
+	};
4e2f91
+} pfmlib_event_attr_info_t;
4e2f91
+
4e2f91
 /*
4e2f91
  * attribute description passed to model-specific layer
4e2f91
  */
4e2f91
@@ -90,7 +112,7 @@ typedef struct {
4e2f91
 	int			count;				/* number of entries in codes[] */
4e2f91
 	pfmlib_attr_t		attrs[PFMLIB_MAX_ATTRS];	/* list of requested attributes */
4e2f91
 
4e2f91
-	pfm_event_attr_info_t	*pattrs;			/* list of possible attributes */
4e2f91
+	pfmlib_event_attr_info_t *pattrs;			/* list of possible attributes */
4e2f91
 	char			fstr[PFMLIB_EVT_MAX_NAME_LEN];	/* fully qualified event string */
4e2f91
 	uint64_t		codes[PFMLIB_MAX_ENCODING];	/* event encoding */
4e2f91
 	void			*os_data;
4e2f91
@@ -129,7 +151,7 @@ typedef struct pfmlib_pmu {
4e2f91
 	int		 (*event_is_valid)(void *this, int pidx);
4e2f91
 	int		 (*can_auto_encode)(void *this, int pidx, int uidx);
4e2f91
 
4e2f91
-	int		 (*get_event_attr_info)(void *this, int pidx, int umask_idx, pfm_event_attr_info_t *info);
4e2f91
+	int		 (*get_event_attr_info)(void *this, int pidx, int umask_idx, pfmlib_event_attr_info_t *info);
4e2f91
 	int		 (*get_event_encoding[PFM_OS_MAX])(void *this, pfmlib_event_desc_t *e);
4e2f91
 
4e2f91
 	void		 (*validate_pattrs[PFM_OS_MAX])(void *this, pfmlib_event_desc_t *e);
4e2f91
diff --git a/lib/pfmlib_sparc.c b/lib/pfmlib_sparc.c
4e2f91
index f88b5512a5f4..fe8da0618d31 100644
4e2f91
--- a/lib/pfmlib_sparc.c
4e2f91
+++ b/lib/pfmlib_sparc.c
4e2f91
@@ -165,7 +165,7 @@ int
4e2f91
 pfm_sparc_get_encoding(void *this, pfmlib_event_desc_t *e)
4e2f91
 {
4e2f91
 	const sparc_entry_t *pe = this_pe(this);
4e2f91
-	pfm_event_attr_info_t *a;
4e2f91
+	pfmlib_event_attr_info_t *a;
4e2f91
 	pfm_sparc_reg_t reg;
4e2f91
 	int i;
4e2f91
 
4e2f91
@@ -260,7 +260,7 @@ pfm_sparc_validate_table(void *this, FILE *fp)
4e2f91
 }
4e2f91
 
4e2f91
 int
4e2f91
-pfm_sparc_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info)
4e2f91
+pfm_sparc_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	const sparc_entry_t *pe = this_pe(this);
4e2f91
 	int idx;
4e2f91
diff --git a/lib/pfmlib_sparc_priv.h b/lib/pfmlib_sparc_priv.h
4e2f91
index 7de9b3dc327a..332651ff051e 100644
4e2f91
--- a/lib/pfmlib_sparc_priv.h
4e2f91
+++ b/lib/pfmlib_sparc_priv.h
4e2f91
@@ -45,7 +45,7 @@ extern int pfm_sparc_get_event_first(void *this);
4e2f91
 extern int pfm_sparc_get_event_next(void *this, int idx);
4e2f91
 extern int pfm_sparc_event_is_valid(void *this, int pidx);
4e2f91
 extern int pfm_sparc_validate_table(void *this, FILE *fp);
4e2f91
-extern int pfm_sparc_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_event_attr_info_t *info);
4e2f91
+extern int pfm_sparc_get_event_attr_info(void *this, int pidx, int attr_idx, pfmlib_event_attr_info_t *info);
4e2f91
 extern int pfm_sparc_get_event_info(void *this, int idx, pfm_event_info_t *info);
4e2f91
 extern unsigned int pfm_sparc_get_event_nattrs(void *this, int pidx);
4e2f91
 
4e2f91
diff --git a/lib/pfmlib_torrent.c b/lib/pfmlib_torrent.c
4e2f91
index b8d697aa27ac..72991e7ec98a 100644
4e2f91
--- a/lib/pfmlib_torrent.c
4e2f91
+++ b/lib/pfmlib_torrent.c
4e2f91
@@ -104,7 +104,7 @@ pfm_torrent_get_event_info(void *this, int pidx, pfm_event_info_t *info)
4e2f91
 
4e2f91
 static int
4e2f91
 pfm_torrent_get_event_attr_info(void *this, int idx, int attr_idx,
4e2f91
-				  pfm_event_attr_info_t *info)
4e2f91
+				  pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	int m;
4e2f91
 
4e2f91
-- 
4e2f91
2.7.4
4e2f91
4e2f91
From 39d4b76fa96825ec65724eb94939a3b534a62fd0 Mon Sep 17 00:00:00 2001
4e2f91
From: Stephane Eranian <eranian@gmail.com>
4e2f91
Date: Mon, 3 Apr 2017 23:41:10 -0700
4e2f91
Subject: [PATCH 6/7] enable generic support for 64-bit raw umask
4e2f91
4e2f91
This patch modifies the generic code to handle 64-bit raw umasks
4e2f91
passed by users.
4e2f91
4e2f91
Signed-off-by: Stephane Eranian <eranian@gmail.com>
4e2f91
---
4e2f91
 lib/pfmlib_common.c | 3 ++-
4e2f91
 lib/pfmlib_priv.h   | 4 ++--
4e2f91
 2 files changed, 4 insertions(+), 3 deletions(-)
4e2f91
4e2f91
diff --git a/lib/pfmlib_common.c b/lib/pfmlib_common.c
4e2f91
index f3c6dfa23e55..6ff44994203b 100644
4e2f91
--- a/lib/pfmlib_common.c
4e2f91
+++ b/lib/pfmlib_common.c
4e2f91
@@ -1011,7 +1011,8 @@ pfmlib_parse_event_attr(char *str, pfmlib_event_desc_t *d)
4e2f91
 			ainfo->name = "RAW_UMASK";
4e2f91
 			ainfo->type = PFM_ATTR_RAW_UMASK;
4e2f91
 			ainfo->ctrl = PFM_ATTR_CTRL_PMU;
4e2f91
-			ainfo->idx  = strtoul(s, &endptr, 0);
4e2f91
+			/* can handle up to 64-bit raw umask */
4e2f91
+			ainfo->idx  = strtoull(s, &endptr, 0);
4e2f91
 			ainfo->equiv= NULL;
4e2f91
 			if (*endptr) {
4e2f91
 				DPRINT("raw umask (%s) is not a number\n");
4e2f91
diff --git a/lib/pfmlib_priv.h b/lib/pfmlib_priv.h
4e2f91
index 2f4d2b9d494b..b7503a76de01 100644
4e2f91
--- a/lib/pfmlib_priv.h
4e2f91
+++ b/lib/pfmlib_priv.h
4e2f91
@@ -63,8 +63,8 @@ typedef struct {
4e2f91
 	size_t			size;	/* struct sizeof */
4e2f91
 	uint64_t		code;	/* attribute code */
4e2f91
 	pfm_attr_t		type;	/* attribute type */
4e2f91
-	int			idx;	/* attribute opaque index */
4e2f91
-	pfm_attr_ctrl_t		ctrl;		/* what is providing attr */
4e2f91
+	pfm_attr_ctrl_t		ctrl;	/* what is providing attr */
4e2f91
+	uint64_t		idx;	/* attribute opaque index */
4e2f91
 	struct {
4e2f91
 		unsigned int    is_dfl:1;	/* is default umask */
4e2f91
 		unsigned int    is_precise:1;	/* Intel X86: supports PEBS */
4e2f91
-- 
4e2f91
2.7.4
4e2f91
4e2f91
From 088a1806676382e1a0324ba4c2d59b9d07a96caf Mon Sep 17 00:00:00 2001
4e2f91
From: Stephane Eranian <eranian@gmail.com>
4e2f91
Date: Tue, 4 Apr 2017 09:42:25 -0700
4e2f91
Subject: [PATCH 7/7] enable 38-bit raw umask for Intel offcore_response event
4e2f91
4e2f91
This patch enables support for passing and encoding of 38-bit
4e2f91
offcore_response matrix umask. Without the patch, the raw umask
4e2f91
was limited to 32-bit which is not enough to cover all the possible
4e2f91
bits of the offcore_response event available since Intel SandyBridge.
4e2f91
4e2f91
$ examples/check_events offcore_response_0:0xffffff
4e2f91
Requested Event: offcore_response_0:0xffffff
4e2f91
Actual    Event: ivb::OFFCORE_RESPONSE_0:0xffffff:k=1:u=1:e=0:i=0:c=0:t=0
4e2f91
PMU            : Intel Ivy Bridge
4e2f91
IDX            : 155189325
4e2f91
Codes          : 0x5301b7 0xffffff
4e2f91
4e2f91
The patch also adds tests to the validation code.
4e2f91
4e2f91
Signed-off-by: Stephane Eranian <eranian@gmail.com>
4e2f91
---
4e2f91
 lib/pfmlib_intel_x86.c |  20 +++--
4e2f91
 tests/validate_x86.c   | 232 +++++++++++++++++++++++++++++++++++++++++++++++++
4e2f91
 2 files changed, 246 insertions(+), 6 deletions(-)
4e2f91
4e2f91
diff --git a/lib/pfmlib_intel_x86.c b/lib/pfmlib_intel_x86.c
4e2f91
index 09a0f50a3a4e..8fe93115dfa9 100644
4e2f91
--- a/lib/pfmlib_intel_x86.c
4e2f91
+++ b/lib/pfmlib_intel_x86.c
4e2f91
@@ -481,16 +481,24 @@ pfm_intel_x86_encode_gen(void *this, pfmlib_event_desc_t *e)
4e2f91
 				reg.sel_event_select = last_ucode;
4e2f91
 			}
4e2f91
 		} else if (a->type == PFM_ATTR_RAW_UMASK) {
4e2f91
+			int ofr_bits = 8;
4e2f91
+			uint64_t rmask;
4e2f91
+
4e2f91
+			/* set limit on width of raw umask */
4e2f91
+			if (intel_x86_eflag(this, e->event, INTEL_X86_NHM_OFFCORE)) {
4e2f91
+				ofr_bits = 38;
4e2f91
+				if (e->pmu->pmu == PFM_PMU_INTEL_WSM || e->pmu->pmu == PFM_PMU_INTEL_WSM_DP)
4e2f91
+					ofr_bits = 16;
4e2f91
+			}
4e2f91
+			rmask = (1ULL << ofr_bits) - 1;
4e2f91
 
4e2f91
-			/* there can only be one RAW_UMASK per event */
4e2f91
-
4e2f91
-			/* sanity check */
4e2f91
-			if (a->idx & ~0xff) {
4e2f91
-				DPRINT("raw umask is 8-bit wide\n");
4e2f91
+			if (a->idx & ~rmask) {
4e2f91
+				DPRINT("raw umask is too wide max %d bits\n", ofr_bits);
4e2f91
 				return PFM_ERR_ATTR;
4e2f91
 			}
4e2f91
+
4e2f91
 			/* override umask */
4e2f91
-			umask2 = a->idx & 0xff;
4e2f91
+			umask2  = a->idx & rmask;
4e2f91
 			ugrpmsk = grpmsk;
4e2f91
 		} else {
4e2f91
 			uint64_t ival = e->attrs[k].ival;
4e2f91
diff --git a/tests/validate_x86.c b/tests/validate_x86.c
4e2f91
index 906afba636e1..aa0aaa114d0d 100644
4e2f91
--- a/tests/validate_x86.c
4e2f91
+++ b/tests/validate_x86.c
4e2f91
@@ -4523,6 +4523,238 @@ static const test_event_t x86_test_events[]={
4e2f91
 	  .codes[0] = 0x0825,
4e2f91
 	  .fstr = "knl_unc_m2pcie::UNC_M2P_EGRESS_CYCLES_FULL:AD_1",
4e2f91
 	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "wsm::offcore_response_0:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "wsm::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "wsm::offcore_response_0:0xffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xffff,
4e2f91
+	  .fstr = "wsm::OFFCORE_RESPONSE_0:0xffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "wsm::offcore_response_0:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "snb::offcore_response_0:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "snb::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "snb::offcore_response_0:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "snb::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "snb::offcore_response_0:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "ivb_ep::offcore_response_0:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "ivb_ep::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "ivb_ep::offcore_response_0:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "ivb_ep::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "ivb_ep::offcore_response_0:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "hsw::offcore_response_0:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "hsw::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "hsw::offcore_response_0:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "hsw::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "hsw::offcore_response_0:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "bdw_ep::offcore_response_0:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "bdw_ep::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "bdw_ep::offcore_response_0:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "bdw_ep::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "bdw_ep::offcore_response_0:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "skl::offcore_response_0:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "skl::OFFCORE_RESPONSE_0:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "skl::offcore_response_0:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301b7,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "skl::OFFCORE_RESPONSE_0:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "skl::offcore_response_0:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "wsm::offcore_response_1:0xfff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xfff,
4e2f91
+	  .fstr = "wsm::OFFCORE_RESPONSE_1:0xfff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "wsm::offcore_response_1:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "snb::offcore_response_1:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "snb::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "snb::offcore_response_1:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "snb::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "snb::offcore_response_1:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "ivb_ep::offcore_response_1:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "ivb_ep::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "ivb_ep::offcore_response_1:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "ivb_ep::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "ivb_ep::offcore_response_1:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "hsw::offcore_response_1:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "hsw::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "hsw::offcore_response_1:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "hsw::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "hsw::offcore_response_1:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "bdw_ep::offcore_response_1:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "bdw_ep::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "bdw_ep::offcore_response_1:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "bdw_ep::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "bdw_ep::offcore_response_1:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "skl::offcore_response_1:0xf",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xf,
4e2f91
+	  .fstr = "skl::OFFCORE_RESPONSE_1:0xf:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "skl::offcore_response_1:0xfffffffff",
4e2f91
+	  .ret  = PFM_SUCCESS,
4e2f91
+	  .count = 2,
4e2f91
+	  .codes[0] = 0x5301bb,
4e2f91
+	  .codes[1] = 0xfffffffff,
4e2f91
+	  .fstr = "skl::OFFCORE_RESPONSE_1:0xffffffff:k=1:u=1:e=0:i=0:c=0:t=0:intx=0:intxcp=0",
4e2f91
+	},
4e2f91
+	{ SRC_LINE,
4e2f91
+	  .name = "skl::offcore_response_1:0x7fffffffff",
4e2f91
+	  .ret  = PFM_ERR_ATTR,
4e2f91
+	},
4e2f91
 };
4e2f91
 
4e2f91
 #define NUM_TEST_EVENTS (int)(sizeof(x86_test_events)/sizeof(test_event_t))
4e2f91
-- 
4e2f91
2.7.4
4e2f91
4e2f91
From 1eac17750c99cc29156d3cf2815b4bf0cdf1a1be Mon Sep 17 00:00:00 2001
4e2f91
From: William Cohen <wcohen@redhat.com>
4e2f91
Date: Tue, 11 Apr 2017 11:22:59 -0400
4e2f91
Subject: [PATCH] Also convert s390 to use the internal
4e2f91
 pfmlib_event_attr_info_t
4e2f91
4e2f91
Commit 321133e converted most of the architectures to use the internal
4e2f91
perflib_event_attr_info_t type.  However, the s390 was missed in that
4e2f91
previous commit.  This patch corrects the issue so libpfm compiles on
4e2f91
s390.
4e2f91
---
4e2f91
 lib/pfmlib_s390x_cpumf.c | 2 +-
4e2f91
 1 file changed, 1 insertion(+), 1 deletion(-)
4e2f91
4e2f91
diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c
4e2f91
index db2a215..b5444ef 100644
4e2f91
--- a/lib/pfmlib_s390x_cpumf.c
4e2f91
+++ b/lib/pfmlib_s390x_cpumf.c
4e2f91
@@ -254,7 +254,7 @@ static int pfm_cpumf_get_event_info(void *this, int idx,
4e2f91
 }
4e2f91
 
4e2f91
 static int pfm_cpumf_get_event_attr_info(void *this, int idx, int umask_idx,
4e2f91
-					 pfm_event_attr_info_t *info)
4e2f91
+					 pfmlib_event_attr_info_t *info)
4e2f91
 {
4e2f91
 	/* Attributes are not supported */
4e2f91
 	return PFM_ERR_ATTR;
4e2f91
-- 
4e2f91
2.9.3
4e2f91