[tip:perf/urgent] perf parser: Improve error message for PMU address filters
Commit-ID: 49836f7811f383d8613661fff110ce74f4710d52 Gitweb: https://git.kernel.org/tip/49836f7811f383d8613661fff110ce74f4710d52 Author: Jack Henschel AuthorDate: Wed, 4 Jul 2018 14:13:45 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 20 Aug 2018 08:54:58 -0300 perf parser: Improve error message for PMU address filters This is the second version of a patch that improves the error message of the perf events parser when the PMU hardware does not support address filters. Previously, the perf returned the following error: $ perf record -e intel_pt// --filter 'filter sys_write' --filter option should follow a -e tracepoint or HW tracer option This implies there is some syntax error present in the command line, which is not true. Rather, notify the user that the CPU does not have support for this feature. For example, Intel chips based on the Broadwell micro-archticture have the Intel PT PMU, but do not support address filtering. Now, perf prints the following error message: $ perf record -e intel_pt// --filter 'filter sys_write' This CPU does not support address filtering Signed-off-by: Jack Henschel Tested-by: Arnaldo Carvalho de Melo Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180704121345.19025-1-jack...@mailbox.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 15eec49e71a1..f8cd3e7c9186 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) int nr_addr_filters = 0; struct perf_pmu *pmu = NULL; - if (evsel == NULL) - goto err; + if (evsel == NULL) { + fprintf(stderr, + "--filter option should follow a -e tracepoint or HW tracer option\n"); + return -1; + } if (evsel->attr.type == PERF_TYPE_TRACEPOINT) { if (perf_evsel__append_tp_filter(evsel, str) < 0) { @@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) perf_pmu__scan_file(pmu, "nr_addr_filters", "%d", _addr_filters); - if (!nr_addr_filters) - goto err; + if (!nr_addr_filters) { + fprintf(stderr, + "This CPU does not support address filtering\n"); + return -1; + } if (perf_evsel__append_addr_filter(evsel, str) < 0) { fprintf(stderr, @@ -2024,12 +2030,6 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) } return 0; - -err: - fprintf(stderr, - "--filter option should follow a -e tracepoint or HW tracer option\n"); - - return -1; } int parse_filter(const struct option *opt, const char *str,
[tip:perf/urgent] perf parser: Improve error message for PMU address filters
Commit-ID: 49836f7811f383d8613661fff110ce74f4710d52 Gitweb: https://git.kernel.org/tip/49836f7811f383d8613661fff110ce74f4710d52 Author: Jack Henschel AuthorDate: Wed, 4 Jul 2018 14:13:45 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 20 Aug 2018 08:54:58 -0300 perf parser: Improve error message for PMU address filters This is the second version of a patch that improves the error message of the perf events parser when the PMU hardware does not support address filters. Previously, the perf returned the following error: $ perf record -e intel_pt// --filter 'filter sys_write' --filter option should follow a -e tracepoint or HW tracer option This implies there is some syntax error present in the command line, which is not true. Rather, notify the user that the CPU does not have support for this feature. For example, Intel chips based on the Broadwell micro-archticture have the Intel PT PMU, but do not support address filtering. Now, perf prints the following error message: $ perf record -e intel_pt// --filter 'filter sys_write' This CPU does not support address filtering Signed-off-by: Jack Henschel Tested-by: Arnaldo Carvalho de Melo Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180704121345.19025-1-jack...@mailbox.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 15eec49e71a1..f8cd3e7c9186 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1991,8 +1991,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) int nr_addr_filters = 0; struct perf_pmu *pmu = NULL; - if (evsel == NULL) - goto err; + if (evsel == NULL) { + fprintf(stderr, + "--filter option should follow a -e tracepoint or HW tracer option\n"); + return -1; + } if (evsel->attr.type == PERF_TYPE_TRACEPOINT) { if (perf_evsel__append_tp_filter(evsel, str) < 0) { @@ -2014,8 +2017,11 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) perf_pmu__scan_file(pmu, "nr_addr_filters", "%d", _addr_filters); - if (!nr_addr_filters) - goto err; + if (!nr_addr_filters) { + fprintf(stderr, + "This CPU does not support address filtering\n"); + return -1; + } if (perf_evsel__append_addr_filter(evsel, str) < 0) { fprintf(stderr, @@ -2024,12 +2030,6 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) } return 0; - -err: - fprintf(stderr, - "--filter option should follow a -e tracepoint or HW tracer option\n"); - - return -1; } int parse_filter(const struct option *opt, const char *str,
[tip:perf/urgent] perf intel-pt: Fix syntax in documentation of config option
Commit-ID: 4fb205392022ba99a45dd01a62c6e2df046e400a Gitweb: http://git.kernel.org/tip/4fb205392022ba99a45dd01a62c6e2df046e400a Author: Jack HenschelAuthorDate: Thu, 31 Aug 2017 10:05:35 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 1 Sep 2017 14:45:59 -0300 perf intel-pt: Fix syntax in documentation of config option As specified in tools/perf/Documentation/perf-config.txt, perf configuration items must be in 'key = value' format, otherwise the following error message occurs: $ perf record -e intel_pt//u -- ls bad config file line 2 in ~/.perfconfig $ cat .perfconfig [intel-pt] mispred-all Changing to assigning a value to the key 'mispred-all' fixes the issue: $ perf record -e intel_pt//u -- ls [ perf record: Woken up 1 times to write data ] [ perf record: Capured and wrote 0.031 MB perf.data] $ cat .perfconfig [intel-pt] mispred-all = true Signed-off-by: Jack Henschel Cc: Alexander Shishkin Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170831080535.2157-1-jack...@mailbox.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/intel-pt.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/Documentation/intel-pt.txt b/tools/perf/Documentation/intel-pt.txt index ab1b082..76971d2 100644 --- a/tools/perf/Documentation/intel-pt.txt +++ b/tools/perf/Documentation/intel-pt.txt @@ -873,7 +873,7 @@ amended to take the number of elements as a parameter. $ cat ~/.perfconfig [intel-pt] - mispred-all + mispred-all = on $ perf record -e intel_pt//u ./sort 3000 Bubble sorting array of 3000 elements
[tip:perf/urgent] perf intel-pt: Fix syntax in documentation of config option
Commit-ID: 4fb205392022ba99a45dd01a62c6e2df046e400a Gitweb: http://git.kernel.org/tip/4fb205392022ba99a45dd01a62c6e2df046e400a Author: Jack Henschel AuthorDate: Thu, 31 Aug 2017 10:05:35 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 1 Sep 2017 14:45:59 -0300 perf intel-pt: Fix syntax in documentation of config option As specified in tools/perf/Documentation/perf-config.txt, perf configuration items must be in 'key = value' format, otherwise the following error message occurs: $ perf record -e intel_pt//u -- ls bad config file line 2 in ~/.perfconfig $ cat .perfconfig [intel-pt] mispred-all Changing to assigning a value to the key 'mispred-all' fixes the issue: $ perf record -e intel_pt//u -- ls [ perf record: Woken up 1 times to write data ] [ perf record: Capured and wrote 0.031 MB perf.data] $ cat .perfconfig [intel-pt] mispred-all = true Signed-off-by: Jack Henschel Cc: Alexander Shishkin Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170831080535.2157-1-jack...@mailbox.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/intel-pt.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/Documentation/intel-pt.txt b/tools/perf/Documentation/intel-pt.txt index ab1b082..76971d2 100644 --- a/tools/perf/Documentation/intel-pt.txt +++ b/tools/perf/Documentation/intel-pt.txt @@ -873,7 +873,7 @@ amended to take the number of elements as a parameter. $ cat ~/.perfconfig [intel-pt] - mispred-all + mispred-all = on $ perf record -e intel_pt//u ./sort 3000 Bubble sorting array of 3000 elements
[tip:perf/core] perf stat: Fix path to PMU formats in documentation
Commit-ID: 726647d0526c5c2f3472010677122b89d9e4ef88 Gitweb: http://git.kernel.org/tip/726647d0526c5c2f3472010677122b89d9e4ef88 Author: Jack HenschelAuthorDate: Thu, 24 Aug 2017 15:20:22 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 28 Aug 2017 11:05:09 -0300 perf stat: Fix path to PMU formats in documentation As defined in tools/perf/util/pmu.c, the EVENT_SOURCE_DEVICE_PATH is /sys/bus/event_source/devices/ (no traling 's' in event_source) This patch corrects the path in the perf stat documentation Signed-off-by: Jack Henschel Cc: Alexander Shishkin Cc: Jack Henschel Cc: Peter Zijlstra Cc: triv...@kernel.org Link: http://lkml.kernel.org/r/20170824132022.10934-1-jack...@mailbox.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-stat.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index 6980763..c37d616 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt @@ -41,13 +41,13 @@ report:: - a symbolically formed event like 'pmu/param1=0x3,param2/' where param1 and param2 are defined as formats for the PMU in - /sys/bus/event_sources/devices//format/* + /sys/bus/event_source/devices//format/* - a symbolically formed event like 'pmu/config=M,config1=N,config2=K/' where M, N, K are numbers (in decimal, hex, octal format). Acceptable values for each of 'config', 'config1' and 'config2' parameters are defined by corresponding entries in - /sys/bus/event_sources/devices//format/* + /sys/bus/event_source/devices//format/* -i:: --no-inherit::
[tip:perf/core] perf stat: Fix path to PMU formats in documentation
Commit-ID: 726647d0526c5c2f3472010677122b89d9e4ef88 Gitweb: http://git.kernel.org/tip/726647d0526c5c2f3472010677122b89d9e4ef88 Author: Jack Henschel AuthorDate: Thu, 24 Aug 2017 15:20:22 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 28 Aug 2017 11:05:09 -0300 perf stat: Fix path to PMU formats in documentation As defined in tools/perf/util/pmu.c, the EVENT_SOURCE_DEVICE_PATH is /sys/bus/event_source/devices/ (no traling 's' in event_source) This patch corrects the path in the perf stat documentation Signed-off-by: Jack Henschel Cc: Alexander Shishkin Cc: Jack Henschel Cc: Peter Zijlstra Cc: triv...@kernel.org Link: http://lkml.kernel.org/r/20170824132022.10934-1-jack...@mailbox.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-stat.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index 6980763..c37d616 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt @@ -41,13 +41,13 @@ report:: - a symbolically formed event like 'pmu/param1=0x3,param2/' where param1 and param2 are defined as formats for the PMU in - /sys/bus/event_sources/devices//format/* + /sys/bus/event_source/devices//format/* - a symbolically formed event like 'pmu/config=M,config1=N,config2=K/' where M, N, K are numbers (in decimal, hex, octal format). Acceptable values for each of 'config', 'config1' and 'config2' parameters are defined by corresponding entries in - /sys/bus/event_sources/devices//format/* + /sys/bus/event_source/devices//format/* -i:: --no-inherit::