From: David Ahern <dsahern@gmail.com>
To: Brendan Gregg <brendan.d.gregg@gmail.com>,
"linux-perf-use." <linux-perf-users@vger.kernel.org>
Subject: Re: perf CPU profiling in Xen guest fail & workaround
Date: Wed, 29 Jul 2015 13:15:45 -0600 [thread overview]
Message-ID: <55B92661.7010309@gmail.com> (raw)
In-Reply-To: <CAE40pdd6Ab9w1da7ztwed+h9NUbtLyqiC1-tarrGQsFo2MrmzQ@mail.gmail.com>
On 7/29/15 1:04 PM, Brendan Gregg wrote:
> G'Day perf users,
>
> I just debugged something and wanted to share in case others hit
> this... perf CPU profiling didn't work for this Linux 4.1 guest (AWS
> EC2):
>
> # ./perf record -F 99 -a -g -- sleep 5
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.300 MB perf.data ]
> # ./perf script
> #
>
> There are no CPU samples recorded (perf.data just has
> PERF_RECORD_MMAP, etc). I believe it's because it's using the "cycles"
> PMC event, and not "cpu-clock". And cycles is bogus:
>
> # ./perf stat -e cycles -a sleep 1 2>&1 | grep cycles
> 68,719,476,704 cycles
> # ./perf stat -e cycles -a sleep 2 2>&1 | grep cycles
> 68,719,476,704 cycles
>
> I can fix it by profiling cpu-clock:
>
> # ./perf record -e cpu-clock -a -g -- sleep 5
> [ perf record: Woken up 27 times to write data ]
> [ perf record: Captured and wrote 9.884 MB perf.data (105989 samples) ]
> # ./perf script
> [...data...]
>
> Which is what I think all my other systems are doing anyway; some perf
> -v -v output from those other systems:
>
> [...]
> sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8
> sys_perf_event_open failed, error -2
> Warning:
> The cycles event is not supported, trying to fall back to cpu-clock-ticks
> [...]
>
> This 4.1 system has these:
>
> # cat /sys/devices/cpu/events/cpu-cycles
> event=0x3c
>
> Which other systems don't. Profiling these (eg, -e r003c) also doesn't work.
>
> So I can use "-e cpu-clock", which is fine. It even lets me set the
> profile frequency:
>
> # ./perf record -F 99 -e cpu-clock -a -- sleep 1
>
> Maybe this issue is already known and fixed in latest. I couldn't find
> anything in a search...
>
It's a known problem with VMs (Solaris based ldoms and apparently xen
guests as examples). The hypervisor tells perf it has a PMU (see dmesg |
grep Performance) but does not really implement it (no NMIs for example).
David
next prev parent reply other threads:[~2015-07-29 19:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 19:04 perf CPU profiling in Xen guest fail & workaround Brendan Gregg
2015-07-29 19:15 ` David Ahern [this message]
2015-07-29 19:27 ` Brendan Gregg
2015-07-29 20:02 ` David Ahern
2015-07-29 22:21 ` Andi Kleen
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=55B92661.7010309@gmail.com \
--to=dsahern@gmail.com \
--cc=brendan.d.gregg@gmail.com \
--cc=linux-perf-users@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox