linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] perf tools: Fix attr tests
@ 2017-07-03 14:50 Jiri Olsa
  2017-07-03 14:50 ` [PATCH 01/15] perf tools: Fix -n option Jiri Olsa
                   ` (15 more replies)
  0 siblings, 16 replies; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

hi,
attr tests have been broken for some time now. Updating
the data files plus some other processing fixes.

It's also available in here:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/attr_test

thanks,
jirka
---
 tools/perf/perf.h                                                        |  1 +
 tools/perf/tests/attr.c                                                  | 12 +++++++++++-
 tools/perf/tests/attr.py                                                 | 50 +++++++++++++++++++++++++++++---------------------
 tools/perf/tests/attr/base-record                                        |  8 ++++----
 tools/perf/tests/attr/base-stat                                          |  4 ++--
 tools/perf/tests/attr/test-record-C0                                     |  1 +
 tools/perf/tests/attr/test-record-basic                                  |  1 +
 tools/perf/tests/attr/test-record-branch-any                             |  2 +-
 tools/perf/tests/attr/test-record-branch-filter-any                      |  2 +-
 tools/perf/tests/attr/test-record-branch-filter-any_call                 |  2 +-
 tools/perf/tests/attr/test-record-branch-filter-any_ret                  |  2 +-
 tools/perf/tests/attr/test-record-branch-filter-hv                       |  2 +-
 tools/perf/tests/attr/test-record-branch-filter-ind_call                 |  2 +-
 tools/perf/tests/attr/test-record-branch-filter-k                        |  2 +-
 tools/perf/tests/attr/test-record-branch-filter-u                        |  2 +-
 tools/perf/tests/attr/test-record-count                                  |  1 +
 tools/perf/tests/attr/test-record-data                                   |  3 +--
 tools/perf/tests/attr/test-record-freq                                   |  1 +
 tools/perf/tests/attr/test-record-graph-default                          |  1 +
 tools/perf/tests/attr/test-record-graph-dwarf                            |  4 +++-
 tools/perf/tests/attr/test-record-graph-fp                               |  1 +
 tools/perf/tests/attr/test-record-group                                  |  2 ++
 tools/perf/tests/attr/test-record-group-sampling                         |  3 ++-
 tools/perf/tests/attr/test-record-group1                                 |  2 ++
 tools/perf/tests/attr/{test-record-no-delay => test-record-no-buffering} |  4 ++--
 tools/perf/tests/attr/test-record-no-inherit                             |  1 +
 tools/perf/tests/attr/test-record-no-samples                             |  1 +
 tools/perf/tests/attr/test-record-period                                 |  1 +
 tools/perf/tests/attr/test-record-raw                                    |  2 +-
 tools/perf/tests/attr/test-stat-C0                                       |  4 ++--
 tools/perf/tests/attr/test-stat-default                                  |  2 ++
 tools/perf/tests/attr/test-stat-detailed-1                               |  2 ++
 tools/perf/tests/attr/test-stat-detailed-2                               |  3 +++
 tools/perf/tests/attr/test-stat-detailed-3                               |  5 +++++
 tools/perf/util/evsel.c                                                  |  8 +++++++-
 35 files changed, 98 insertions(+), 46 deletions(-)

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 01/15] perf tools: Fix -n option
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-03 14:57   ` Arnaldo Carvalho de Melo
  2017-07-03 14:50 ` [PATCH 02/15] perf tests attr: Do not store failed events Jiri Olsa
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

The kernel fails to add a non sampling event event
with having precise_ip set.

Make sure the precise_ip is 0 when using -n option
to create non sampling event in record.

Link: http://lkml.kernel.org/n/tip-l513fzc1houvu7tl1bo5y65y@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/evsel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 6f4882f8d61f..915fe3cd6544 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -890,8 +890,10 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
 		attr->sample_period = 0;
 	}
 
-	if (opts->no_samples)
+	if (opts->no_samples) {
 		attr->sample_freq = 0;
+		attr->precise_ip = 0;
+	}
 
 	if (opts->inherit_stat)
 		attr->inherit_stat = 1;
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 02/15] perf tests attr: Do not store failed events
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
  2017-07-03 14:50 ` [PATCH 01/15] perf tools: Fix -n option Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 03/15] perf tests attr: Add test_attr__ready function Jiri Olsa
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

Do not mess up our temp space with files we don't
need - failed event open attempts.

Link: http://lkml.kernel.org/n/tip-gfmm0o2bidc41umvecbtsf36@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 0e77b2cf61ec..08b1d5ce9020 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -136,7 +136,7 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 {
 	int errno_saved = errno;
 
-	if (store_event(attr, pid, cpu, fd, group_fd, flags)) {
+	if ((fd != -1) && store_event(attr, pid, cpu, fd, group_fd, flags)) {
 		pr_err("test attr FAILED");
 		exit(128);
 	}
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 03/15] perf tests attr: Add test_attr__ready function
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
  2017-07-03 14:50 ` [PATCH 01/15] perf tools: Fix -n option Jiri Olsa
  2017-07-03 14:50 ` [PATCH 02/15] perf tests attr: Do not store failed events Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 04/15] perf tests attr: Make compare_data global Jiri Olsa
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

We create many test events before the real ones
just to test specific features. But there's no way
for attr tests to separate those test events
from those it needs to check.

Adding 'ready' call from the events open interface
to trigger/start events collection for attr test.

Link: http://lkml.kernel.org/n/tip-mugsnw0j4lb44ytlbwxajh92@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/perf.h       |  1 +
 tools/perf/tests/attr.c | 10 ++++++++++
 tools/perf/util/evsel.c |  4 ++++
 3 files changed, 15 insertions(+)

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 806c216a1078..2c010dd6a79d 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -7,6 +7,7 @@
 #include <linux/perf_event.h>
 
 extern bool test_attr__enabled;
+void test_attr__ready(void);
 void test_attr__init(void);
 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 		     int fd, int group_fd, unsigned long flags);
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 08b1d5ce9020..84c0eb598a67 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -36,6 +36,7 @@
 #define ENV "PERF_TEST_ATTR"
 
 static char *dir;
+static bool ready;
 
 void test_attr__init(void)
 {
@@ -67,6 +68,9 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
 	FILE *file;
 	char path[PATH_MAX];
 
+	if (!ready)
+		return 0;
+
 	snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
 		 attr->type, attr->config, fd);
 
@@ -144,6 +148,12 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 	errno = errno_saved;
 }
 
+void test_attr__ready(void)
+{
+	if (unlikely(test_attr__enabled) && !ready)
+		ready = true;
+}
+
 static int run_dir(const char *d, const char *perf)
 {
 	char v[] = "-vvvvv";
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 915fe3cd6544..7f9ed521f42c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -58,6 +58,8 @@ static int perf_evsel__no_extra_init(struct perf_evsel *evsel __maybe_unused)
 	return 0;
 }
 
+void __weak test_attr__ready(void) { }
+
 static void perf_evsel__no_extra_fini(struct perf_evsel *evsel __maybe_unused)
 {
 }
@@ -1568,6 +1570,8 @@ int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 			pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 				  pid, cpus->map[cpu], group_fd, flags);
 
+			test_attr__ready();
+
 			fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu],
 						 group_fd, flags);
 
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 04/15] perf tests attr: Make compare_data global
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (2 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 03/15] perf tests attr: Add test_attr__ready function Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 05/15] perf tests attr: Rename compare_data to data_equal Jiri Olsa
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

Making compare_data global, so it could be used outside
the Test class scope to compare command results.

Link: http://lkml.kernel.org/n/tip-5wm3kyb6hkuldvt4f8s8qa3s@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr.py | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index cdf21a9d0c35..bb671cd1d66a 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -9,6 +9,20 @@ import logging
 import shutil
 import ConfigParser
 
+def compare_data(a, b):
+    # Allow multiple values in assignment separated by '|'
+    a_list = a.split('|')
+    b_list = b.split('|')
+
+    for a_item in a_list:
+        for b_item in b_list:
+            if (a_item == b_item):
+                return True
+            elif (a_item == '*') or (b_item == '*'):
+                return True
+
+    return False
+
 class Fail(Exception):
     def __init__(self, test, msg):
         self.msg = msg
@@ -82,26 +96,12 @@ class Event(dict):
         self.add(base)
         self.add(data)
 
-    def compare_data(self, a, b):
-        # Allow multiple values in assignment separated by '|'
-        a_list = a.split('|')
-        b_list = b.split('|')
-
-        for a_item in a_list:
-            for b_item in b_list:
-                if (a_item == b_item):
-                    return True
-                elif (a_item == '*') or (b_item == '*'):
-                    return True
-
-        return False
-
     def equal(self, other):
         for t in Event.terms:
             log.debug("      [%s] %s %s" % (t, self[t], other[t]));
             if not self.has_key(t) or not other.has_key(t):
                 return False
-            if not self.compare_data(self[t], other[t]):
+            if not compare_data(self[t], other[t]):
                 return False
         return True
 
@@ -109,7 +109,7 @@ class Event(dict):
         for t in Event.terms:
             if not self.has_key(t) or not other.has_key(t):
                 continue
-            if not self.compare_data(self[t], other[t]):
+            if not compare_data(self[t], other[t]):
 		log.warning("expected %s=%s, got %s" % (t, self[t], other[t]))
 
 # Test file description needs to have following sections:
@@ -218,9 +218,9 @@ class Test(object):
               self.perf, self.command, tempdir, self.args)
         ret = os.WEXITSTATUS(os.system(cmd))
 
-        log.info("  '%s' ret %d " % (cmd, ret))
+        log.info("  '%s' ret '%s', expected '%s'" % (cmd, str(ret), str(self.ret)))
 
-        if ret != int(self.ret):
+        if not compare_data(str(ret), str(self.ret)):
             raise Unsup(self)
 
     def compare(self, expect, result):
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 05/15] perf tests attr: Rename compare_data to data_equal
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (3 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 04/15] perf tests attr: Make compare_data global Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 06/15] perf tests attr: Add 1s for exclude_kernel and task base bits Jiri Olsa
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

The data_equal name fits better to the return value
of the function. It's true when the data is equal.

Link: http://lkml.kernel.org/n/tip-rmebesaea5axp8fq9lfvx35s@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index bb671cd1d66a..b03261c6b1ed 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -9,7 +9,7 @@ import logging
 import shutil
 import ConfigParser
 
-def compare_data(a, b):
+def data_equal(a, b):
     # Allow multiple values in assignment separated by '|'
     a_list = a.split('|')
     b_list = b.split('|')
@@ -101,7 +101,7 @@ class Event(dict):
             log.debug("      [%s] %s %s" % (t, self[t], other[t]));
             if not self.has_key(t) or not other.has_key(t):
                 return False
-            if not compare_data(self[t], other[t]):
+            if not data_equal(self[t], other[t]):
                 return False
         return True
 
@@ -109,7 +109,7 @@ class Event(dict):
         for t in Event.terms:
             if not self.has_key(t) or not other.has_key(t):
                 continue
-            if not compare_data(self[t], other[t]):
+            if not data_equal(self[t], other[t]):
 		log.warning("expected %s=%s, got %s" % (t, self[t], other[t]))
 
 # Test file description needs to have following sections:
@@ -220,7 +220,7 @@ class Test(object):
 
         log.info("  '%s' ret '%s', expected '%s'" % (cmd, str(ret), str(self.ret)))
 
-        if not compare_data(str(ret), str(self.ret)):
+        if not data_equal(str(ret), str(self.ret)):
             raise Unsup(self)
 
     def compare(self, expect, result):
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 06/15] perf tests attr: Add 1s for exclude_kernel and task base bits
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (4 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 05/15] perf tests attr: Rename compare_data to data_equal Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 07/15] perf tests attr: Fix record dwarf test Jiri Olsa
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

There's an event open fallback which set exclude_kernel=1 in
case use does not have enough privileges. Adding both 0|1
for this attribute, because we don't know what value it is.

Link: http://lkml.kernel.org/n/tip-7cdkhcuov5izzgr4u4tvde22@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/base-record | 2 +-
 tools/perf/tests/attr/base-stat   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 7e6d74946e04..cdf3adf7d389 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -15,7 +15,7 @@ inherit=1
 pinned=0
 exclusive=0
 exclude_user=0
-exclude_kernel=0
+exclude_kernel=0|1
 exclude_hv=0
 exclude_idle=0
 mmap=1
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index f4cf148f14cb..ff9b33d4ae9e 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -15,7 +15,7 @@ inherit=1
 pinned=0
 exclusive=0
 exclude_user=0
-exclude_kernel=0
+exclude_kernel=0|1
 exclude_hv=0
 exclude_idle=0
 mmap=0
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 07/15] perf tests attr: Fix record dwarf test
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (5 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 06/15] perf tests attr: Add 1s for exclude_kernel and task base bits Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 08/15] perf tests attr: Fix no-delay test Jiri Olsa
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

Following commit:
  commit 5c0cf22477ea ("perf record: Store data mmaps for dwarf unwind")

have enabled address sampling for dwarf unwind, we need to
reflect that in this test by adding ADDR sample_type and
enabling mmap_data.

Link: http://lkml.kernel.org/n/tip-ctnkeyqibfal31539rnyflkp@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/test-record-graph-dwarf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/test-record-graph-dwarf b/tools/perf/tests/attr/test-record-graph-dwarf
index d6f324ea578c..8321c602dc38 100644
--- a/tools/perf/tests/attr/test-record-graph-dwarf
+++ b/tools/perf/tests/attr/test-record-graph-dwarf
@@ -3,8 +3,9 @@ command = record
 args    = --call-graph dwarf -- kill >/dev/null 2>&1
 
 [event:base-record]
-sample_type=12583
+sample_type=45359
 exclude_callchain_user=1
 sample_stack_user=8192
 # TODO different for each arch, no support for that now
 sample_regs_user=*
+mmap_data=1
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 08/15] perf tests attr: Fix no-delay test
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (6 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 07/15] perf tests attr: Fix record dwarf test Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 09/15] perf tests attr: Add proper return values Jiri Olsa
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

Following commit:
  commit 509051ea8427 ("perf record: Rename --no-delay to --no-buffering")

removed '-D' option and renamed --no-delay into --no-buffering.
Fixing that in the attr tests.

Link: http://lkml.kernel.org/n/tip-aakpbs9yvatfen5aq4vd6atx@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 .../perf/tests/attr/{test-record-no-delay => test-record-no-buffering}  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename tools/perf/tests/attr/{test-record-no-delay => test-record-no-buffering} (70%)

diff --git a/tools/perf/tests/attr/test-record-no-delay b/tools/perf/tests/attr/test-record-no-buffering
similarity index 70%
rename from tools/perf/tests/attr/test-record-no-delay
rename to tools/perf/tests/attr/test-record-no-buffering
index f253b78cdbf2..0b0355af013a 100644
--- a/tools/perf/tests/attr/test-record-no-delay
+++ b/tools/perf/tests/attr/test-record-no-buffering
@@ -1,6 +1,6 @@
 [config]
 command = record
-args    = -D kill >/dev/null 2>&1
+args    = --no-buffering kill >/dev/null 2>&1
 
 [event:base-record]
 sample_period=4000
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 09/15] perf tests attr: Add proper return values
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (7 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 08/15] perf tests attr: Fix no-delay test Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 10/15] perf tests attr: Fix cpu test disabled term setup Jiri Olsa
                   ` (6 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

The record command now properly returns the status of the tracee
if there's any. We need to properly set the expected return value
of the tracee in the attr tests.

Link: http://lkml.kernel.org/n/tip-1fheivpbosukdsbpa4jv4bkt@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/test-record-C0                     | 1 +
 tools/perf/tests/attr/test-record-basic                  | 1 +
 tools/perf/tests/attr/test-record-branch-any             | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any      | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any_call | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any_ret  | 1 +
 tools/perf/tests/attr/test-record-branch-filter-hv       | 1 +
 tools/perf/tests/attr/test-record-branch-filter-ind_call | 1 +
 tools/perf/tests/attr/test-record-branch-filter-k        | 1 +
 tools/perf/tests/attr/test-record-branch-filter-u        | 1 +
 tools/perf/tests/attr/test-record-count                  | 1 +
 tools/perf/tests/attr/test-record-data                   | 1 +
 tools/perf/tests/attr/test-record-freq                   | 1 +
 tools/perf/tests/attr/test-record-graph-default          | 1 +
 tools/perf/tests/attr/test-record-graph-dwarf            | 1 +
 tools/perf/tests/attr/test-record-graph-fp               | 1 +
 tools/perf/tests/attr/test-record-group                  | 1 +
 tools/perf/tests/attr/test-record-group-sampling         | 1 +
 tools/perf/tests/attr/test-record-group1                 | 1 +
 tools/perf/tests/attr/test-record-no-buffering           | 1 +
 tools/perf/tests/attr/test-record-no-inherit             | 1 +
 tools/perf/tests/attr/test-record-no-samples             | 1 +
 tools/perf/tests/attr/test-record-period                 | 1 +
 tools/perf/tests/attr/test-record-raw                    | 1 +
 24 files changed, 24 insertions(+)

diff --git a/tools/perf/tests/attr/test-record-C0 b/tools/perf/tests/attr/test-record-C0
index d6a7e43f61b3..cb0a3138fa54 100644
--- a/tools/perf/tests/attr/test-record-C0
+++ b/tools/perf/tests/attr/test-record-C0
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -C 0 kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 cpu=0
diff --git a/tools/perf/tests/attr/test-record-basic b/tools/perf/tests/attr/test-record-basic
index 55c0428370ca..85a23cf35ba1 100644
--- a/tools/perf/tests/attr/test-record-basic
+++ b/tools/perf/tests/attr/test-record-basic
@@ -1,5 +1,6 @@
 [config]
 command = record
 args    = kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
diff --git a/tools/perf/tests/attr/test-record-branch-any b/tools/perf/tests/attr/test-record-branch-any
index 1421960ed4e9..a2fe031e6f87 100644
--- a/tools/perf/tests/attr/test-record-branch-any
+++ b/tools/perf/tests/attr/test-record-branch-any
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -b kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any b/tools/perf/tests/attr/test-record-branch-filter-any
index 915c4df0e0c2..7df6a489c9ac 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any
+++ b/tools/perf/tests/attr/test-record-branch-filter-any
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j any kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_call b/tools/perf/tests/attr/test-record-branch-filter-any_call
index 8708dbd4f373..6c93e07da61c 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_call
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j any_call kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_ret b/tools/perf/tests/attr/test-record-branch-filter-any_ret
index 0d3607a6dcbe..daf8b83e257f 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_ret
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_ret
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j any_ret kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-hv b/tools/perf/tests/attr/test-record-branch-filter-hv
index f25526740cec..fbf491da4f33 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-hv
+++ b/tools/perf/tests/attr/test-record-branch-filter-hv
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j hv kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-ind_call b/tools/perf/tests/attr/test-record-branch-filter-ind_call
index e862dd179128..c63cc50d2269 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-ind_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-ind_call
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j ind_call kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-k b/tools/perf/tests/attr/test-record-branch-filter-k
index 182971e898f5..e0f2f09ff07b 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-k
+++ b/tools/perf/tests/attr/test-record-branch-filter-k
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j k kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-u b/tools/perf/tests/attr/test-record-branch-filter-u
index 83449ef9e687..6cd36e01b6fc 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-u
+++ b/tools/perf/tests/attr/test-record-branch-filter-u
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j u kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-count b/tools/perf/tests/attr/test-record-count
index 2f841de56f6b..34f6cc577263 100644
--- a/tools/perf/tests/attr/test-record-count
+++ b/tools/perf/tests/attr/test-record-count
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -c 123 kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=123
diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-data
index 716e143b5291..53c8890f6e5f 100644
--- a/tools/perf/tests/attr/test-record-data
+++ b/tools/perf/tests/attr/test-record-data
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -d kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-freq b/tools/perf/tests/attr/test-record-freq
index 600d0f8f2583..bf4cb459f0d5 100644
--- a/tools/perf/tests/attr/test-record-freq
+++ b/tools/perf/tests/attr/test-record-freq
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -F 100 kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=100
diff --git a/tools/perf/tests/attr/test-record-graph-default b/tools/perf/tests/attr/test-record-graph-default
index 853597a9a8f6..0b216e69760c 100644
--- a/tools/perf/tests/attr/test-record-graph-default
+++ b/tools/perf/tests/attr/test-record-graph-default
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -g kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=295
diff --git a/tools/perf/tests/attr/test-record-graph-dwarf b/tools/perf/tests/attr/test-record-graph-dwarf
index 8321c602dc38..da2fa73bd0a2 100644
--- a/tools/perf/tests/attr/test-record-graph-dwarf
+++ b/tools/perf/tests/attr/test-record-graph-dwarf
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --call-graph dwarf -- kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=45359
diff --git a/tools/perf/tests/attr/test-record-graph-fp b/tools/perf/tests/attr/test-record-graph-fp
index 055e3bee7993..625d190bb798 100644
--- a/tools/perf/tests/attr/test-record-graph-fp
+++ b/tools/perf/tests/attr/test-record-graph-fp
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --call-graph fp kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=295
diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
index 57739cacdb2a..6e7961f6f7a5 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-record-group
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --group -e cycles,instructions kill >/dev/null 2>&1
+ret     = 1
 
 [event-1:base-record]
 fd=1
diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
index 658f5d60c873..ef59afd6d635 100644
--- a/tools/perf/tests/attr/test-record-group-sampling
+++ b/tools/perf/tests/attr/test-record-group-sampling
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -e '{cycles,cache-misses}:S' kill >/dev/null 2>&1
+ret     = 1
 
 [event-1:base-record]
 fd=1
diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
index c5548d054aff..87a222d014d8 100644
--- a/tools/perf/tests/attr/test-record-group1
+++ b/tools/perf/tests/attr/test-record-group1
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -e '{cycles,instructions}' kill >/dev/null 2>&1
+ret     = 1
 
 [event-1:base-record]
 fd=1
diff --git a/tools/perf/tests/attr/test-record-no-buffering b/tools/perf/tests/attr/test-record-no-buffering
index 0b0355af013a..5bf349aeeb69 100644
--- a/tools/perf/tests/attr/test-record-no-buffering
+++ b/tools/perf/tests/attr/test-record-no-buffering
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --no-buffering kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-no-inherit b/tools/perf/tests/attr/test-record-no-inherit
index 44edcb2edcd5..560943decb87 100644
--- a/tools/perf/tests/attr/test-record-no-inherit
+++ b/tools/perf/tests/attr/test-record-no-inherit
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -i kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=263
diff --git a/tools/perf/tests/attr/test-record-no-samples b/tools/perf/tests/attr/test-record-no-samples
index d0141b2418b5..8eb73ab639e0 100644
--- a/tools/perf/tests/attr/test-record-no-samples
+++ b/tools/perf/tests/attr/test-record-no-samples
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -n kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=0
diff --git a/tools/perf/tests/attr/test-record-period b/tools/perf/tests/attr/test-record-period
index 8abc5314fc52..69bc748f0f27 100644
--- a/tools/perf/tests/attr/test-record-period
+++ b/tools/perf/tests/attr/test-record-period
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -c 100 -P kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=100
diff --git a/tools/perf/tests/attr/test-record-raw b/tools/perf/tests/attr/test-record-raw
index 4a8ef25b5f49..3b89f99c240b 100644
--- a/tools/perf/tests/attr/test-record-raw
+++ b/tools/perf/tests/attr/test-record-raw
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -R kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 10/15] perf tests attr: Fix cpu test disabled term setup
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (8 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 09/15] perf tests attr: Add proper return values Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 11/15] perf tests attr: Fix sample_period setup Jiri Olsa
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

The stat command creates all events disabled and
enables them either manualy or via the enable_on_exec
bit.

Link: http://lkml.kernel.org/n/tip-iyoncdvymh0vf1r0a1eytwyi@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/test-stat-C0 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/attr/test-stat-C0 b/tools/perf/tests/attr/test-stat-C0
index aa835950751f..67717fe6a65d 100644
--- a/tools/perf/tests/attr/test-stat-C0
+++ b/tools/perf/tests/attr/test-stat-C0
@@ -4,6 +4,6 @@ args    = -e cycles -C 0 kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-stat]
-# events are enabled by default when attached to cpu
-disabled=0
+# events are disabled by default when attached to cpu
+disabled=1
 enable_on_exec=0
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 11/15] perf tests attr: Fix sample_period setup
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (9 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 10/15] perf tests attr: Fix cpu test disabled term setup Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 12/15] perf tests attr: Fix precise_ip setup Jiri Olsa
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

The final period can differ from what user specifies
on command line due to the perf_event_max_sample_rate
sysctl setup.

Thus we can't predixt the sample_period value any more.

