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>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 1 Apr 2016 13:26:42 +0000
From:	Wang Nan <wangnan0@...wei.com>
To:	<acme@...nel.org>
CC:	<linux-kernel@...r.kernel.org>, <pi3orama@....com>,
	Wang Nan <wangnan0@...wei.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	"Adrian Hunter" <adrian.hunter@...el.com>,
	David Ahern <dsahern@...il.com>, Jiri Olsa <jolsa@...nel.org>,
	Milian Wolff <milian.wolff@...b.com>,
	Namhyung Kim <namhyung@...nel.org>
Subject: [PATCH] perf tools: Add sample types for bpf-output event

Before this patch we can see very large time in the events before
bpf-output event. For example:

 # ./perf trace -vv -T --ev sched:sched_switch \
                       --ev bpf-output/no-inherit,name=evt/ \
                       --ev ./test_bpf_trace.c/map:channel.event=evt/ \
                       usleep 10
 ...
 18446744073709.551 (18446564645918.480 ms): usleep/4157 nanosleep(rqtp: 0x7ffd3f0dc4e0                                        ) ...
 18446744073709.551 (         ): evt:Raise a BPF event!..)
 179427791.076 (         ): perf_bpf_probe:func_begin:(ffffffff810eb9a0))
 179427791.081 (         ): sched:sched_switch:usleep:4157 [120] S ==> swapper/2:0 [120])
 ...

We can also see the differences between bpf-output events and
breakpoint events:

For bpf output event:
   sample_type                    IP|TID|RAW|IDENTIFIER

For tracepoint events:
   sample_type                    IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER

This patch fix this differences by adding more sample type for
bpf-output events.

After this patch:

 # ./perf trace -vv -T --ev sched:sched_switch \
                       --ev bpf-output/no-inherit,name=evt/ \
                       --ev ./test_bpf_trace.c/map:channel.event=evt/ \
                       usleep 10
 ...
 179877370.878 ( 0.003 ms): usleep/5336 nanosleep(rqtp: 0x7ffff866c450                                        ) ...
 179877370.878 (         ): evt:Raise a BPF event!..)
 179877370.878 (         ): perf_bpf_probe:func_begin:(ffffffff810eb9a0))
 179877370.882 (         ): sched:sched_switch:usleep:5336 [120] S ==> swapper/4:0 [120])
 179877370.945 (         ): evt:Raise a BPF event!..)
 ...

 # ./perf trace -vv -T --ev sched:sched_switch \
                       --ev bpf-output/no-inherit,name=evt/ \
                       --ev ./test_bpf_trace.c/map:channel.event=evt/ \
                       usleep 10 2>&1 | grep sample_type
  sample_type                      IP|TID|TIME|ID|CPU|PERIOD|RAW
  sample_type                      IP|TID|TIME|ID|CPU|PERIOD|RAW
  sample_type                      IP|TID|TIME|ID|CPU|PERIOD|RAW
  sample_type                      IP|TID|TIME|ID|CPU|PERIOD|RAW
  sample_type                      IP|TID|TIME|ID|CPU|PERIOD|RAW
  sample_type                      IP|TID|TIME|ID|CPU|PERIOD|RAW

The 'IDENTIFIER' is not required because all events have the
same sample_type.

Signed-off-by: Wang Nan <wangnan0@...wei.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
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>
---
 tools/perf/util/evsel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 738ce22..3fd7c2c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -226,7 +226,8 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx)
 		perf_evsel__init(evsel, attr, idx);
 
 	if (perf_evsel__is_bpf_output(evsel)) {
-		evsel->attr.sample_type |= PERF_SAMPLE_RAW;
+		evsel->attr.sample_type |= (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
+					    PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD),
 		evsel->attr.sample_period = 1;
 	}
 
-- 
1.8.3.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