lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-8h6ssirw5z15qyhy2lwd6f89@git.kernel.org>
Date:	Wed, 27 Apr 2016 08:29:41 -0700
From:	tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	wangnan0@...wei.com, dsahern@...il.com, namhyung@...nel.org,
	hpa@...or.com, acme@...hat.com, jolsa@...nel.org,
	tglx@...utronix.de, adrian.hunter@...el.com, milian.wolff@...b.com,
	mingo@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip:perf/core] perf trace: Make --pf maj/min/all use callchains
 too

Commit-ID:  0c3a6ef4ea54a179328734a45b7f7698e44ad805
Gitweb:     http://git.kernel.org/tip/0c3a6ef4ea54a179328734a45b7f7698e44ad805
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Tue, 19 Apr 2016 16:31:12 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 25 Apr 2016 12:49:17 -0300

perf trace: Make --pf maj/min/all use callchains too

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@...1b490 (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@...8e830 (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@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Milian Wolff <milian.wolff@...b.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/n/tip-8h6ssirw5z15qyhy2lwd6f89@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.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 69b4603..d1bbcb9 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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