Link: http://lkml.kernel.org/n/tip-chdbv136vfnn43jqmg0r6jp2@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/base-record                        | 2 +-
 tools/perf/tests/attr/test-record-branch-any             | 1 -
 tools/perf/tests/attr/test-record-branch-filter-any      | 1 -
 tools/perf/tests/attr/test-record-branch-filter-any_call | 1 -
 tools/perf/tests/attr/test-record-branch-filter-any_ret  | 1 -
 tools/perf/tests/attr/test-record-branch-filter-hv       | 1 -
 tools/perf/tests/attr/test-record-branch-filter-ind_call | 1 -
 tools/perf/tests/attr/test-record-branch-filter-k        | 1 -
 tools/perf/tests/attr/test-record-branch-filter-u        | 1 -
 tools/perf/tests/attr/test-record-data                   | 2 --
 tools/perf/tests/attr/test-record-no-buffering           | 1 -
 tools/perf/tests/attr/test-record-raw                    | 1 -
 12 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index cdf3adf7d389..a9cb72b8fbb1 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -7,7 +7,7 @@ cpu=*
 type=0|1
 size=112
 config=0
-sample_period=4000
+sample_period=*
 sample_type=263
 read_format=0
 disabled=1
diff --git a/tools/perf/tests/attr/test-record-branch-any b/tools/perf/tests/attr/test-record-branch-any
index a2fe031e6f87..81f839e2fad0 100644
--- a/tools/perf/tests/attr/test-record-branch-any
+++ b/tools/perf/tests/attr/test-record-branch-any
@@ -4,6 +4,5 @@ args    = -b kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any b/tools/perf/tests/attr/test-record-branch-filter-any
index 7df6a489c9ac..357421f4dfce 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any
+++ b/tools/perf/tests/attr/test-record-branch-filter-any
@@ -4,6 +4,5 @@ args    = -j any kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_call b/tools/perf/tests/attr/test-record-branch-filter-any_call
index 6c93e07da61c..dbc55f2ab845 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_call
@@ -4,6 +4,5 @@ args    = -j any_call kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=16
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_ret b/tools/perf/tests/attr/test-record-branch-filter-any_ret
index daf8b83e257f..a0824ff8e131 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_ret
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_ret
@@ -4,6 +4,5 @@ args    = -j any_ret kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=32
diff --git a/tools/perf/tests/attr/test-record-branch-filter-hv b/tools/perf/tests/attr/test-record-branch-filter-hv
index fbf491da4f33..f34d6f120181 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-hv
+++ b/tools/perf/tests/attr/test-record-branch-filter-hv
@@ -4,6 +4,5 @@ args    = -j hv kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-ind_call b/tools/perf/tests/attr/test-record-branch-filter-ind_call
index c63cc50d2269..b86a35232248 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-ind_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-ind_call
@@ -4,6 +4,5 @@ args    = -j ind_call kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=64
diff --git a/tools/perf/tests/attr/test-record-branch-filter-k b/tools/perf/tests/attr/test-record-branch-filter-k
index e0f2f09ff07b..d3fbc5e1858a 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-k
+++ b/tools/perf/tests/attr/test-record-branch-filter-k
@@ -4,6 +4,5 @@ args    = -j k kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-u b/tools/perf/tests/attr/test-record-branch-filter-u
index 6cd36e01b6fc..a318f0dda173 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-u
+++ b/tools/perf/tests/attr/test-record-branch-filter-u
@@ -4,6 +4,5 @@ args    = -j u kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-data
index 53c8890f6e5f..a9cf2233b0ce 100644
--- a/tools/perf/tests/attr/test-record-data
+++ b/tools/perf/tests/attr/test-record-data
@@ -4,8 +4,6 @@ args    = -d kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
-
 # sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
 # PERF_SAMPLE_ADDR | PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC
 sample_type=33039
diff --git a/tools/perf/tests/attr/test-record-no-buffering b/tools/perf/tests/attr/test-record-no-buffering
index 5bf349aeeb69..aa3956d8fe20 100644
--- a/tools/perf/tests/attr/test-record-no-buffering
+++ b/tools/perf/tests/attr/test-record-no-buffering
@@ -4,7 +4,6 @@ args    = --no-buffering kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=263
 watermark=0
 wakeup_events=1
diff --git a/tools/perf/tests/attr/test-record-raw b/tools/perf/tests/attr/test-record-raw
index 3b89f99c240b..a188a614a44c 100644
--- a/tools/perf/tests/attr/test-record-raw
+++ b/tools/perf/tests/attr/test-record-raw
@@ -4,5 +4,4 @@ args    = -R kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=1415
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 12/15] perf tests attr: Fix precise_ip setup
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (10 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 11/15] perf tests attr: Fix sample_period setup Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 13/15] perf tests attr: Fix stat sample_type setup Jiri Olsa
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

We have test to detect to highest precise possible,
so test can't just predict precise_ip value.

Link: http://lkml.kernel.org/n/tip-idmdb13u2xuqvb68jyx76vs8@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/base-record | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index a9cb72b8fbb1..31e0b1da830b 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -25,7 +25,7 @@ inherit_stat=0
 enable_on_exec=1
 task=0
 watermark=0
-precise_ip=0
+precise_ip=0|1|2|3
 mmap_data=0
 sample_id_all=1
 exclude_host=0|1
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 13/15] perf tests attr: Fix stat sample_type setup
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (11 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 12/15] perf tests attr: Fix precise_ip setup Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 14/15] perf tests attr: Add optional term Jiri Olsa
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

>From following commit:
  commit 4979d0c7d0c7 ("perf stat record: Add record command")

we started to assign PERF_SAMPLE_IDENTIFIER to sample_type.

Fixing the attr stat tests accordingly.

Link: http://lkml.kernel.org/n/tip-w5bfszt3pdqk1lj7rgo4mqz5@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/base-stat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index ff9b33d4ae9e..4d0c2e42b64e 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -8,7 +8,7 @@ type=0
 size=112
 config=0
 sample_period=0
-sample_type=0
+sample_type=65536
 read_format=3
 disabled=1
 inherit=1
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 14/15] perf tests attr: Add optional term
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (12 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 13/15] perf tests attr: Fix stat sample_type setup Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-07-20  8:55   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-03 14:50 ` [PATCH 15/15] perf tests attr: Fix task term values Jiri Olsa
  2017-07-17 12:18 ` [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

Some of the stat events are quite rare to find on
common machines (like front end cycles).

Adding an 'optional' term to mark such events in attr
tests. Event marked as optional will not fail the test
case if it's not found in results.

Link: http://lkml.kernel.org/n/tip-p1l0gp8prt7zelcdjvtqtf9n@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr.py                   | 14 +++++++++++---
 tools/perf/tests/attr/test-stat-default    |  2 ++
 tools/perf/tests/attr/test-stat-detailed-1 |  2 ++
 tools/perf/tests/attr/test-stat-detailed-2 |  3 +++
 tools/perf/tests/attr/test-stat-detailed-3 |  5 +++++
 5 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index b03261c6b1ed..6bb50e82a3e3 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -105,6 +105,11 @@ class Event(dict):
                 return False
         return True
 
+    def optional(self):
+        if self.has_key('optional') and self['optional'] == '1':
+            return True
+        return False
+
     def diff(self, other):
         for t in Event.terms:
             if not self.has_key(t) or not other.has_key(t):
@@ -244,9 +249,12 @@ class Test(object):
             log.debug("    match: [%s] matches %s" % (exp_name, str(exp_list)))
 
             # we did not any matching event - fail
-            if (not exp_list):
-		exp_event.diff(res_event)
-                raise Fail(self, 'match failure');
+            if not exp_list:
+                if exp_event.optional():
+                    log.debug("    %s does not match, but is optional" % exp_name)
+                else:
+                    exp_event.diff(res_event)
+                    raise Fail(self, 'match failure');
 
             match[exp_name] = exp_list
 
diff --git a/tools/perf/tests/attr/test-stat-default b/tools/perf/tests/attr/test-stat-default
index 19270f54c96e..e911dbd4eb47 100644
--- a/tools/perf/tests/attr/test-stat-default
+++ b/tools/perf/tests/attr/test-stat-default
@@ -38,12 +38,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
diff --git a/tools/perf/tests/attr/test-stat-detailed-1 b/tools/perf/tests/attr/test-stat-detailed-1
index 51426b87153b..b39270a08e74 100644
--- a/tools/perf/tests/attr/test-stat-detailed-1
+++ b/tools/perf/tests/attr/test-stat-detailed-1
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
diff --git a/tools/perf/tests/attr/test-stat-detailed-2 b/tools/perf/tests/attr/test-stat-detailed-2
index 8de5acc31c27..45f8e6ea34f8 100644
--- a/tools/perf/tests/attr/test-stat-detailed-2
+++ b/tools/perf/tests/attr/test-stat-detailed-2
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
@@ -108,6 +110,7 @@ config=65538
 fd=15
 type=3
 config=1
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
diff --git a/tools/perf/tests/attr/test-stat-detailed-3 b/tools/perf/tests/attr/test-stat-detailed-3
index 0a1f45bf7d79..30ae0fb7a3fd 100644
--- a/tools/perf/tests/attr/test-stat-detailed-3
+++ b/tools/perf/tests/attr/test-stat-detailed-3
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
@@ -108,6 +110,7 @@ config=65538
 fd=15
 type=3
 config=1
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
@@ -162,6 +165,7 @@ config=65540
 fd=21
 type=3
 config=512
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
@@ -171,3 +175,4 @@ config=512
 fd=22
 type=3
 config=66048
+optional=1
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [PATCH 15/15] perf tests attr: Fix task term values
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (13 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 14/15] perf tests attr: Add optional term Jiri Olsa
@ 2017-07-03 14:50 ` Jiri Olsa
  2017-08-09 15:00   ` Jiri Olsa
  2017-10-03 16:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2017-07-17 12:18 ` [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
  15 siblings, 2 replies; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 14:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

The perf_event_attr::task is 1 by default for first (tracking)
event in the session. Setting task=1 as default and adding
task=0 for cases that need it.

Link: http://lkml.kernel.org/n/tip-w4uuxbwcrf8cjjjbko3ujs95@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/tests/attr/base-record                | 2 +-
 tools/perf/tests/attr/test-record-group          | 1 +
 tools/perf/tests/attr/test-record-group-sampling | 2 +-
 tools/perf/tests/attr/test-record-group1         | 1 +
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 31e0b1da830b..37940665f736 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -23,7 +23,7 @@ comm=1
 freq=1
 inherit_stat=0
 enable_on_exec=1
-task=0
+task=1
 watermark=0
 precise_ip=0|1|2|3
 mmap_data=0
diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
index 6e7961f6f7a5..618ba1c17474 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-record-group
@@ -17,5 +17,6 @@ sample_type=327
 read_format=4
 mmap=0
 comm=0
+task=0
 enable_on_exec=0
 disabled=0
diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
index ef59afd6d635..f906b793196f 100644
--- a/tools/perf/tests/attr/test-record-group-sampling
+++ b/tools/perf/tests/attr/test-record-group-sampling
@@ -23,7 +23,7 @@ sample_type=343
 
 # PERF_FORMAT_ID | PERF_FORMAT_GROUP
 read_format=12
-
+task=0
 mmap=0
 comm=0
 enable_on_exec=0
diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
index 87a222d014d8..48e8bd12fe46 100644
--- a/tools/perf/tests/attr/test-record-group1
+++ b/tools/perf/tests/attr/test-record-group1
@@ -18,5 +18,6 @@ sample_type=327
 read_format=4
 mmap=0
 comm=0
+task=0
 enable_on_exec=0
 disabled=0
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH 01/15] perf tools: Fix -n option
  2017-07-03 14:50 ` [PATCH 01/15] perf tools: Fix -n option Jiri Olsa
@ 2017-07-03 14:57   ` Arnaldo Carvalho de Melo
  2017-07-03 15:16     ` [PATCHv2 " Jiri Olsa
  0 siblings, 1 reply; 41+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-03 14:57 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

Em Mon, Jul 03, 2017 at 04:50:16PM +0200, Jiri Olsa escreveu:
> The kernel fails to add a non sampling event event
> with having precise_ip set.
> 
> Make sure the precise_ip is 0 when using -n option
> to create non sampling event in record.

Ok, but how could that happen? What was the scenario? Which command? Can
you provide a command line that causes the problem?

I ask this because perhaps we should tell the user that what its being
asked on a command line doesn't make sense instead of dropping the
precise_ip as in your patch.

- Arnaldo
 
> Link: http://lkml.kernel.org/n/tip-l513fzc1houvu7tl1bo5y65y@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/util/evsel.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 6f4882f8d61f..915fe3cd6544 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -890,8 +890,10 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
>  		attr->sample_period = 0;
>  	}
>  
> -	if (opts->no_samples)
> +	if (opts->no_samples) {
>  		attr->sample_freq = 0;
> +		attr->precise_ip = 0;
> +	}
>  
>  	if (opts->inherit_stat)
>  		attr->inherit_stat = 1;
> -- 
> 2.9.4

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCHv2 01/15] perf tools: Fix -n option
  2017-07-03 14:57   ` Arnaldo Carvalho de Melo
@ 2017-07-03 15:16     ` Jiri Olsa
  2017-07-03 16:10       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 15:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim,
	David Ahern, Thomas Richter

On Mon, Jul 03, 2017 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 03, 2017 at 04:50:16PM +0200, Jiri Olsa escreveu:
> > The kernel fails to add a non sampling event event
> > with having precise_ip set.
> > 
> > Make sure the precise_ip is 0 when using -n option
> > to create non sampling event in record.
> 
> Ok, but how could that happen? What was the scenario? Which command? Can
> you provide a command line that causes the problem?

[jolsa@krava perf]$ ./perf record -e cycles:ppp -n ls
Lowering default frequency rate to 3000.
Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu).
/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?

v2 attached, thanks
jirka


---
The kernel fails to add a non sampling event event
with having precise_ip set, like:

  $ perf record -e cycles:ppp -n ls
  Error:
  The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu).
  /bin/dmesg may provide additional information.
  No CONFIG_PERF_EVENTS=y kernel support configured?

Make sure the precise_ip is 0 when using -n option
to create non sampling event in record.

Link: http://lkml.kernel.org/n/tip-l513fzc1houvu7tl1bo5y65y@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/evsel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 6f4882f8d61f..915fe3cd6544 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -890,8 +890,10 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
 		attr->sample_period = 0;
 	}
 
-	if (opts->no_samples)
+	if (opts->no_samples) {
 		attr->sample_freq = 0;
+		attr->precise_ip = 0;
+	}
 
 	if (opts->inherit_stat)
 		attr->inherit_stat = 1;
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCHv2 01/15] perf tools: Fix -n option
  2017-07-03 15:16     ` [PATCHv2 " Jiri Olsa
@ 2017-07-03 16:10       ` Arnaldo Carvalho de Melo
  2017-07-03 16:22         ` Jiri Olsa
  0 siblings, 1 reply; 41+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-03 16:10 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim,
	David Ahern, Thomas Richter

Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 03, 2017 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jul 03, 2017 at 04:50:16PM +0200, Jiri Olsa escreveu:
> > > The kernel fails to add a non sampling event event
> > > with having precise_ip set.
> > > 
> > > Make sure the precise_ip is 0 when using -n option
> > > to create non sampling event in record.
> > 
> > Ok, but how could that happen? What was the scenario? Which command? Can
> > you provide a command line that causes the problem?
> 
> [jolsa@krava perf]$ ./perf record -e cycles:ppp -n ls
> Lowering default frequency rate to 3000.
> Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
> Error:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu).
> /bin/dmesg may provide additional information.
> No CONFIG_PERF_EVENTS=y kernel support configured?
> 
> v2 attached, thanks

Ok, so the user asks for --no-samples but at the same time asks for
precision equal to :ppp, we should stop right there and warn the user
that that is not possible, instead of silently dropping off what the
user explicitely asked.

I'm cooking a few patches to allow that, then we can apply your patch,
that, with the current set of users will never kick in :-)

- Arnaldo

> jirka
> 
> 
> ---
> The kernel fails to add a non sampling event event
> with having precise_ip set, like:
> 
>   $ perf record -e cycles:ppp -n ls
>   Error:
>   The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu).
>   /bin/dmesg may provide additional information.
>   No CONFIG_PERF_EVENTS=y kernel support configured?
> 
> Make sure the precise_ip is 0 when using -n option
> to create non sampling event in record.
> 
> Link: http://lkml.kernel.org/n/tip-l513fzc1houvu7tl1bo5y65y@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/util/evsel.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 6f4882f8d61f..915fe3cd6544 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -890,8 +890,10 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
>  		attr->sample_period = 0;
>  	}
>  
> -	if (opts->no_samples)
> +	if (opts->no_samples) {
>  		attr->sample_freq = 0;
> +		attr->precise_ip = 0;
> +	}
>  
>  	if (opts->inherit_stat)
>  		attr->inherit_stat = 1;
> -- 
> 2.9.4

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCHv2 01/15] perf tools: Fix -n option
  2017-07-03 16:10       ` Arnaldo Carvalho de Melo
@ 2017-07-03 16:22         ` Jiri Olsa
  2017-07-03 16:40           ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 16:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim,
	David Ahern, Thomas Richter

On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> > On Mon, Jul 03, 2017 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Jul 03, 2017 at 04:50:16PM +0200, Jiri Olsa escreveu:
> > > > The kernel fails to add a non sampling event event
> > > > with having precise_ip set.
> > > > 
> > > > Make sure the precise_ip is 0 when using -n option
> > > > to create non sampling event in record.
> > > 
> > > Ok, but how could that happen? What was the scenario? Which command? Can
> > > you provide a command line that causes the problem?
> > 
> > [jolsa@krava perf]$ ./perf record -e cycles:ppp -n ls
> > Lowering default frequency rate to 3000.
> > Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
> > Error:
> > The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu).
> > /bin/dmesg may provide additional information.
> > No CONFIG_PERF_EVENTS=y kernel support configured?
> > 
> > v2 attached, thanks
> 
> Ok, so the user asks for --no-samples but at the same time asks for
> precision equal to :ppp, we should stop right there and warn the user
> that that is not possible, instead of silently dropping off what the
> user explicitely asked.

well I take this option more like debug/devel one.. you have
failing command line and want to investigate the kernel state
without having samples generated under your fingers

can't see why would normal user need it

> 
> I'm cooking a few patches to allow that, then we can apply your patch,
> that, with the current set of users will never kick in :-)


ok

jirka

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCHv2 01/15] perf tools: Fix -n option
  2017-07-03 16:22         ` Jiri Olsa
@ 2017-07-03 16:40           ` Arnaldo Carvalho de Melo
  2017-07-03 16:58             ` Jiri Olsa
  0 siblings, 1 reply; 41+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-03 16:40 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim,
	David Ahern, Thomas Richter

Em Mon, Jul 03, 2017 at 06:22:28PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> > > On Mon, Jul 03, 2017 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> > > > Em Mon, Jul 03, 2017 at 04:50:16PM +0200, Jiri Olsa escreveu:
> > > > > The kernel fails to add a non sampling event event
> > > > > with having precise_ip set.
> > > > > 
> > > > > Make sure the precise_ip is 0 when using -n option
> > > > > to create non sampling event in record.
> > > > 
> > > > Ok, but how could that happen? What was the scenario? Which command? Can
> > > > you provide a command line that causes the problem?
> > > 
> > > [jolsa@krava perf]$ ./perf record -e cycles:ppp -n ls
> > > Lowering default frequency rate to 3000.
> > > Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
> > > Error:
> > > The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu).
> > > /bin/dmesg may provide additional information.
> > > No CONFIG_PERF_EVENTS=y kernel support configured?
> > > 
> > > v2 attached, thanks
> > 
> > Ok, so the user asks for --no-samples but at the same time asks for
> > precision equal to :ppp, we should stop right there and warn the user
> > that that is not possible, instead of silently dropping off what the
> > user explicitely asked.
> 
> well I take this option more like debug/devel one.. you have
> failing command line and want to investigate the kernel state
> without having samples generated under your fingers
> 
> can't see why would normal user need it
> 
> > 
> > I'm cooking a few patches to allow that, then we can apply your patch,
> > that, with the current set of users will never kick in :-)

Take a look at:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=9f6e7e8bbb99feb6d721be7ccefb8c9139fa5abb

and:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=f9a4297945a99b47f92b111b5b1802a3b295a1a7

Its in my perf/core branch now.

- Arnaldo

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCHv2 01/15] perf tools: Fix -n option
  2017-07-03 16:40           ` Arnaldo Carvalho de Melo
@ 2017-07-03 16:58             ` Jiri Olsa
  2017-07-03 17:44               ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-03 16:58 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim,
	David Ahern, Thomas Richter

On Mon, Jul 03, 2017 at 01:40:01PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 03, 2017 at 06:22:28PM +0200, Jiri Olsa escreveu:
> > On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> > > > On Mon, Jul 03, 2017 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > Em Mon, Jul 03, 2017 at 04:50:16PM +0200, Jiri Olsa escreveu:
> > > > > > The kernel fails to add a non sampling event event
> > > > > > with having precise_ip set.
> > > > > > 
> > > > > > Make sure the precise_ip is 0 when using -n option
> > > > > > to create non sampling event in record.
> > > > > 
> > > > > Ok, but how could that happen? What was the scenario? Which command? Can
> > > > > you provide a command line that causes the problem?
> > > > 
> > > > [jolsa@krava perf]$ ./perf record -e cycles:ppp -n ls
> > > > Lowering default frequency rate to 3000.
> > > > Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
> > > > Error:
> > > > The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu).
> > > > /bin/dmesg may provide additional information.
> > > > No CONFIG_PERF_EVENTS=y kernel support configured?
> > > > 
> > > > v2 attached, thanks
> > > 
> > > Ok, so the user asks for --no-samples but at the same time asks for
> > > precision equal to :ppp, we should stop right there and warn the user
> > > that that is not possible, instead of silently dropping off what the
> > > user explicitely asked.
> > 
> > well I take this option more like debug/devel one.. you have
> > failing command line and want to investigate the kernel state
> > without having samples generated under your fingers
> > 
> > can't see why would normal user need it
> > 
> > > 
> > > I'm cooking a few patches to allow that, then we can apply your patch,
> > > that, with the current set of users will never kick in :-)
> 
> Take a look at:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=9f6e7e8bbb99feb6d721be7ccefb8c9139fa5abb
> 
> and:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=f9a4297945a99b47f92b111b5b1802a3b295a1a7
> 
> Its in my perf/core branch now.

I think I'd just go for simple warning once we detect -n and :p
but if you think error is necessary I'll live ;-)

jirka

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCHv2 01/15] perf tools: Fix -n option
  2017-07-03 16:58             ` Jiri Olsa
@ 2017-07-03 17:44               ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 41+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-03 17:44 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim,
	David Ahern, Thomas Richter

Em Mon, Jul 03, 2017 at 06:58:38PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 03, 2017 at 01:40:01PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jul 03, 2017 at 06:22:28PM +0200, Jiri Olsa escreveu:
> > > On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > Ok, so the user asks for --no-samples but at the same time asks for
> > > > precision equal to :ppp, we should stop right there and warn the user
> > > > that that is not possible, instead of silently dropping off what the
> > > > user explicitely asked.

> > > well I take this option more like debug/devel one.. you have
> > > failing command line and want to investigate the kernel state
> > > without having samples generated under your fingers

> > > can't see why would normal user need it

> > > > I'm cooking a few patches to allow that, then we can apply your patch,
> > > > that, with the current set of users will never kick in :-)

> > Take a look at:

> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=9f6e7e8bbb99feb6d721be7ccefb8c9139fa5abb

> > and:

> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=f9a4297945a99b47f92b111b5b1802a3b295a1a7

> > Its in my perf/core branch now.

> I think I'd just go for simple warning once we detect -n and :p
> but if you think error is necessary I'll live ;-)

Ok, so you don't find any error in my patches, good :-)

I don't like options that are developer-only-that-knows-what-is-doing,
nor things that get chopped up behind your feet, so I think the way I
did covers your case and provides meaningful error messages when an
invalid combination of options is used.

- Arnaldo

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] perf tools: Fix attr tests
  2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
                   ` (14 preceding siblings ...)
  2017-07-03 14:50 ` [PATCH 15/15] perf tests attr: Fix task term values Jiri Olsa
@ 2017-07-17 12:18 ` Jiri Olsa
  2017-07-17 12:51   ` Arnaldo Carvalho de Melo
  15 siblings, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-07-17 12:18 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, lkml, Ingo Molnar, Peter Zijlstra,
	Namhyung Kim, David Ahern, Thomas Richter

On Mon, Jul 03, 2017 at 04:50:15PM +0200, Jiri Olsa wrote:
> hi,
> attr tests have been broken for some time now. Updating
> the data files plus some other processing fixes.
> 
> It's also available in here:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
>   perf/attr_test

hi,
just noticed that this got removed from your branch.. anything wrong with that?

thanks,
jirka

> 
> thanks,
> jirka
> ---
>  tools/perf/perf.h                                                        |  1 +
>  tools/perf/tests/attr.c                                                  | 12 +++++++++++-
>  tools/perf/tests/attr.py                                                 | 50 +++++++++++++++++++++++++++++---------------------
>  tools/perf/tests/attr/base-record                                        |  8 ++++----
>  tools/perf/tests/attr/base-stat                                          |  4 ++--
>  tools/perf/tests/attr/test-record-C0                                     |  1 +
>  tools/perf/tests/attr/test-record-basic                                  |  1 +
>  tools/perf/tests/attr/test-record-branch-any                             |  2 +-
>  tools/perf/tests/attr/test-record-branch-filter-any                      |  2 +-
>  tools/perf/tests/attr/test-record-branch-filter-any_call                 |  2 +-
>  tools/perf/tests/attr/test-record-branch-filter-any_ret                  |  2 +-
>  tools/perf/tests/attr/test-record-branch-filter-hv                       |  2 +-
>  tools/perf/tests/attr/test-record-branch-filter-ind_call                 |  2 +-
>  tools/perf/tests/attr/test-record-branch-filter-k                        |  2 +-
>  tools/perf/tests/attr/test-record-branch-filter-u                        |  2 +-
>  tools/perf/tests/attr/test-record-count                                  |  1 +
>  tools/perf/tests/attr/test-record-data                                   |  3 +--
>  tools/perf/tests/attr/test-record-freq                                   |  1 +
>  tools/perf/tests/attr/test-record-graph-default                          |  1 +
>  tools/perf/tests/attr/test-record-graph-dwarf                            |  4 +++-
>  tools/perf/tests/attr/test-record-graph-fp                               |  1 +
>  tools/perf/tests/attr/test-record-group                                  |  2 ++
>  tools/perf/tests/attr/test-record-group-sampling                         |  3 ++-
>  tools/perf/tests/attr/test-record-group1                                 |  2 ++
>  tools/perf/tests/attr/{test-record-no-delay => test-record-no-buffering} |  4 ++--
>  tools/perf/tests/attr/test-record-no-inherit                             |  1 +
>  tools/perf/tests/attr/test-record-no-samples                             |  1 +
>  tools/perf/tests/attr/test-record-period                                 |  1 +
>  tools/perf/tests/attr/test-record-raw                                    |  2 +-
>  tools/perf/tests/attr/test-stat-C0                                       |  4 ++--
>  tools/perf/tests/attr/test-stat-default                                  |  2 ++
>  tools/perf/tests/attr/test-stat-detailed-1                               |  2 ++
>  tools/perf/tests/attr/test-stat-detailed-2                               |  3 +++
>  tools/perf/tests/attr/test-stat-detailed-3                               |  5 +++++
>  tools/perf/util/evsel.c                                                  |  8 +++++++-
>  35 files changed, 98 insertions(+), 46 deletions(-)

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] perf tools: Fix attr tests
  2017-07-17 12:18 ` [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
@ 2017-07-17 12:51   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 41+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-07-17 12:51 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim,
	David Ahern, Thomas Richter

Em Mon, Jul 17, 2017 at 02:18:14PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 03, 2017 at 04:50:15PM +0200, Jiri Olsa wrote:
> > hi,
> > attr tests have been broken for some time now. Updating
> > the data files plus some other processing fixes.
> > 
> > It's also available in here:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> >   perf/attr_test
> 
> hi,
> just noticed that this got removed from your branch.. anything wrong with that?

Something st00pid on my part, I'll get it remerged, sorry.

- Arnaldo
 
> thanks,
> jirka
> 
> > 
> > thanks,
> > jirka
> > ---
> >  tools/perf/perf.h                                                        |  1 +
> >  tools/perf/tests/attr.c                                                  | 12 +++++++++++-
> >  tools/perf/tests/attr.py                                                 | 50 +++++++++++++++++++++++++++++---------------------
> >  tools/perf/tests/attr/base-record                                        |  8 ++++----
> >  tools/perf/tests/attr/base-stat                                          |  4 ++--
> >  tools/perf/tests/attr/test-record-C0                                     |  1 +
> >  tools/perf/tests/attr/test-record-basic                                  |  1 +
> >  tools/perf/tests/attr/test-record-branch-any                             |  2 +-
> >  tools/perf/tests/attr/test-record-branch-filter-any                      |  2 +-
> >  tools/perf/tests/attr/test-record-branch-filter-any_call                 |  2 +-
> >  tools/perf/tests/attr/test-record-branch-filter-any_ret                  |  2 +-
> >  tools/perf/tests/attr/test-record-branch-filter-hv                       |  2 +-
> >  tools/perf/tests/attr/test-record-branch-filter-ind_call                 |  2 +-
> >  tools/perf/tests/attr/test-record-branch-filter-k                        |  2 +-
> >  tools/perf/tests/attr/test-record-branch-filter-u                        |  2 +-
> >  tools/perf/tests/attr/test-record-count                                  |  1 +
> >  tools/perf/tests/attr/test-record-data                                   |  3 +--
> >  tools/perf/tests/attr/test-record-freq                                   |  1 +
> >  tools/perf/tests/attr/test-record-graph-default                          |  1 +
> >  tools/perf/tests/attr/test-record-graph-dwarf                            |  4 +++-
> >  tools/perf/tests/attr/test-record-graph-fp                               |  1 +
> >  tools/perf/tests/attr/test-record-group                                  |  2 ++
> >  tools/perf/tests/attr/test-record-group-sampling                         |  3 ++-
> >  tools/perf/tests/attr/test-record-group1                                 |  2 ++
> >  tools/perf/tests/attr/{test-record-no-delay => test-record-no-buffering} |  4 ++--
> >  tools/perf/tests/attr/test-record-no-inherit                             |  1 +
> >  tools/perf/tests/attr/test-record-no-samples                             |  1 +
> >  tools/perf/tests/attr/test-record-period                                 |  1 +
> >  tools/perf/tests/attr/test-record-raw                                    |  2 +-
> >  tools/perf/tests/attr/test-stat-C0                                       |  4 ++--
> >  tools/perf/tests/attr/test-stat-default                                  |  2 ++
> >  tools/perf/tests/attr/test-stat-detailed-1                               |  2 ++
> >  tools/perf/tests/attr/test-stat-detailed-2                               |  3 +++
> >  tools/perf/tests/attr/test-stat-detailed-3                               |  5 +++++
> >  tools/perf/util/evsel.c                                                  |  8 +++++++-
> >  35 files changed, 98 insertions(+), 46 deletions(-)

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Do not store failed events
  2017-07-03 14:50 ` [PATCH 02/15] perf tests attr: Do not store failed events Jiri Olsa
@ 2017-07-20  8:51   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: namhyung, dsahern, tglx, jolsa, linux-kernel, hpa, acme,
	a.p.zijlstra, tmricht, mingo

Commit-ID:  d78ada4a767a744cad5efa210b8acf57748b91d7
Gitweb:     http://git.kernel.org/tip/d78ada4a767a744cad5efa210b8acf57748b91d7
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:17 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:14 -0300

perf tests attr: Do not store failed events

Do not mess up our temp space with files we don't
need - failed event open attempts.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 0e77b2c..08b1d5c 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -136,7 +136,7 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 {
 	int errno_saved = errno;
 
-	if (store_event(attr, pid, cpu, fd, group_fd, flags)) {
+	if ((fd != -1) && store_event(attr, pid, cpu, fd, group_fd, flags)) {
 		pr_err("test attr FAILED");
 		exit(128);
 	}

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Add test_attr__ready function
  2017-07-03 14:50 ` [PATCH 03/15] perf tests attr: Add test_attr__ready function Jiri Olsa
@ 2017-07-20  8:51   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, mingo, linux-kernel, tglx, jolsa, a.p.zijlstra, namhyung,
	dsahern, hpa, tmricht

Commit-ID:  10213e2ff2e0453324689eb50e73df3df1ee6163
Gitweb:     http://git.kernel.org/tip/10213e2ff2e0453324689eb50e73df3df1ee6163
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:18 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:15 -0300

perf tests attr: Add test_attr__ready function

We create many test events before the real ones just to test specific
features. But there's no way for attr tests to separate those test
events from those it needs to check.

Adding 'ready' call from the events open interface to trigger/start
events collection for attr test.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf.h       |  1 +
 tools/perf/tests/attr.c | 10 ++++++++++
 tools/perf/util/evsel.c |  4 ++++
 3 files changed, 15 insertions(+)

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 806c216..2c010dd 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -7,6 +7,7 @@
 #include <linux/perf_event.h>
 
 extern bool test_attr__enabled;
+void test_attr__ready(void);
 void test_attr__init(void);
 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 		     int fd, int group_fd, unsigned long flags);
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 08b1d5c..84c0eb5 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -36,6 +36,7 @@
 #define ENV "PERF_TEST_ATTR"
 
 static char *dir;
+static bool ready;
 
 void test_attr__init(void)
 {
@@ -67,6 +68,9 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
 	FILE *file;
 	char path[PATH_MAX];
 
+	if (!ready)
+		return 0;
+
 	snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
 		 attr->type, attr->config, fd);
 
@@ -144,6 +148,12 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 	errno = errno_saved;
 }
 
+void test_attr__ready(void)
+{
+	if (unlikely(test_attr__enabled) && !ready)
+		ready = true;
+}
+
 static int run_dir(const char *d, const char *perf)
 {
 	char v[] = "-vvvvv";
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index df567e4..6dd069a 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -58,6 +58,8 @@ static int perf_evsel__no_extra_init(struct perf_evsel *evsel __maybe_unused)
 	return 0;
 }
 
+void __weak test_attr__ready(void) { }
+
 static void perf_evsel__no_extra_fini(struct perf_evsel *evsel __maybe_unused)
 {
 }
@@ -1572,6 +1574,8 @@ retry_open:
 			pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 				  pid, cpus->map[cpu], group_fd, flags);
 
+			test_attr__ready();
+
 			fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu],
 						 group_fd, flags);
 

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Make compare_data global
  2017-07-03 14:50 ` [PATCH 04/15] perf tests attr: Make compare_data global Jiri Olsa
@ 2017-07-20  8:51   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, dsahern, hpa, tglx, a.p.zijlstra, tmricht, namhyung,
	mingo, linux-kernel, acme

Commit-ID:  04c31bcf86c4fa51022ec254827f1c7c41306167
Gitweb:     http://git.kernel.org/tip/04c31bcf86c4fa51022ec254827f1c7c41306167
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:19 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:16 -0300

perf tests attr: Make compare_data global

Making compare_data global, so it could be used outside
the Test class scope to compare command results.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr.py | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index cdf21a9..bb671cd 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -9,6 +9,20 @@ import logging
 import shutil
 import ConfigParser
 
+def compare_data(a, b):
+    # Allow multiple values in assignment separated by '|'
+    a_list = a.split('|')
+    b_list = b.split('|')
+
+    for a_item in a_list:
+        for b_item in b_list:
+            if (a_item == b_item):
+                return True
+            elif (a_item == '*') or (b_item == '*'):
+                return True
+
+    return False
+
 class Fail(Exception):
     def __init__(self, test, msg):
         self.msg = msg
@@ -82,26 +96,12 @@ class Event(dict):
         self.add(base)
         self.add(data)
 
-    def compare_data(self, a, b):
-        # Allow multiple values in assignment separated by '|'
-        a_list = a.split('|')
-        b_list = b.split('|')
-
-        for a_item in a_list:
-            for b_item in b_list:
-                if (a_item == b_item):
-                    return True
-                elif (a_item == '*') or (b_item == '*'):
-                    return True
-
-        return False
-
     def equal(self, other):
         for t in Event.terms:
             log.debug("      [%s] %s %s" % (t, self[t], other[t]));
             if not self.has_key(t) or not other.has_key(t):
                 return False
-            if not self.compare_data(self[t], other[t]):
+            if not compare_data(self[t], other[t]):
                 return False
         return True
 
@@ -109,7 +109,7 @@ class Event(dict):
         for t in Event.terms:
             if not self.has_key(t) or not other.has_key(t):
                 continue
-            if not self.compare_data(self[t], other[t]):
+            if not compare_data(self[t], other[t]):
 		log.warning("expected %s=%s, got %s" % (t, self[t], other[t]))
 
 # Test file description needs to have following sections:
@@ -218,9 +218,9 @@ class Test(object):
               self.perf, self.command, tempdir, self.args)
         ret = os.WEXITSTATUS(os.system(cmd))
 
-        log.info("  '%s' ret %d " % (cmd, ret))
+        log.info("  '%s' ret '%s', expected '%s'" % (cmd, str(ret), str(self.ret)))
 
-        if ret != int(self.ret):
+        if not compare_data(str(ret), str(self.ret)):
             raise Unsup(self)
 
     def compare(self, expect, result):

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Rename compare_data to data_equal
  2017-07-03 14:50 ` [PATCH 05/15] perf tests attr: Rename compare_data to data_equal Jiri Olsa
