From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Steven Noonan <steven@uplinklabs.net>
Cc: Linux Kernel mailing List <linux-kernel@vger.kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: perf object code reading test crashes
Date: Thu, 18 Feb 2016 11:27:27 -0300 [thread overview]
Message-ID: <20160218142727.GD9909@kernel.org> (raw)
In-Reply-To: <CAKbGBLjnw=sykqGSpOVqkNk81J5ifjGJxNrzfvBtXDVuHfDovw@mail.gmail.com>
Em Wed, Feb 17, 2016 at 05:13:59PM -0800, Steven Noonan escreveu:
> On Wed, Feb 17, 2016 at 6:27 AM, Arnaldo Carvalho de Melo wrote
> > Yeah, we forgot to grab refcounts in perf_evlist__set_maps(), can you
> > try this instead, if it works please let me know so that I can add a:
> > Reported-and-Tested-by: you to this patch,
> That did the trick for the refcounting as far as valgrind/libc are concerned.
> Reported-and-Tested-by: Steven Noonan <steven@uplinklabs.net>
Thanks, about the test failing:
#define EINVAL 22 /* Invalid argument */
It can be a number of things, lemme try running it here:
> Now to figure out why the test is failing. This same test works fine
> on another system running the same kernel build:
> $ ./perf test -v -v 21
> 21: Test object code reading :
> --- start ---
> test child forked, pid 19527
> Looking at the vmlinux_path (7 entries long)
> Using /usr/lib/debug/lib/modules/4.4.1-1-ec2/vmlinux for symbols
> Parsing event 'cycles'
> ------------------------------------------------------------
> perf_event_attr:
> size 112
> { sample_period, sample_freq } 4000
> sample_type IP|TID|PERIOD
> disabled 1
> inherit 1
> mmap 1
> comm 1
> freq 1
> task 1
> sample_id_all 1
> exclude_guest 1
> mmap2 1
> comm_exec 1
> ------------------------------------------------------------
> sys_perf_event_open: pid 19527 cpu 0 group_fd -1 flags 0x8
> sys_perf_event_open failed, error -22
[acme@jouet linux]$ perf test -v -v 21 2>&1 | head -30
21: Test object code reading :
--- start ---
test child forked, pid 28587
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/lib/modules/4.3.5-300.fc23.x86_64/vmlinux for symbols
Parsing event 'cycles'
------------------------------------------------------------
perf_event_attr:
size 112
{ sample_period, sample_freq } 4000
sample_type IP|TID|PERIOD
disabled 1
inherit 1
mmap 1
comm 1
freq 1
task 1
sample_id_all 1
exclude_guest 1
mmap2 1
comm_exec 1
------------------------------------------------------------
sys_perf_event_open: pid 28587 cpu 0 group_fd -1 flags 0x8
sys_perf_event_open: pid 28587 cpu 1 group_fd -1 flags 0x8
sys_perf_event_open: pid 28587 cpu 2 group_fd -1 flags 0x8
sys_perf_event_open: pid 28587 cpu 3 group_fd -1 flags 0x8
mmap size 528384B
perf event ring buffer mmapped per cpu
Reading object code for memory address: 0xffffffff810604ea
File is: /usr/lib/debug/lib/modules/4.3.5-300.fc23.x86_64/vmlinux
[acme@jouet linux]$
Works and starts to use the vmlinux file, etc, now lets try reducing the max
sample_freq to something below 4000 (4 kHz):
[root@jouet ~]# cat /proc/sys/kernel/perf_event_max_sample_rate
25000
[root@jouet ~]# echo 1000 > /proc/sys/kernel/perf_event_max_sample_rate
When the system boots it starts with a high value and auto-decreases under
certain conditions:
[root@jouet ~]# dmesg | grep max_sample_rate
[ 2499.144373] perf interrupt took too long (2501 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
[ 3592.413606] perf interrupt took too long (5069 > 5000), lowering kernel.perf_event_max_sample_rate to 25000
[root@jouet ~]#
So lets say this specific system of yours went all the way down to 1000 (1 kHz):
[acme@jouet linux]$ perf test -v -v 21 2>&1 | head -25
21: Test object code reading :
--- start ---
test child forked, pid 29140
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/lib/modules/4.3.5-300.fc23.x86_64/vmlinux for symbols
Parsing event 'cycles'
------------------------------------------------------------
perf_event_attr:
size 112
{ sample_period, sample_freq } 4000
sample_type IP|TID|PERIOD
disabled 1
inherit 1
mmap 1
comm 1
freq 1
task 1
sample_id_all 1
exclude_guest 1
mmap2 1
comm_exec 1
------------------------------------------------------------
sys_perf_event_open: pid 29140 cpu 0 group_fd -1 flags 0x8
sys_perf_event_open failed, error -22
------------------------------------------------------------
[acme@jouet linux]$ perf test -v -v 21 2>&1 | tail -5
sys_perf_event_open failed, error -22
perf_evlist__open failed
test child finished with -1
---- end ----
Test object code reading: FAILED!
[acme@jouet linux]$
Oops, guess this is the problem, and I also think we don't need more than 1 hz
in this test if even that :-\
So, try the patch at the end of this message, with it and with I get:
[root@jouet ~]# cat /proc/sys/kernel/perf_event_max_sample_rate
1000
[root@jouet ~]# perf test -v -v 21 2>&1 | tail -26
Using /proc/kcore for kernel object code
Using /proc/kallsyms for symbols
Parsing event 'cycles'
------------------------------------------------------------
perf_event_attr:
size 112
sample_type IP|TID
disabled 1
inherit 1
mmap 1
comm 1
task 1
sample_id_all 1
exclude_guest 1
mmap2 1
comm_exec 1
------------------------------------------------------------
sys_perf_event_open: pid 31476 cpu 0 group_fd -1 flags 0x8
sys_perf_event_open: pid 31476 cpu 1 group_fd -1 flags 0x8
sys_perf_event_open: pid 31476 cpu 2 group_fd -1 flags 0x8
sys_perf_event_open: pid 31476 cpu 3 group_fd -1 flags 0x8
mmap size 528384B
perf event ring buffer mmapped per cpu
test child finished with 0
---- end ----
Test object code reading: Ok
[root@jouet ~]#
---
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 313a48c6b2bc..a984accdaa74 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -439,7 +439,6 @@ static int do_test_code_reading(bool try_kcore)
.mmap_pages = UINT_MAX,
.user_freq = UINT_MAX,
.user_interval = ULLONG_MAX,
- .freq = 4000,
.target = {
.uses_mmap = true,
},
next prev parent reply other threads:[~2016-02-18 14:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 6:42 perf object code reading test crashes Steven Noonan
2016-02-17 14:27 ` Arnaldo Carvalho de Melo
2016-02-18 1:13 ` Steven Noonan
2016-02-18 14:27 ` Arnaldo Carvalho de Melo [this message]
2016-02-18 14:36 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160218142727.GD9909@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=steven@uplinklabs.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.