Skip to contentSkip to conversation

perf: Adding better precise_ip field handling

PATCH In review Jiri Olsa 2 participants 14 messages Jan 26, 2013 – Jan 27, 2013

Subsystems (2)
lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

cover perf: Adding better precise_ip field handling

hi,
adding sysfs attribute to specify the maximum allowed value for perf_event_attr::precise_ip field.

Adding functionality for simple 'precise' term to get the maximum allowed value for perf_event_attr::precise_ip field.

And finally adding several precise automated tests.

thanks,
jirka

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>

---
Andi Kleen (1):
perf tools: Add a precise event qualifier

Jiri Olsa (8):
perf x86: Add precise sysfs cpu pmu attribute
perf tools: Add precise object to interface sysfs precise perf tests: Add precise event automated test
perf tools: Read maximal precise value for 'precise' term perf tools: Favor 'p' modifier before 'precise' term properly perf tests: Add automated precise term test
perf: Document the ABI for 'precise' sysfs attribute
perf: Document the ABI for 'rdpmc' sysfs attribute

 Documentation/ABI/testing/sysfs-bus-event_source-cpu-precise | 10 ++++++++++
 Documentation/ABI/testing/sysfs-bus-event_source-cpu-rdpmc   |  8 ++++++++
 arch/x86/kernel/cpu/perf_event.c                             | 34 +++++++++++++++++++++++---------
 tools/perf/Makefile                                          |  2 ++
 tools/perf/tests/builtin-test.c                              |  4 ++++
 tools/perf/tests/parse-events.c                              | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/precise.c                                   | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                                     |  1 +
 tools/perf/util/parse-events.c                               | 38 +++++++++++++++++++++++++++++++++++-
 tools/perf/util/parse-events.h                               |  3 +++
 tools/perf/util/parse-events.l                               |  1 +
 tools/perf/util/parse-events.y                               |  2 +-
 tools/perf/util/precise.c                                    | 45 +++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/util.h                                       |  2 ++
 14 files changed, 266 insertions(+), 11 deletions(-)
author
#1 lore raw

PATCH 1/9 perf x86: Add precise sysfs cpu pmu attribute

Adding sysfs 'precise' attribute for cpu device (/sys/devices/cpu/precise) to show the maximum value for perf event precise attribute.

This will be initially used for automated precise event perf test and could be helpful otherwise.

TODO Arnaldo suggested to use this as a guide for default adding of precise attribute for HW events.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 arch/x86/kernel/cpu/perf_event.c | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)
arch/x86/kernel/cpu/perf_event.c +25 -9
index 6774c17..190995e 100644
@@ -377,19 +377,26 @@ static inline int precise_br_compat(struct perf_event *event)
 	return m == b;
 }
 
-int x86_pmu_hw_config(struct perf_event *event)
+static int x86_get_precise(void)
 {
-	if (event->attr.precise_ip) {
-		int precise = 0;
+	int precise = 0;
 
-		/* Support for constant skid */
-		if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
+	/* Support for constant skid */
+	if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
+		precise++;
+
+		/* Support for IP fixup */
+		if (x86_pmu.lbr_nr)
 			precise++;
+	}
 
-			/* Support for IP fixup */
-			if (x86_pmu.lbr_nr)
-				precise++;
-		}
+	return precise;
+}
+
+int x86_pmu_hw_config(struct perf_event *event)
+{
+	if (event->attr.precise_ip) {
+		int precise = x86_get_precise();
 
 		if (event->attr.precise_ip > precise)
 			return -EOPNOTSUPP;
@@ -1700,6 +1707,13 @@ static int x86_pmu_event_init(struct perf_event *event)
 	return err;
 }
 
+static ssize_t get_attr_precise(struct device *cdev,
+				struct device_attribute *attr,
+				char *buf)
+{
+	return snprintf(buf, 10, "%d\n", x86_get_precise());
+}
+
 static int x86_pmu_event_idx(struct perf_event *event)
 {
 	int idx = event->hw.idx;
@@ -1752,9 +1766,11 @@ static ssize_t set_attr_rdpmc(struct device *cdev,
 }
 
 static DEVICE_ATTR(rdpmc, S_IRUSR | S_IWUSR, get_attr_rdpmc, set_attr_rdpmc);
+static DEVICE_ATTR(precise, S_IRUGO, get_attr_precise, NULL);
 
 static struct attribute *x86_pmu_attrs[] = {
 	&dev_attr_rdpmc.attr,
+	&dev_attr_precise.attr,
 	NULL,
 };
 
Signature · 1 line
1.7.11.7
author
#2 lore raw

PATCH 2/9 perf tools: Add precise object to interface sysfs precise

In reply to Jiri Olsa

Adding precise util object to get maximum value for perf_event_attr::precise_ip. The value is exported via sysfs file '/sys/devices/cpu/precise'.

The interface is:
int perf_precise__get(void)

Returns:
maximum value allowed for perf_event_attr::precise_ip
0 if sysfs attribute is not found (supported)
-1 if we failed to read the sysfs attribute

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/Makefile       |  1 +
 tools/perf/util/precise.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/util.h    |  2 ++
 3 files changed, 48 insertions(+)
 create mode 100644 tools/perf/util/precise.c
tools/perf/Makefile +1 -0
index a84021a..541d242 100644
@@ -463,6 +463,7 @@ LIB_OBJS += $(OUTPUT)util/rblist.o
 LIB_OBJS += $(OUTPUT)util/intlist.o
 LIB_OBJS += $(OUTPUT)util/vdso.o
 LIB_OBJS += $(OUTPUT)util/stat.o
+LIB_OBJS += $(OUTPUT)util/precise.o
 
 LIB_OBJS += $(OUTPUT)ui/setup.o
 LIB_OBJS += $(OUTPUT)ui/helpline.o
tools/perf/util/precise.c new file +45 -0

45 lines not on this page · raw message

tools/perf/util/util.h +2 -0
index 09b4c26..6d846e9 100644
@@ -275,4 +275,6 @@ extern unsigned int page_size;
 struct winsize;
 void get_term_dimensions(struct winsize *ws);
 
+int perf_precise__get(void);
+
 #endif
Signature · 1 line
1.7.11.7
author
#3 lore raw

PATCH 3/9 perf tests: Add precise event automated test

In reply to Jiri Olsa

The test detects the precise attribute availability and try to open perf event with each allowed precise attribute value.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/Makefile             |  1 +
 tools/perf/tests/builtin-test.c |  4 ++++
 tools/perf/tests/precise.c      | 52 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h        |  1 +
 4 files changed, 58 insertions(+)
 create mode 100644 tools/perf/tests/precise.c
tools/perf/Makefile +1 -0
index 541d242..46154f7 100644
@@ -489,6 +489,7 @@ LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
 LIB_OBJS += $(OUTPUT)tests/pmu.o
 LIB_OBJS += $(OUTPUT)tests/hists_link.o
 LIB_OBJS += $(OUTPUT)tests/python-use.o
+LIB_OBJS += $(OUTPUT)tests/precise.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
tools/perf/tests/builtin-test.c +4 -0
index acb98e0..c7649d7 100644
@@ -78,6 +78,10 @@ static struct test {
 		.func = test__python_use,
 	},
 	{
+		.desc = "Test precise event attribute",
+		.func = test__precise,
+	},
+	{
 		.func = NULL,
 	},
 };
tools/perf/tests/precise.c new file +52 -0

52 lines not on this page · raw message

tools/perf/tests/tests.h +1 -0
index 5de0be1..ff6db12 100644
@@ -23,5 +23,6 @@ int test__dso_data(void);
 int test__parse_events(void);
 int test__hists_link(void);
 int test__python_use(void);
+int test__precise(void);
 
 #endif /* TESTS_H */
Signature · 1 line
1.7.11.7
author
#4 lore raw

PATCH 4/9 perf tools: Add a precise event qualifier

In reply to Jiri Olsa

From: Andi Kleen <[email protected]>

Add a precise qualifier, like cpu/event=0x3c,precise=1/

This is needed so that the kernel can request enabling PEBS for TSX events. The parser bails out on any sysfs parse errors, so this is needed in any case to handle any event on the TSX perf kernel.

Cc Jiri Olsa <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
[ nit: changed subject line a bit]
---
 tools/perf/util/parse-events.c | 6 ++++++
 tools/perf/util/parse-events.h | 1 +
 tools/perf/util/parse-events.l | 1 +
 3 files changed, 8 insertions(+)
tools/perf/util/parse-events.c +6 -0
index 02f6421..217ce56 100644
@@ -568,6 +568,12 @@ do {								\
 	case PARSE_EVENTS__TERM_TYPE_NAME:
 		CHECK_TYPE_VAL(STR);
 		break;
+	case PARSE_EVENTS__TERM_TYPE_PRECISE:
+		CHECK_TYPE_VAL(NUM);
+		if ((unsigned)term->val.num > 2)
+			return -EINVAL;
+		attr->precise_ip = term->val.num;
+		break;
 	default:
 		return -EINVAL;
 	}
tools/perf/util/parse-events.h +1 -0
index 2cd2c42..9d526cf 100644
@@ -48,6 +48,7 @@ enum {
 	PARSE_EVENTS__TERM_TYPE_NAME,
 	PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
 	PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
+	PARSE_EVENTS__TERM_TYPE_PRECISE,
 };
 
 struct parse_events_term {
tools/perf/util/parse-events.l +1 -0
index e9d1134..32a9000 100644
@@ -169,6 +169,7 @@ period			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
 branch_type		{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); }
 ,			{ return ','; }
 "/"			{ BEGIN(INITIAL); return '/'; }
+precise			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PRECISE); }
 {name_minus}		{ return str(yyscanner, PE_NAME); }
 }
 