@ 2017-07-20  8:52   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, jolsa, tmricht, mingo, acme, namhyung, linux-kernel, tglx,
	a.p.zijlstra, dsahern

Commit-ID:  dde622a5063c71a1864a41dfaed4baaabfa84ba6
Gitweb:     http://git.kernel.org/tip/dde622a5063c71a1864a41dfaed4baaabfa84ba6
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:20 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:16 -0300

perf tests attr: Rename compare_data to data_equal

The data_equal name fits better to the return value of the function.
It's true when the data is equal.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index bb671cd..b03261c 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -9,7 +9,7 @@ import logging
 import shutil
 import ConfigParser
 
-def compare_data(a, b):
+def data_equal(a, b):
     # Allow multiple values in assignment separated by '|'
     a_list = a.split('|')
     b_list = b.split('|')
@@ -101,7 +101,7 @@ class Event(dict):
             log.debug("      [%s] %s %s" % (t, self[t], other[t]));
             if not self.has_key(t) or not other.has_key(t):
                 return False
-            if not compare_data(self[t], other[t]):
+            if not data_equal(self[t], other[t]):
                 return False
         return True
 
@@ -109,7 +109,7 @@ class Event(dict):
         for t in Event.terms:
             if not self.has_key(t) or not other.has_key(t):
                 continue
-            if not compare_data(self[t], other[t]):
+            if not data_equal(self[t], other[t]):
 		log.warning("expected %s=%s, got %s" % (t, self[t], other[t]))
 
 # Test file description needs to have following sections:
@@ -220,7 +220,7 @@ class Test(object):
 
         log.info("  '%s' ret '%s', expected '%s'" % (cmd, str(ret), str(self.ret)))
 
-        if not compare_data(str(ret), str(self.ret)):
+        if not data_equal(str(ret), str(self.ret)):
             raise Unsup(self)
 
     def compare(self, expect, result):

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Add 1s for exclude_kernel and task base bits
  2017-07-03 14:50 ` [PATCH 06/15] perf tests attr: Add 1s for exclude_kernel and task base bits Jiri Olsa
@ 2017-07-20  8:52   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, jolsa, namhyung, a.p.zijlstra, tmricht, acme,
	tglx, mingo, dsahern

Commit-ID:  5ced95b2374b0fb3c1d0367c6e8cf82d41292990
Gitweb:     http://git.kernel.org/tip/5ced95b2374b0fb3c1d0367c6e8cf82d41292990
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:21 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:17 -0300

perf tests attr: Add 1s for exclude_kernel and task base bits

There's an event open fallback which set exclude_kernel=1 in case use
does not have enough privileges. Adding both 0|1 for this attribute,
because we don't know what value it is.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-7-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/base-record | 2 +-
 tools/perf/tests/attr/base-stat   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 7e6d749..cdf3adf7 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -15,7 +15,7 @@ inherit=1
 pinned=0
 exclusive=0
 exclude_user=0
-exclude_kernel=0
+exclude_kernel=0|1
 exclude_hv=0
 exclude_idle=0
 mmap=1
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index f4cf148..ff9b33d 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -15,7 +15,7 @@ inherit=1
 pinned=0
 exclusive=0
 exclude_user=0
-exclude_kernel=0
+exclude_kernel=0|1
 exclude_hv=0
 exclude_idle=0
 mmap=0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Fix record dwarf test
  2017-07-03 14:50 ` [PATCH 07/15] perf tests attr: Fix record dwarf test Jiri Olsa
@ 2017-07-20  8:52   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dsahern, namhyung, jolsa, tglx, hpa, tmricht,
	mingo, acme, a.p.zijlstra

Commit-ID:  d9115e924088b714bb801713751bf7922d799f95
Gitweb:     http://git.kernel.org/tip/d9115e924088b714bb801713751bf7922d799f95
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:22 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:18 -0300

perf tests attr: Fix record dwarf test

Following commit:

  commit 5c0cf22477ea ("perf record: Store data mmaps for dwarf unwind")

have enabled address sampling for dwarf unwind, we need to reflect that
in this test by adding ADDR sample_type and enabling mmap_data.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-8-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/test-record-graph-dwarf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/test-record-graph-dwarf b/tools/perf/tests/attr/test-record-graph-dwarf
index d6f324e..8321c60 100644
--- a/tools/perf/tests/attr/test-record-graph-dwarf
+++ b/tools/perf/tests/attr/test-record-graph-dwarf
@@ -3,8 +3,9 @@ command = record
 args    = --call-graph dwarf -- kill >/dev/null 2>&1
 
 [event:base-record]
-sample_type=12583
+sample_type=45359
 exclude_callchain_user=1
 sample_stack_user=8192
 # TODO different for each arch, no support for that now
 sample_regs_user=*
+mmap_data=1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Fix no-delay test
  2017-07-03 14:50 ` [PATCH 08/15] perf tests attr: Fix no-delay test Jiri Olsa
@ 2017-07-20  8:53   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: dsahern, mingo, linux-kernel, jolsa, acme, tglx, hpa, namhyung,
	tmricht, a.p.zijlstra

Commit-ID:  44fed277f81ba22e3f2fbcf1501c3b14aeb9f8e4
Gitweb:     http://git.kernel.org/tip/44fed277f81ba22e3f2fbcf1501c3b14aeb9f8e4
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:23 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:18 -0300

perf tests attr: Fix no-delay test

Following commit:
  commit 509051ea8427 ("perf record: Rename --no-delay to --no-buffering")

removed '-D' option and renamed --no-delay into --no-buffering.
Fixing that in the attr tests.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Fixes: 509051ea8427 ("perf record: Rename --no-delay to --no-buffering")
Link: http://lkml.kernel.org/r/20170703145030.12903-9-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../perf/tests/attr/{test-record-no-delay => test-record-no-buffering}  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/test-record-no-delay b/tools/perf/tests/attr/test-record-no-buffering
similarity index 70%
rename from tools/perf/tests/attr/test-record-no-delay
rename to tools/perf/tests/attr/test-record-no-buffering
index f253b78..0b0355a 100644
--- a/tools/perf/tests/attr/test-record-no-delay
+++ b/tools/perf/tests/attr/test-record-no-buffering
@@ -1,6 +1,6 @@
 [config]
 command = record
-args    = -D kill >/dev/null 2>&1
+args    = --no-buffering kill >/dev/null 2>&1
 
 [event:base-record]
 sample_period=4000

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Add proper return values
  2017-07-03 14:50 ` [PATCH 09/15] perf tests attr: Add proper return values Jiri Olsa
@ 2017-07-20  8:53   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, a.p.zijlstra, mingo, dsahern, tglx, tmricht, hpa,
	namhyung, linux-kernel, acme

Commit-ID:  a72fe0afa18abd8d05d26944b32850775cb6c941
Gitweb:     http://git.kernel.org/tip/a72fe0afa18abd8d05d26944b32850775cb6c941
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:24 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:19 -0300

perf tests attr: Add proper return values

The record command now properly returns the status of the tracee if
there's any. We need to properly set the expected return value of the
tracee in the attr tests.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-10-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/test-record-C0                     | 1 +
 tools/perf/tests/attr/test-record-basic                  | 1 +
 tools/perf/tests/attr/test-record-branch-any             | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any      | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any_call | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any_ret  | 1 +
 tools/perf/tests/attr/test-record-branch-filter-hv       | 1 +
 tools/perf/tests/attr/test-record-branch-filter-ind_call | 1 +
 tools/perf/tests/attr/test-record-branch-filter-k        | 1 +
 tools/perf/tests/attr/test-record-branch-filter-u        | 1 +
 tools/perf/tests/attr/test-record-count                  | 1 +
 tools/perf/tests/attr/test-record-data                   | 1 +
 tools/perf/tests/attr/test-record-freq                   | 1 +
 tools/perf/tests/attr/test-record-graph-default          | 1 +
 tools/perf/tests/attr/test-record-graph-dwarf            | 1 +
 tools/perf/tests/attr/test-record-graph-fp               | 1 +
 tools/perf/tests/attr/test-record-group                  | 1 +
 tools/perf/tests/attr/test-record-group-sampling         | 1 +
 tools/perf/tests/attr/test-record-group1                 | 1 +
 tools/perf/tests/attr/test-record-no-buffering           | 1 +
 tools/perf/tests/attr/test-record-no-inherit             | 1 +
 tools/perf/tests/attr/test-record-no-samples             | 1 +
 tools/perf/tests/attr/test-record-period                 | 1 +
 tools/perf/tests/attr/test-record-raw                    | 1 +
 24 files changed, 24 insertions(+)

diff --git a/tools/perf/tests/attr/test-record-C0 b/tools/perf/tests/attr/test-record-C0
index d6a7e43..cb0a313 100644
--- a/tools/perf/tests/attr/test-record-C0
+++ b/tools/perf/tests/attr/test-record-C0
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -C 0 kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 cpu=0
diff --git a/tools/perf/tests/attr/test-record-basic b/tools/perf/tests/attr/test-record-basic
index 55c0428..85a23cf 100644
--- a/tools/perf/tests/attr/test-record-basic
+++ b/tools/perf/tests/attr/test-record-basic
@@ -1,5 +1,6 @@
 [config]
 command = record
 args    = kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
diff --git a/tools/perf/tests/attr/test-record-branch-any b/tools/perf/tests/attr/test-record-branch-any
index 1421960..a2fe031 100644
--- a/tools/perf/tests/attr/test-record-branch-any
+++ b/tools/perf/tests/attr/test-record-branch-any
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -b kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any b/tools/perf/tests/attr/test-record-branch-filter-any
index 915c4df..7df6a48 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any
+++ b/tools/perf/tests/attr/test-record-branch-filter-any
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j any kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_call b/tools/perf/tests/attr/test-record-branch-filter-any_call
index 8708dbd..6c93e07 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_call
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j any_call kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_ret b/tools/perf/tests/attr/test-record-branch-filter-any_ret
index 0d3607a..daf8b83 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_ret
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_ret
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j any_ret kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-hv b/tools/perf/tests/attr/test-record-branch-filter-hv
index f255267..fbf491d 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-hv
+++ b/tools/perf/tests/attr/test-record-branch-filter-hv
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j hv kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-ind_call b/tools/perf/tests/attr/test-record-branch-filter-ind_call
index e862dd1..c63cc50 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-ind_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-ind_call
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j ind_call kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-k b/tools/perf/tests/attr/test-record-branch-filter-k
index 182971e..e0f2f09 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-k
+++ b/tools/perf/tests/attr/test-record-branch-filter-k
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j k kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-branch-filter-u b/tools/perf/tests/attr/test-record-branch-filter-u
index 83449ef..6cd36e0 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-u
+++ b/tools/perf/tests/attr/test-record-branch-filter-u
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -j u kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-count b/tools/perf/tests/attr/test-record-count
index 2f841de..34f6cc5 100644
--- a/tools/perf/tests/attr/test-record-count
+++ b/tools/perf/tests/attr/test-record-count
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -c 123 kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=123
diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-data
index 716e143..53c8890 100644
--- a/tools/perf/tests/attr/test-record-data
+++ b/tools/perf/tests/attr/test-record-data
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -d kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-freq b/tools/perf/tests/attr/test-record-freq
index 600d0f8..bf4cb45 100644
--- a/tools/perf/tests/attr/test-record-freq
+++ b/tools/perf/tests/attr/test-record-freq
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -F 100 kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=100
diff --git a/tools/perf/tests/attr/test-record-graph-default b/tools/perf/tests/attr/test-record-graph-default
index 853597a..0b216e6 100644
--- a/tools/perf/tests/attr/test-record-graph-default
+++ b/tools/perf/tests/attr/test-record-graph-default
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -g kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=295
diff --git a/tools/perf/tests/attr/test-record-graph-dwarf b/tools/perf/tests/attr/test-record-graph-dwarf
index 8321c60..da2fa73 100644
--- a/tools/perf/tests/attr/test-record-graph-dwarf
+++ b/tools/perf/tests/attr/test-record-graph-dwarf
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --call-graph dwarf -- kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=45359
diff --git a/tools/perf/tests/attr/test-record-graph-fp b/tools/perf/tests/attr/test-record-graph-fp
index 055e3be..625d190 100644
--- a/tools/perf/tests/attr/test-record-graph-fp
+++ b/tools/perf/tests/attr/test-record-graph-fp
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --call-graph fp kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=295
diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
index 57739ca..6e7961f 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-record-group
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --group -e cycles,instructions kill >/dev/null 2>&1
+ret     = 1
 
 [event-1:base-record]
 fd=1
diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
index 658f5d6..ef59afd 100644
--- a/tools/perf/tests/attr/test-record-group-sampling
+++ b/tools/perf/tests/attr/test-record-group-sampling
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -e '{cycles,cache-misses}:S' kill >/dev/null 2>&1
+ret     = 1
 
 [event-1:base-record]
 fd=1
diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
index c5548d0..87a222d 100644
--- a/tools/perf/tests/attr/test-record-group1
+++ b/tools/perf/tests/attr/test-record-group1
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -e '{cycles,instructions}' kill >/dev/null 2>&1
+ret     = 1
 
 [event-1:base-record]
 fd=1
diff --git a/tools/perf/tests/attr/test-record-no-buffering b/tools/perf/tests/attr/test-record-no-buffering
index 0b0355a..5bf349a 100644
--- a/tools/perf/tests/attr/test-record-no-buffering
+++ b/tools/perf/tests/attr/test-record-no-buffering
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = --no-buffering kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000
diff --git a/tools/perf/tests/attr/test-record-no-inherit b/tools/perf/tests/attr/test-record-no-inherit
index 44edcb2..560943d 100644
--- a/tools/perf/tests/attr/test-record-no-inherit
+++ b/tools/perf/tests/attr/test-record-no-inherit
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -i kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_type=263
diff --git a/tools/perf/tests/attr/test-record-no-samples b/tools/perf/tests/attr/test-record-no-samples
index d0141b2..8eb73ab 100644
--- a/tools/perf/tests/attr/test-record-no-samples
+++ b/tools/perf/tests/attr/test-record-no-samples
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -n kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=0
diff --git a/tools/perf/tests/attr/test-record-period b/tools/perf/tests/attr/test-record-period
index 8abc531..69bc748 100644
--- a/tools/perf/tests/attr/test-record-period
+++ b/tools/perf/tests/attr/test-record-period
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -c 100 -P kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=100
diff --git a/tools/perf/tests/attr/test-record-raw b/tools/perf/tests/attr/test-record-raw
index 4a8ef25..3b89f99 100644
--- a/tools/perf/tests/attr/test-record-raw
+++ b/tools/perf/tests/attr/test-record-raw
@@ -1,6 +1,7 @@
 [config]
 command = record
 args    = -R kill >/dev/null 2>&1
+ret     = 1
 
 [event:base-record]
 sample_period=4000

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Fix cpu test disabled term setup
  2017-07-03 14:50 ` [PATCH 10/15] perf tests attr: Fix cpu test disabled term setup Jiri Olsa
@ 2017-07-20  8:53   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, acme, mingo, hpa, namhyung, jolsa, dsahern, tmricht,
	a.p.zijlstra, linux-kernel

Commit-ID:  6f193400eaf1de53145cc13ff69f88336e9a9c9a
Gitweb:     http://git.kernel.org/tip/6f193400eaf1de53145cc13ff69f88336e9a9c9a
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:25 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:19 -0300

perf tests attr: Fix cpu test disabled term setup

The stat command creates all events disabled and enables them either
manualy or via the enable_on_exec bit.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-11-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/test-stat-C0 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/attr/test-stat-C0 b/tools/perf/tests/attr/test-stat-C0
index aa83595..67717fe 100644
--- a/tools/perf/tests/attr/test-stat-C0
+++ b/tools/perf/tests/attr/test-stat-C0
@@ -4,6 +4,6 @@ args    = -e cycles -C 0 kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-stat]
-# events are enabled by default when attached to cpu
-disabled=0
+# events are disabled by default when attached to cpu
+disabled=1
 enable_on_exec=0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Fix sample_period setup
  2017-07-03 14:50 ` [PATCH 11/15] perf tests attr: Fix sample_period setup Jiri Olsa
@ 2017-07-20  8:54   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: a.p.zijlstra, tmricht, linux-kernel, jolsa, hpa, mingo, acme,
	tglx, dsahern, namhyung

Commit-ID:  5ff0cf421c37f53bb658a097c610cc1e3ced1133
Gitweb:     http://git.kernel.org/tip/5ff0cf421c37f53bb658a097c610cc1e3ced1133
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:26 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:20 -0300

perf tests attr: Fix sample_period setup

The final period can differ from what user specifies on command line due
to the perf_event_max_sample_rate sysctl setup.

Thus we can't predixt the sample_period value any more.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-12-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/base-record                        | 2 +-
 tools/perf/tests/attr/test-record-branch-any             | 1 -
 tools/perf/tests/attr/test-record-branch-filter-any      | 1 -
 tools/perf/tests/attr/test-record-branch-filter-any_call | 1 -
 tools/perf/tests/attr/test-record-branch-filter-any_ret  | 1 -
 tools/perf/tests/attr/test-record-branch-filter-hv       | 1 -
 tools/perf/tests/attr/test-record-branch-filter-ind_call | 1 -
 tools/perf/tests/attr/test-record-branch-filter-k        | 1 -
 tools/perf/tests/attr/test-record-branch-filter-u        | 1 -
 tools/perf/tests/attr/test-record-data                   | 2 --
 tools/perf/tests/attr/test-record-no-buffering           | 1 -
 tools/perf/tests/attr/test-record-raw                    | 1 -
 12 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index cdf3adf7..a9cb72b 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -7,7 +7,7 @@ cpu=*
 type=0|1
 size=112
 config=0
-sample_period=4000
+sample_period=*
 sample_type=263
 read_format=0
 disabled=1
diff --git a/tools/perf/tests/attr/test-record-branch-any b/tools/perf/tests/attr/test-record-branch-any
index a2fe031..81f839e 100644
--- a/tools/perf/tests/attr/test-record-branch-any
+++ b/tools/perf/tests/attr/test-record-branch-any
@@ -4,6 +4,5 @@ args    = -b kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any b/tools/perf/tests/attr/test-record-branch-filter-any
index 7df6a48..357421f 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any
+++ b/tools/perf/tests/attr/test-record-branch-filter-any
@@ -4,6 +4,5 @@ args    = -j any kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_call b/tools/perf/tests/attr/test-record-branch-filter-any_call
index 6c93e07..dbc55f2 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_call
@@ -4,6 +4,5 @@ args    = -j any_call kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=16
diff --git a/tools/perf/tests/attr/test-record-branch-filter-any_ret b/tools/perf/tests/attr/test-record-branch-filter-any_ret
index daf8b83..a0824ff 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-any_ret
+++ b/tools/perf/tests/attr/test-record-branch-filter-any_ret
@@ -4,6 +4,5 @@ args    = -j any_ret kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=32
diff --git a/tools/perf/tests/attr/test-record-branch-filter-hv b/tools/perf/tests/attr/test-record-branch-filter-hv
index fbf491d..f34d6f1 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-hv
+++ b/tools/perf/tests/attr/test-record-branch-filter-hv
@@ -4,6 +4,5 @@ args    = -j hv kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-ind_call b/tools/perf/tests/attr/test-record-branch-filter-ind_call
index c63cc50..b86a352 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-ind_call
+++ b/tools/perf/tests/attr/test-record-branch-filter-ind_call
@@ -4,6 +4,5 @@ args    = -j ind_call kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=64
diff --git a/tools/perf/tests/attr/test-record-branch-filter-k b/tools/perf/tests/attr/test-record-branch-filter-k
index e0f2f09..d3fbc5e 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-k
+++ b/tools/perf/tests/attr/test-record-branch-filter-k
@@ -4,6 +4,5 @@ args    = -j k kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-branch-filter-u b/tools/perf/tests/attr/test-record-branch-filter-u
index 6cd36e0..a318f0d 100644
--- a/tools/perf/tests/attr/test-record-branch-filter-u
+++ b/tools/perf/tests/attr/test-record-branch-filter-u
@@ -4,6 +4,5 @@ args    = -j u kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=2311
 branch_sample_type=8
diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-data
index 53c8890..a9cf223 100644
--- a/tools/perf/tests/attr/test-record-data
+++ b/tools/perf/tests/attr/test-record-data
@@ -4,8 +4,6 @@ args    = -d kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
-
 # sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
 # PERF_SAMPLE_ADDR | PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC
 sample_type=33039
diff --git a/tools/perf/tests/attr/test-record-no-buffering b/tools/perf/tests/attr/test-record-no-buffering
index 5bf349a..aa3956d 100644
--- a/tools/perf/tests/attr/test-record-no-buffering
+++ b/tools/perf/tests/attr/test-record-no-buffering
@@ -4,7 +4,6 @@ args    = --no-buffering kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=263
 watermark=0
 wakeup_events=1
diff --git a/tools/perf/tests/attr/test-record-raw b/tools/perf/tests/attr/test-record-raw
index 3b89f99..a188a61 100644
--- a/tools/perf/tests/attr/test-record-raw
+++ b/tools/perf/tests/attr/test-record-raw
@@ -4,5 +4,4 @@ args    = -R kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=4000
 sample_type=1415

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Fix precise_ip setup
  2017-07-03 14:50 ` [PATCH 12/15] perf tests attr: Fix precise_ip setup Jiri Olsa
@ 2017-07-20  8:54   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, a.p.zijlstra, tglx, dsahern, hpa, tmricht,
	jolsa, namhyung, mingo

Commit-ID:  042049404f7a149446d5c839a088fb928b11ce7a
Gitweb:     http://git.kernel.org/tip/042049404f7a149446d5c839a088fb928b11ce7a
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:27 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:21 -0300

perf tests attr: Fix precise_ip setup

We have a test to detect to highest precise possible, so test can't just
predict precise_ip value.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-13-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/base-record | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index a9cb72b..31e0b1d 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -25,7 +25,7 @@ inherit_stat=0
 enable_on_exec=1
 task=0
 watermark=0
-precise_ip=0
+precise_ip=0|1|2|3
 mmap_data=0
 sample_id_all=1
 exclude_host=0|1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Fix stat sample_type setup
  2017-07-03 14:50 ` [PATCH 13/15] perf tests attr: Fix stat sample_type setup Jiri Olsa
@ 2017-07-20  8:54   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, hpa, namhyung, mingo, jolsa, tglx, tmricht,
	dsahern, a.p.zijlstra

Commit-ID:  b78e92e6071d5131f5ba6b25437d82c0fcef09de
Gitweb:     http://git.kernel.org/tip/b78e92e6071d5131f5ba6b25437d82c0fcef09de
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:28 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:21 -0300

perf tests attr: Fix stat sample_type setup

>From following commit:

  commit 4979d0c7d0c7 ("perf stat record: Add record command")

we started to assign PERF_SAMPLE_IDENTIFIER to sample_type.

Fixing the attr stat tests accordingly.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-14-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/base-stat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index ff9b33d..4d0c2e4 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -8,7 +8,7 @@ type=0
 size=112
 config=0
 sample_period=0
