Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1389144

[PATCH 03/30] perf trace: Make --pf maj/min/all use callchains too

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 03/30] perf trace: Make --pf maj/min/all use callchains too
Date 2016-04-27 16:40 +0200
Message-ID <rsyNe-2L2-55@gated-at.bofh.it> (permalink)
References <rsyNc-2L2-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Arnaldo Carvalho de Melo <acme@redhat.com>

Forgot about page faults, a software event, when adding support for callchains,
fix it:

  # trace --no-syscalls --pf maj --call dwarf
     0.000 ( 0.000 ms): Xorg/2068 majfault [sfbSegment1+0x0] => /usr/lib64/xorg/modules/drivers/intel_drv.so@0x11b490 (x.)
                                       sfbSegment1+0x0 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
                                       fbPolySegment32+0x361 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
                                       sna_poly_segment+0x743 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
                                       damagePolySegment+0x77 (/usr/libexec/Xorg)
                                       ProcPolySegment+0xe7 (/usr/libexec/Xorg)
                                       Dispatch+0x25f (/usr/libexec/Xorg)
                                       dix_main+0x3c3 (/usr/libexec/Xorg)
                                       __libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
                                       _start+0x29 (/usr/libexec/Xorg)
     0.257 ( 0.000 ms): Xorg/2068 majfault [miZeroClipLine+0x0] => /usr/libexec/Xorg@0x18e830 (x.)
                                       miZeroClipLine+0x0 (/usr/libexec/Xorg)
                                       _fbSegment+0x2c0 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
                                       sfbSegment1+0x67 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
                                       fbPolySegment32+0x361 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
                                       sna_poly_segment+0x743 (/usr/lib64/xorg/modules/drivers/intel_drv.so)
                                       damagePolySegment+0x77 (/usr/libexec/Xorg)
                                       ProcPolySegment+0xe7 (/usr/libexec/Xorg)
                                       Dispatch+0x25f (/usr/libexec/Xorg)
                                       dix_main+0x3c3 (/usr/libexec/Xorg)
                                       __libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
                                       _start+0x29 (/usr/libexec/Xorg)
^C#

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-8h6ssirw5z15qyhy2lwd6f89@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c | 59 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 41 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 69b460354201..d1bbcb9abca3 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2222,6 +2222,11 @@ static int trace__pgfault(struct trace *trace,
 	print_location(trace->output, sample, &al, true, false);
 
 	fprintf(trace->output, " (%c%c)\n", map_type, al.level);
+
+	if (sample->callchain) {
+		if (trace__resolve_callchain(trace, evsel, sample, &callchain_cursor) == 0)
+			trace__fprintf_callchain(trace, sample);
+	}
 out:
 	err = 0;
 out_put:
@@ -2547,24 +2552,42 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
 
 	perf_evlist__config(evlist, &trace->opts, NULL);
 
-	if (callchain_param.enabled && trace->syscalls.events.sys_exit) {
-		perf_evsel__config_callchain(trace->syscalls.events.sys_exit,
-					     &trace->opts, &callchain_param);
-               /*
-                * Now we have evsels with different sample_ids, use
-                * PERF_SAMPLE_IDENTIFIER to map from sample to evsel
-                * from a fixed position in each ring buffer record.
-                *
-                * As of this the changeset introducing this comment, this
-                * isn't strictly needed, as the fields that can come before
-                * PERF_SAMPLE_ID are all used, but we'll probably disable
-                * some of those for things like copying the payload of
-                * pointer syscall arguments, and for vfs_getname we don't
-                * need PERF_SAMPLE_ADDR and PERF_SAMPLE_IP, so do this
-                * here as a warning we need to use PERF_SAMPLE_IDENTIFIER.
-                */
-		perf_evlist__set_sample_bit(evlist, IDENTIFIER);
-		perf_evlist__reset_sample_bit(evlist, ID);
+	if (callchain_param.enabled) {
+		bool use_identifier = false;
+
+		if (trace->syscalls.events.sys_exit) {
+			perf_evsel__config_callchain(trace->syscalls.events.sys_exit,
+						     &trace->opts, &callchain_param);
+			use_identifier = true;
+		}
+
+		if (pgfault_maj) {
+			perf_evsel__config_callchain(pgfault_maj, &trace->opts, &callchain_param);
+			use_identifier = true;
+		}
+
+		if (pgfault_min) {
+			perf_evsel__config_callchain(pgfault_min, &trace->opts, &callchain_param);
+			use_identifier = true;
+		}
+
+		if (use_identifier) {
+		       /*
+			* Now we have evsels with different sample_ids, use
+			* PERF_SAMPLE_IDENTIFIER to map from sample to evsel
+			* from a fixed position in each ring buffer record.
+			*
+			* As of this the changeset introducing this comment, this
+			* isn't strictly needed, as the fields that can come before
+			* PERF_SAMPLE_ID are all used, but we'll probably disable
+			* some of those for things like copying the payload of
+			* pointer syscall arguments, and for vfs_getname we don't
+			* need PERF_SAMPLE_ADDR and PERF_SAMPLE_IP, so do this
+			* here as a warning we need to use PERF_SAMPLE_IDENTIFIER.
+			*/
+			perf_evlist__set_sample_bit(evlist, IDENTIFIER);
+			perf_evlist__reset_sample_bit(evlist, ID);
+		}
 	}
 
 	signal(SIGCHLD, sig_handler);
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 15/30] perf evlist: Enforce ring buffer reading Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 30/30] perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 03/30] perf trace: Make --pf maj/min/all use callchains too Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 05/30] perf trace: Make --event honour --min-stack too Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 17/30] perf tools: Add lsdir() helper to read a directory Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 13/30] perf intel-pt: Fix off-by-one comparison on maximum code Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 25/30] perf probe: Fix offline module name missmatch issue Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 21/30] perf trace: Do not beautify the 'pid' parameter as a simple integer Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 29/30] perf core: Allow setting up max frame stack depth via sysctl Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:40 +0200
  [PATCH 26/30] perf probe: Fix module probe issue if no dwarf support Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 14/30] perf hists: Clear dummy entry accumulated period Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 16/30] perf probe: Close target file on error path Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 09/30] tools build: Fix perf_clean target Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 08/30] perf tools: Make the x86 clean quiet Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 12/30] perf bench futex: Simplify wrapper for LOCK_PI Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 20/30] perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/ Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 27/30] perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2 Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 04/30] perf script: Fix segfault when printing callchains Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 19/30] perf probe: Set default kprobe group name if it is not given Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 10/30] perf tools: Remove duplicate const qualifier Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 18/30] perf probe: Let probe_file__add_event return 0 if succeeded Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 11/30] perf tests: Replace assignment with comparison on assert check Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 06/30] perf trace: Make --pf honour --min-stack too Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 02/30] perf trace: Extract evsel contructor from perf_evlist__add_pgfault Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 28/30] perf bench: Remove one more die() call Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  [PATCH 01/30] perf buildid: Fix off-by-one in write_buildid() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-27 16:50 +0200
  Re: [GIT PULL 00/30] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-04-27 17:10 +0200

csiph-web