Signature · 1 line
1.7.11.7
author
#5 lore raw

PATCH 5/9 perf tools: Read maximal precise value for 'precise' term

In reply to Jiri Olsa

Currently if the term is specified without any value like -e 'cpu/...,precise,../', the number '1' is assigned as its default value.

Adding special treatment for 'precise' term to use the maximum allowed precise value in such case using the perf_precise__get function.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/util/parse-events.c | 29 ++++++++++++++++++++++++++---
 tools/perf/util/parse-events.h |  2 ++
 tools/perf/util/parse-events.y |  2 +-
 3 files changed, 29 insertions(+), 4 deletions(-)
tools/perf/util/parse-events.c +26 -3
index 217ce56..a92c403 100644
@@ -570,9 +570,14 @@ do {								\
 		break;
 	case PARSE_EVENTS__TERM_TYPE_PRECISE:
 		CHECK_TYPE_VAL(NUM);
-		if ((unsigned)term->val.num > 2)
-			return -EINVAL;
-		attr->precise_ip = term->val.num;
+		/* No value specified, try to get it from sysfs. */
+		if (term->val.num == (u64) -1)
+			attr->precise_ip = perf_precise__get();
+		else {
+			if ((unsigned)term->val.num > 2)
+				return -EINVAL;
+			attr->precise_ip = term->val.num;
+		}
 		break;
 	default:
 		return -EINVAL;
@@ -1210,6 +1215,24 @@ int parse_events_term__num(struct parse_events_term **term,
 			config, NULL, num);
 }
 
+int parse_events_term__num_default(struct parse_events_term **term,
+				   int type_term, char *config)
+{
+	/*
+	 * If no value is specified for term, we use 1 as default.
+	 * The PRECISE term is an exception, because we force special
+	 * functionality when there's no value specified for it,
+	 * so we need to recognize it.
+	 */
+	u64 num = 1;
+
+	if (type_term == PARSE_EVENTS__TERM_TYPE_PRECISE)
+		num = (u64) -1;
+
+	return new_term(term, PARSE_EVENTS__TERM_TYPE_NUM, type_term,
+			config, NULL, num);
+}
+
 int parse_events_term__str(struct parse_events_term **term,
 			   int type_term, char *config, char *str)
 {
tools/perf/util/parse-events.h +2 -0
index 9d526cf..a5c6d65 100644
@@ -74,6 +74,8 @@ struct parse_events_terms {
 int parse_events__is_hardcoded_term(struct parse_events_term *term);
 int parse_events_term__num(struct parse_events_term **_term,
 			   int type_term, char *config, u64 num);
+int parse_events_term__num_default(struct parse_events_term **term,
+				   int type_term, char *config);
 int parse_events_term__str(struct parse_events_term **_term,
 			   int type_term, char *config, char *str);
 int parse_events_term__sym_hw(struct parse_events_term **term,
tools/perf/util/parse-events.y +1 -1
index 9d43c86..376e9b4 100644
@@ -399,7 +399,7 @@ PE_TERM
 {
 	struct parse_events_term *term;
 
-	ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1));
+	ABORT_ON(parse_events_term__num_default(&term, (int)$1, NULL));
 	$$ = term;
 }
 
Signature · 1 line
1.7.11.7
author
#6 lore raw

PATCH 6/9 perf tools: Favor 'p' modifier before 'precise' term properly

In reply to Jiri Olsa

The 'p' event modifier is stronger than setting precise_ip using the 'precise' term, like:

'cpu/cycles,precise/' - precise_ip = sysfs precise value
'cpu/cycles,precise/p' - precise_ip = 1

There's currently bug if the event modifier without 'p' is specified the precise_ip is set to zero, like:

'cpu/cycles,precise/u' - precise_ip = 0

This patch makes sure that the precise_ip value is overwritten only if any 'p' event modifier is specified, like:

'cpu/cycles,precise/u' - precise_ip = sysfs precise value

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/util/parse-events.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/parse-events.c +8 -1
index a92c403..83362f2 100644
@@ -818,7 +818,14 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
 		evsel->attr.exclude_user   = mod.eu;
 		evsel->attr.exclude_kernel = mod.ek;
 		evsel->attr.exclude_hv     = mod.eh;
-		evsel->attr.precise_ip     = mod.precise;
+
+		/*
+		 * Change precise only if it's defined, so we don't
+		 * overwrite 'precise' term if there's no 'p' modifier.
+		 */
+		if (mod.precise)
+			evsel->attr.precise_ip = mod.precise;
+
 		evsel->attr.exclude_host   = mod.eH;
 		evsel->attr.exclude_guest  = mod.eG;
 		evsel->exclude_GH          = mod.exclude_GH;
Signature · 1 line
1.7.11.7
author
#7 lore raw

PATCH 7/9 perf tests: Add automated precise term test

In reply to Jiri Olsa

Adding automated test for precise term test in event:
'cpu/cycles,precise/' 'cpu/cycles,precise/p' 'cpu/cycles,precise/u'

to check proper values of precise_ip driven by sysfs precise attribute.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/tests/parse-events.c | 75 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
tools/perf/tests/parse-events.c +75 -0
index 20acaff..f92580d 100644
@@ -5,6 +5,7 @@
 #include "sysfs.h"
 #include "debugfs.h"
 #include "tests.h"
+#include "util.h"
 #include <linux/hw_breakpoint.h>
 
 #define TEST_ASSERT_VAL(text, cond) \
@@ -445,6 +446,68 @@ static int test__checkevent_pmu_name(struct perf_evlist *evlist)
 	return 0;
 }
 
+static int test__checkevent_pmu_precise(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	/* cpu/cycles,precise/ */
+	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
+	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
+	TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
+	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
+	/* precise is driven by sysfs precise attribute */
+	TEST_ASSERT_VAL("wrong precise_ip",
+		evsel->attr.precise_ip == perf_precise__get());
+	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
+
+	return 0;
+}
+
+static int test__checkevent_pmu_precise1(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	/* cpu/cycles,precise/p */
+	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
+	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
+	TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
+	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
+	/* precise is driven by 'p' modifier */
+	TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1);
+	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
+
+	return 0;
+}
+
+static int test__checkevent_pmu_precise2(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	/* cpu/cycles,precise/u */
+	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
+	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
+	TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
+	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
+	TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
+	TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
+	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
+	/* precise is driven by sysfs precise attribute */
+	TEST_ASSERT_VAL("wrong precise_ip",
+		evsel->attr.precise_ip == perf_precise__get());
+	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
+
+	return 0;
+}
+
 static int test__checkevent_pmu_events(struct perf_evlist *evlist)
 {
 	struct perf_evsel *evsel;
@@ -994,6 +1057,18 @@ static struct evlist_test test__events_pmu[] = {
 		.name  = "cpu/config=1,name=krava/u,cpu/config=2/u",
 		.check = test__checkevent_pmu_name,
 	},
+	[2] = {
+		.name  = "cpu/cycles,precise/",
+		.check = test__checkevent_pmu_precise,
+	},
+	[3] = {
+		.name  = "cpu/cycles,precise/p",
+		.check = test__checkevent_pmu_precise1,
+	},
+	[4] = {
+		.name  = "cpu/cycles,precise/u",
+		.check = test__checkevent_pmu_precise2,
+	},
 };
 
 struct terms_test {
Signature · 1 line
1.7.11.7
author
#8 lore raw

PATCH 8/9 perf: Document the ABI for 'precise' sysfs attribute

In reply to Jiri Olsa

Adding ABI documentation for newly added 'precise' sysfs attribute. It's added under the testing section.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 .../ABI/testing/sysfs-bus-event_source-devices-cpu-precise     | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-cpu-precise
Documentation/ABI/testing/sysfs-bus-event_source-devices-cpu-precise new file +10 -0
new file mode 100644
index 0000000..f3ed378
@@ -0,0 +1,10 @@
+Where:		/sys/bus/event_source/devices/cpu/precise
+Date:		January 2013
+Kernel Version:	3.7
+Contact:	Jiri Olsa <[email protected]>
+		Linux kernel mailing list <[email protected]>
+Description:
+		X86 specific attribute
+
+		Attribute to specify the maximum allowed value
+		for perf_event_attr:precise_ip field.
Signature · 1 line
1.7.11.7
author
#9 lore raw

PATCH 9/9 perf: Document the ABI for 'rdpmc' sysfs attribute

In reply to Jiri Olsa

Adding ABI documentation for newly added 'rdpmc' sysfs attribute. It's added under the testing section.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
---
 .../ABI/testing/sysfs-bus-event_source-devices-cpu-rdpmc          | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-cpu-rdpmc
Documentation/ABI/testing/sysfs-bus-event_source-devices-cpu-rdpmc new file +8 -0
new file mode 100644
index 0000000..b4f5cbf
@@ -0,0 +1,8 @@
+Where:		/sys/bus/event_source/devices/cpu/rdpmc
+Date:		January 2013
+Kernel Version:	3.7
+Contact:	Linux kernel mailing list <[email protected]>
+Description:
+		X86 specific attribute
+
+		Attribute to enable/disable user space RDPMC instruction.
Signature · 1 line
1.7.11.7
author
#10 lore raw
In reply to Jiri Olsa
Quoted 8 lines · Jiri Olsa

hi,
adding sysfs attribute to specify the maximum allowed value for perf_event_attr::precise_ip field.

Adding functionality for simple 'precise' term to get the maximum allowed value for perf_event_attr::precise_ip field.

And finally adding several precise automated tests.

Available also at:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
perf/precise3

jirka

#11 lore raw
In reply to Jiri Olsa
Quoted 8 lines · Jiri Olsa

hi,
adding sysfs attribute to specify the maximum allowed value for perf_event_attr::precise_ip field.

Adding functionality for simple 'precise' term to get the maximum allowed value for perf_event_attr::precise_ip field.

And finally adding several precise automated tests.

Ok - could we please as a next step turn on cycles:pp as the default in all the profiling tools (perf record, perf top), transparently? I.e. if the CPU supports it then use it, if not then don't complain, just use the highest grade profiling method available.

Thanks,

Ingo

author
#12 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 7 lines · Jiri Olsa

hi,
adding sysfs attribute to specify the maximum allowed value for perf_event_attr::precise_ip field.

Adding functionality for simple 'precise' term to get the maximum allowed value for perf_event_attr::precise_ip field.

Quoted 7 lines
Quoted 1 line

And finally adding several precise automated tests.

Ok - could we please as a next step turn on cycles:pp as the default in all the profiling tools (perf record, perf top), transparently? I.e. if the CPU supports it then use it, if not then don't complain, just use the highest grade profiling method available.

yep, we discussed with Arnaldo this would be good to have

jirka

#13 lore raw
Quoted 13 lines · Jiri Olsa
Quoted 12 lines · Ingo Molnar
Quoted 8 lines · Jiri Olsa

hi,
adding sysfs attribute to specify the maximum allowed value for perf_event_attr::precise_ip field.

Adding functionality for simple 'precise' term to get the maximum allowed value for perf_event_attr::precise_ip field.

And finally adding several precise automated tests.

Quoted 7 lines
Quoted 5 lines

Ok - could we please as a next step turn on cycles:pp as the default in all the profiling tools (perf record, perf top), transparently? I.e. if the CPU supports it then use it, if not then don't complain, just use the highest grade profiling method available.

yep, we discussed with Arnaldo this would be good to have

This would be a high-profile, user visible improvement to profiling quality.

Thanks,

Ingo