Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1434855 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2016-06-30 23:10 +0200 |
| Last post | 2016-07-01 04:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
'perf test backward' failing with older kernels, should Skip Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-30 23:10 +0200
Re: 'perf test backward' failing with older kernels, should Skip "Wangnan (F)" <wangnan0@huawei.com> - 2016-07-01 04:00 +0200
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-06-30 23:10 +0200 |
| Subject | 'perf test backward' failing with older kernels, should Skip |
| Message-ID | <rPRnI-66X-13@gated-at.bofh.it> |
Hi Wang,
I booted a machine with the f24 distro kernel and the backward
ring buffer test started FAILing, when it should've noticed that the
kernel doesn't support it and Skip instead:
[root@jouet ~]# perf test -v backward
45: Test backward reading from ring buffer :
--- start ---
<SNIP>
mmap size 1052672B
Unexpected counter: sample_count=0, comm_count=0
---- end ----
Test backward reading from ring buffer: FAILED!
[root@jouet ~]#
Ok, so I think the patch below should do the trick, is that right? With it
I get:
[root@jouet ~]# perf test backward
45: Test backward reading from ring buffer : Skip
[root@jouet ~]#
diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index e70313fac5a5..0731b0bf9552 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -118,8 +118,10 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
perf_evlist__config(evlist, &opts, NULL);
/* Set backward bit, ring buffer should be writing from end */
- evlist__for_each_entry(evlist, evsel)
+ evlist__for_each_entry(evlist, evsel) {
+ evsel->overwrite = true;
evsel->attr.write_backward = 1;
+ }
err = perf_evlist__open(evlist);
if (err < 0) {
[toc] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2016-07-01 04:00 +0200 |
| Message-ID | <rPVUl-m1-7@gated-at.bofh.it> |
| In reply to | #1434855 |
On 2016/7/1 5:00, Arnaldo Carvalho de Melo wrote:
> Hi Wang,
>
> I booted a machine with the f24 distro kernel and the backward
> ring buffer test started FAILing, when it should've noticed that the
> kernel doesn't support it and Skip instead:
>
> [root@jouet ~]# perf test -v backward
> 45: Test backward reading from ring buffer :
> --- start ---
> <SNIP>
> mmap size 1052672B
> Unexpected counter: sample_count=0, comm_count=0
> ---- end ----
> Test backward reading from ring buffer: FAILED!
> [root@jouet ~]#
>
I didn't test it on old kernel, but I tested it by forcing
sys_perf_event_open
return -EINVAL when attr->backward is true by following patch:
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1d8f2bb..3e91c63 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1418,6 +1418,9 @@ retry_open:
pr_debug2("sys_perf_event_open: pid %d cpu %d
group_fd %d flags %#lx\n",
pid, cpus->map[cpu], group_fd, flags);
+ if (evsel->attr.write_backward)
+ FD(evsel, cpu, thread) = -EINVAL;
+ else
FD(evsel, cpu, thread) =
sys_perf_event_open(&evsel->attr,
pid,
cpus->map[cpu],
'perf test' skips this test.
Let me switch to an old kernel and try again...
Oops... It does FAILED...
Seems the code I use to emulate old kernel is wrong. I should set errno
to EINVAL and
make FD(...) = -1.
I agree with your patch. Thank you for pointing it out.
> Ok, so I think the patch below should do the trick, is that right? With it
> I get:
>
> [root@jouet ~]# perf test backward
> 45: Test backward reading from ring buffer : Skip
> [root@jouet ~]#
>
> diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
> index e70313fac5a5..0731b0bf9552 100644
> --- a/tools/perf/tests/backward-ring-buffer.c
> +++ b/tools/perf/tests/backward-ring-buffer.c
> @@ -118,8 +118,10 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
> perf_evlist__config(evlist, &opts, NULL);
>
> /* Set backward bit, ring buffer should be writing from end */
> - evlist__for_each_entry(evlist, evsel)
> + evlist__for_each_entry(evlist, evsel) {
> + evsel->overwrite = true;
> evsel->attr.write_backward = 1;
> + }
>
> err = perf_evlist__open(evlist);
> if (err < 0) {
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web