-sample_type=0
+sample_type=65536
 read_format=3
 disabled=1
 inherit=1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Add optional term
  2017-07-03 14:50 ` [PATCH 14/15] perf tests attr: Add optional term Jiri Olsa
@ 2017-07-20  8:55   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-07-20  8:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, tmricht, linux-kernel, dsahern, namhyung, hpa,
	a.p.zijlstra, jolsa, mingo, tglx

Commit-ID:  1f41873c22826fc92d4bb03c58cf44664fdc3bb8
Gitweb:     http://git.kernel.org/tip/1f41873c22826fc92d4bb03c58cf44664fdc3bb8
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:29 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 18 Jul 2017 23:14:22 -0300

perf tests attr: Add optional term

Some of the stat events are quite rare to find on common machines (like
front end cycles).

Adding an 'optional' term to mark such events in attr tests. Event
marked as optional will not fail the test case if it's not found in
results.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-15-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr.py                   | 14 +++++++++++---
 tools/perf/tests/attr/test-stat-default    |  2 ++
 tools/perf/tests/attr/test-stat-detailed-1 |  2 ++
 tools/perf/tests/attr/test-stat-detailed-2 |  3 +++
 tools/perf/tests/attr/test-stat-detailed-3 |  5 +++++
 5 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py
index b03261c..6bb50e8 100644
--- a/tools/perf/tests/attr.py
+++ b/tools/perf/tests/attr.py
@@ -105,6 +105,11 @@ class Event(dict):
                 return False
         return True
 
+    def optional(self):
+        if self.has_key('optional') and self['optional'] == '1':
+            return True
+        return False
+
     def diff(self, other):
         for t in Event.terms:
             if not self.has_key(t) or not other.has_key(t):
@@ -244,9 +249,12 @@ class Test(object):
             log.debug("    match: [%s] matches %s" % (exp_name, str(exp_list)))
 
             # we did not any matching event - fail
-            if (not exp_list):
-		exp_event.diff(res_event)
-                raise Fail(self, 'match failure');
+            if not exp_list:
+                if exp_event.optional():
+                    log.debug("    %s does not match, but is optional" % exp_name)
+                else:
+                    exp_event.diff(res_event)
+                    raise Fail(self, 'match failure');
 
             match[exp_name] = exp_list
 
diff --git a/tools/perf/tests/attr/test-stat-default b/tools/perf/tests/attr/test-stat-default
index 19270f5..e911dbd 100644
--- a/tools/perf/tests/attr/test-stat-default
+++ b/tools/perf/tests/attr/test-stat-default
@@ -38,12 +38,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
diff --git a/tools/perf/tests/attr/test-stat-detailed-1 b/tools/perf/tests/attr/test-stat-detailed-1
index 51426b8..b39270a 100644
--- a/tools/perf/tests/attr/test-stat-detailed-1
+++ b/tools/perf/tests/attr/test-stat-detailed-1
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
diff --git a/tools/perf/tests/attr/test-stat-detailed-2 b/tools/perf/tests/attr/test-stat-detailed-2
index 8de5acc..45f8e6e 100644
--- a/tools/perf/tests/attr/test-stat-detailed-2
+++ b/tools/perf/tests/attr/test-stat-detailed-2
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
@@ -108,6 +110,7 @@ config=65538
 fd=15
 type=3
 config=1
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
diff --git a/tools/perf/tests/attr/test-stat-detailed-3 b/tools/perf/tests/attr/test-stat-detailed-3
index 0a1f45b..30ae0fb 100644
--- a/tools/perf/tests/attr/test-stat-detailed-3
+++ b/tools/perf/tests/attr/test-stat-detailed-3
@@ -39,12 +39,14 @@ config=0
 fd=6
 type=0
 config=7
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_STALLED_CYCLES_BACKEND
 [event7:base-stat]
 fd=7
 type=0
 config=8
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_INSTRUCTIONS
 [event8:base-stat]
@@ -108,6 +110,7 @@ config=65538
 fd=15
 type=3
 config=1
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
@@ -162,6 +165,7 @@ config=65540
 fd=21
 type=3
 config=512
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
@@ -171,3 +175,4 @@ config=512
 fd=22
 type=3
 config=66048
+optional=1

^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH 15/15] perf tests attr: Fix task term values
  2017-07-03 14:50 ` [PATCH 15/15] perf tests attr: Fix task term values Jiri Olsa
@ 2017-08-09 15:00   ` Jiri Olsa
  2017-08-10  7:07     ` Thomas Richter
  2017-10-03 16:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
  1 sibling, 1 reply; 41+ messages in thread
From: Jiri Olsa @ 2017-08-09 15:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, Ingo Molnar, Peter Zijlstra, Namhyung Kim, David Ahern,
	Thomas Richter

On Mon, Jul 03, 2017 at 04:50:30PM +0200, Jiri Olsa wrote:
> The perf_event_attr::task is 1 by default for first (tracking)
> event in the session. Setting task=1 as default and adding
> task=0 for cases that need it.

hm, looks like this one was overlooked..

thanks,
jirka

> 
> Link: http://lkml.kernel.org/n/tip-w4uuxbwcrf8cjjjbko3ujs95@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/perf/tests/attr/base-record                | 2 +-
>  tools/perf/tests/attr/test-record-group          | 1 +
>  tools/perf/tests/attr/test-record-group-sampling | 2 +-
>  tools/perf/tests/attr/test-record-group1         | 1 +
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
> index 31e0b1da830b..37940665f736 100644
> --- a/tools/perf/tests/attr/base-record
> +++ b/tools/perf/tests/attr/base-record
> @@ -23,7 +23,7 @@ comm=1
>  freq=1
>  inherit_stat=0
>  enable_on_exec=1
> -task=0
> +task=1
>  watermark=0
>  precise_ip=0|1|2|3
>  mmap_data=0
> diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
> index 6e7961f6f7a5..618ba1c17474 100644
> --- a/tools/perf/tests/attr/test-record-group
> +++ b/tools/perf/tests/attr/test-record-group
> @@ -17,5 +17,6 @@ sample_type=327
>  read_format=4
>  mmap=0
>  comm=0
> +task=0
>  enable_on_exec=0
>  disabled=0
> diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
> index ef59afd6d635..f906b793196f 100644
> --- a/tools/perf/tests/attr/test-record-group-sampling
> +++ b/tools/perf/tests/attr/test-record-group-sampling
> @@ -23,7 +23,7 @@ sample_type=343
>  
>  # PERF_FORMAT_ID | PERF_FORMAT_GROUP
>  read_format=12
> -
> +task=0
>  mmap=0
>  comm=0
>  enable_on_exec=0
> diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
> index 87a222d014d8..48e8bd12fe46 100644
> --- a/tools/perf/tests/attr/test-record-group1
> +++ b/tools/perf/tests/attr/test-record-group1
> @@ -18,5 +18,6 @@ sample_type=327
>  read_format=4
>  mmap=0
>  comm=0
> +task=0
>  enable_on_exec=0
>  disabled=0
> -- 
> 2.9.4
> 

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 15/15] perf tests attr: Fix task term values
  2017-08-09 15:00   ` Jiri Olsa
@ 2017-08-10  7:07     ` Thomas Richter
  0 siblings, 0 replies; 41+ messages in thread
From: Thomas Richter @ 2017-08-10  7:07 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, lkml, Ingo Molnar, Peter Zijlstra,
	Namhyung Kim, David Ahern

On Wed, Aug 09, 2017 at 05:00:49PM +0200, Jiri Olsa wrote:
> On Mon, Jul 03, 2017 at 04:50:30PM +0200, Jiri Olsa wrote:
> > The perf_event_attr::task is 1 by default for first (tracking)
> > event in the session. Setting task=1 as default and adding
> > task=0 for cases that need it.
> 
> hm, looks like this one was overlooked..
> 
> thanks,
> jirka
> > 

I have pull perf/core yesterday afternoon and could not find.
However when this is already fixed, I will remove it from my
patch list 

Thanks Thomas

> > Link: http://lkml.kernel.org/n/tip-w4uuxbwcrf8cjjjbko3ujs95@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/perf/tests/attr/base-record                | 2 +-
> >  tools/perf/tests/attr/test-record-group          | 1 +
> >  tools/perf/tests/attr/test-record-group-sampling | 2 +-
> >  tools/perf/tests/attr/test-record-group1         | 1 +
> >  4 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
> > index 31e0b1da830b..37940665f736 100644
> > --- a/tools/perf/tests/attr/base-record
> > +++ b/tools/perf/tests/attr/base-record
> > @@ -23,7 +23,7 @@ comm=1
> >  freq=1
> >  inherit_stat=0
> >  enable_on_exec=1
> > -task=0
> > +task=1
> >  watermark=0
> >  precise_ip=0|1|2|3
> >  mmap_data=0
> > diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
> > index 6e7961f6f7a5..618ba1c17474 100644
> > --- a/tools/perf/tests/attr/test-record-group
> > +++ b/tools/perf/tests/attr/test-record-group
> > @@ -17,5 +17,6 @@ sample_type=327
> >  read_format=4
> >  mmap=0
> >  comm=0
> > +task=0
> >  enable_on_exec=0
> >  disabled=0
> > diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
> > index ef59afd6d635..f906b793196f 100644
> > --- a/tools/perf/tests/attr/test-record-group-sampling
> > +++ b/tools/perf/tests/attr/test-record-group-sampling
> > @@ -23,7 +23,7 @@ sample_type=343
> >  
> >  # PERF_FORMAT_ID | PERF_FORMAT_GROUP
> >  read_format=12
> > -
> > +task=0
> >  mmap=0
> >  comm=0
> >  enable_on_exec=0
> > diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
> > index 87a222d014d8..48e8bd12fe46 100644
> > --- a/tools/perf/tests/attr/test-record-group1
> > +++ b/tools/perf/tests/attr/test-record-group1
> > @@ -18,5 +18,6 @@ sample_type=327
> >  read_format=4
> >  mmap=0
> >  comm=0
> > +task=0
> >  enable_on_exec=0
> >  disabled=0
> > -- 
> > 2.9.4
> > 
> 

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [tip:perf/core] perf tests attr: Fix task term values
  2017-07-03 14:50 ` [PATCH 15/15] perf tests attr: Fix task term values Jiri Olsa
  2017-08-09 15:00   ` Jiri Olsa
@ 2017-10-03 16:43   ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 41+ messages in thread
From: tip-bot for Jiri Olsa @ 2017-10-03 16:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, tmricht, dsahern, mingo, tglx, namhyung, acme,
	a.p.zijlstra, jolsa

Commit-ID:  10836d9f9ac63d40ccfa756f871ce4ed51ae3b52
Gitweb:     https://git.kernel.org/tip/10836d9f9ac63d40ccfa756f871ce4ed51ae3b52
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 3 Jul 2017 16:50:30 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 2 Oct 2017 13:59:18 -0300

perf tests attr: Fix task term values

The perf_event_attr::task is 1 by default for first (tracking) event in
the session. Setting task=1 as default and adding task=0 for cases that
need it.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20170703145030.12903-16-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/base-record                | 2 +-
 tools/perf/tests/attr/test-record-group          | 1 +
 tools/perf/tests/attr/test-record-group-sampling | 2 +-
 tools/perf/tests/attr/test-record-group1         | 1 +
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 31e0b1d..3794066 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -23,7 +23,7 @@ comm=1
 freq=1
 inherit_stat=0
 enable_on_exec=1
-task=0
+task=1
 watermark=0
 precise_ip=0|1|2|3
 mmap_data=0
diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
index 6e7961f..618ba1c 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-record-group
@@ -17,5 +17,6 @@ sample_type=327
 read_format=4
 mmap=0
 comm=0
+task=0
 enable_on_exec=0
 disabled=0
diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
index ef59afd..f906b79 100644
--- a/tools/perf/tests/attr/test-record-group-sampling
+++ b/tools/perf/tests/attr/test-record-group-sampling
@@ -23,7 +23,7 @@ sample_type=343
 
 # PERF_FORMAT_ID | PERF_FORMAT_GROUP
 read_format=12
-
+task=0
 mmap=0
 comm=0
 enable_on_exec=0
diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
index 87a222d..48e8bd1 100644
--- a/tools/perf/tests/attr/test-record-group1
+++ b/tools/perf/tests/attr/test-record-group1
@@ -18,5 +18,6 @@ sample_type=327
 read_format=4
 mmap=0
 comm=0
+task=0
 enable_on_exec=0
 disabled=0

^ permalink raw reply related	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2017-10-03 16:45 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-03 14:50 [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
2017-07-03 14:50 ` [PATCH 01/15] perf tools: Fix -n option Jiri Olsa
2017-07-03 14:57   ` Arnaldo Carvalho de Melo
2017-07-03 15:16     ` [PATCHv2 " Jiri Olsa
2017-07-03 16:10       ` Arnaldo Carvalho de Melo
2017-07-03 16:22         ` Jiri Olsa
2017-07-03 16:40           ` Arnaldo Carvalho de Melo
2017-07-03 16:58             ` Jiri Olsa
2017-07-03 17:44               ` Arnaldo Carvalho de Melo
2017-07-03 14:50 ` [PATCH 02/15] perf tests attr: Do not store failed events Jiri Olsa
2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 03/15] perf tests attr: Add test_attr__ready function Jiri Olsa
2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 04/15] perf tests attr: Make compare_data global Jiri Olsa
2017-07-20  8:51   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 05/15] perf tests attr: Rename compare_data to data_equal Jiri Olsa
2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 06/15] perf tests attr: Add 1s for exclude_kernel and task base bits Jiri Olsa
2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 07/15] perf tests attr: Fix record dwarf test Jiri Olsa
2017-07-20  8:52   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 08/15] perf tests attr: Fix no-delay test Jiri Olsa
2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 09/15] perf tests attr: Add proper return values Jiri Olsa
2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 10/15] perf tests attr: Fix cpu test disabled term setup Jiri Olsa
2017-07-20  8:53   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 11/15] perf tests attr: Fix sample_period setup Jiri Olsa
2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 12/15] perf tests attr: Fix precise_ip setup Jiri Olsa
2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 13/15] perf tests attr: Fix stat sample_type setup Jiri Olsa
2017-07-20  8:54   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 14/15] perf tests attr: Add optional term Jiri Olsa
2017-07-20  8:55   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-03 14:50 ` [PATCH 15/15] perf tests attr: Fix task term values Jiri Olsa
2017-08-09 15:00   ` Jiri Olsa
2017-08-10  7:07     ` Thomas Richter
2017-10-03 16:43   ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-07-17 12:18 ` [PATCH 00/15] perf tools: Fix attr tests Jiri Olsa
2017-07-17 12:51   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).