[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-27cfef009ae8a1019d174153987ce22a0e6677fc@git.kernel.org>
Date: Mon, 14 Dec 2015 00:38:58 -0800
From: tip-bot for Wang Nan <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, davem@...emloft.net,
tglx@...utronix.de, wangnan0@...wei.com, hpa@...or.com,
lizefan@...wei.com, mingo@...nel.org, acme@...hat.com,
namhyung@...nel.org, jolsa@...hat.com, adrian.hunter@...el.com
Subject: [tip:perf/core] perf script: Add support for PERF_TYPE_BREAKPOINT
Commit-ID: 27cfef009ae8a1019d174153987ce22a0e6677fc
Gitweb: http://git.kernel.org/tip/27cfef009ae8a1019d174153987ce22a0e6677fc
Author: Wang Nan <wangnan0@...wei.com>
AuthorDate: Tue, 8 Dec 2015 02:25:43 +0000
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Fri, 11 Dec 2015 09:25:16 -0300
perf script: Add support for PERF_TYPE_BREAKPOINT
Useful for getting stack traces for hardware breakpoint events.
Test result:
Before this patch:
# ~/perf record -g -e mem:0x600980 ./sample
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.011 MB perf.data (12 samples) ]
# ~/perf script
# ~/perf script -F comm,tid,pid,time,event,ip,sym,dso
sample 22520/22520 97457.836294: mem:0x600980:
5a4ad8 __clear_user (/lib/modules/4.3.0-rc4+/build/vmlinux)
...
3f41ba sys_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
979395 return_from_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
7f1b59719cf7 [unknown] ([unknown])
sample 22520/22520 97457.836648: mem:0x600980:
532 main (/home/w00229757/DataBreakpoints/sample)
21bd5 __libc_start_main (/tmp/oxygen_root-root/lib64/libc-2.18.so)
...
After this patch:
# ~/perf script
sample 22520 97457.836294: mem:0x600980:
5a4ad8 __clear_user (/lib/modules/4.3.0-rc4+/build/vmlinux)
...
3f41ba sys_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
979395 return_from_execve (/lib/modules/4.3.0-rc4+/build/vmlinux)
7f1b59719cf7 [unknown] ([unknown])
sample 22520 97457.836648: mem:0x600980:
532 main (/home/w00229757/DataBreakpoints/sample)
21bd5 __libc_start_main (/tmp/oxygen_root-root/lib64/libc-2.18.so)
Committer note:
So, further testing, lets do it for a kernel global variable,
tcp_hashinfo:
# grep -w tcp_hashinfo /proc/kallsyms
ffffffff8202fc00 B tcp_hashinfo
#
Note: allow specifying mem:tcp_hashinfo:
# perf record -g -e mem:0xffffffff81c65ac0 -a
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.790 MB perf.data ]
#
# perf evlist
mem:0xffffffff8202fc00
# perf evlist -v
mem:0xffffffff8202fc00: type: 5, size: 112, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CALLCHAIN|CPU, disabled: 1, inherit: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, bp_type: 3, { bp_addr, config1 }: 0xffffffff8202fc00, { bp_len, config2 }: 0x4
#
Then, after this patch:
# perf script
swapper 0 [000] 171036.986988: mem:0xffffffff8202fc00:
8a0fb5 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
8bc09d tcp_v4_early_demux (/lib/modules/4.3.0+/build/vmlinux)
896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
8572a8 process_backlog (/lib/modules/4.3.0+/build/vmlinux)
856b11 net_rx_action (/lib/modules/4.3.0+/build/vmlinux)
2a284b __do_softirq (/lib/modules/4.3.0+/build/vmlinux)
2a2ba3 irq_exit (/lib/modules/4.3.0+/build/vmlinux)
96b7a4 do_IRQ (/lib/modules/4.3.0+/build/vmlinux)
969807 ret_from_intr (/lib/modules/4.3.0+/build/vmlinux)
804c27 cpuidle_enter (/lib/modules/4.3.0+/build/vmlinux)
2ded22 call_cpuidle (/lib/modules/4.3.0+/build/vmlinux)
2defb6 cpu_startup_entry (/lib/modules/4.3.0+/build/vmlinux)
95d5bc rest_init (/lib/modules/4.3.0+/build/vmlinux)
1163ffa start_kernel ([kernel.vmlinux].init.text)
11634d7 x86_64_start_reservations ([kernel.vmlinux].init.text)
1163623 x86_64_start_kernel ([kernel.vmlinux].init.text)
Signed-off-by: Wang Nan <wangnan0@...wei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: David S. Miller <davem@...emloft.net>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Zefan Li <lizefan@...wei.com>
Cc: pi3orama@....com
Link: http://lkml.kernel.org/r/1449541544-67621-16-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/builtin-script.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 3c3f8d0..d259e9a 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -130,6 +130,18 @@ static struct {
.invalid_fields = PERF_OUTPUT_TRACE,
},
+
+ [PERF_TYPE_BREAKPOINT] = {
+ .user_set = false,
+
+ .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
+ PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
+ PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP |
+ PERF_OUTPUT_SYM | PERF_OUTPUT_DSO |
+ PERF_OUTPUT_PERIOD,
+
+ .invalid_fields = PERF_OUTPUT_TRACE,
+ },
};
static bool output_set_by_user(void)
@@ -1129,6 +1141,8 @@ static int parse_output_fields(const struct option *opt __maybe_unused,
type = PERF_TYPE_TRACEPOINT;
else if (!strcmp(str, "raw"))
type = PERF_TYPE_RAW;
+ else if (!strcmp(str, "break"))
+ type = PERF_TYPE_BREAKPOINT;
else {
fprintf(stderr, "Invalid event type in field string.\n");
rc = -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists