From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, hemant@linux.vnet.ibm.com,
naveen.n.rao@linux.vnet.ibm.com
Subject: Re: [RFC 1/4] perf kvm: Enable 'record' on powerpc
Date: Tue, 22 Mar 2016 16:12:11 -0300 [thread overview]
Message-ID: <20160322191211.GD25862@kernel.org> (raw)
In-Reply-To: <1456304865-15131-2-git-send-email-ravi.bangoria@linux.vnet.ibm.com>
Em Wed, Feb 24, 2016 at 02:37:42PM +0530, Ravi Bangoria escreveu:
> 'perf kvm record' is not available on powerpc because 'perf' relies on
> the 'cycles' event (a PMU event) to profile the guest. However, for
> powerpc, this can't be used from the host because the PMUs are controlled
> by the guest rather than the host.
>
> There exists a tracepoint 'kvm_hv:kvm_guest_exit' in powerpc which is
> hit whenever any of the threads exit the guest context. The guest
> instruction pointer dumped along with this tracepoint data in the field
> 'pc', can be used as guest instruction pointer.
>
> This patch changes default event as kvm_hv:kvm_guest_exit for recording
> guest data in host on powerpc. As we are using host event to record guest
> data, this approach will enable only --guest option of 'perf kvm'. Still
> --host --guest together won't work.
It should, i.e. --host --guest should translate to:
-e cycles:H,kvm_hv:kvm_guest_exit
I.e. both collect cycles only in the host, and also the tracepoint that
will allow us to get the guest approximation for the unavailable cycles
event, no?
I'm putting the infrastructure work needed for this the perf/cpumode
branch. More work will be put there soon.
I didn't like the fact that this was touching the common code too much,
so I'm providing infrastructure for the evsel to be used to obtain the
cpumode, but trying to constrain the kvm specific bits.
I.e. we should not touch perf_evlist__add_default, but instead replace
"cycles" with what is appropriate for 'perf kvm record' when that event
is specified, be it explicitely or not.
Doing it this way I _think_ we'll be able to remove the limitation
stated on your last paragraph above ("Still --host --guest together
won't work").
I.e. this, but automatically:
[root@jouet ~]# perf kvm record -a -e cycles:H,kvm:kvm_exit
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.428 MB perf.data.guest (1644
samples) ]
[root@jouet ~]#
[root@jouet ~]# perf evlist -i perf.data.guest
cycles:H
kvm:kvm_exit
# Tip: use 'perf evlist --trace-fields' to show fields for tracepoint
# events
[root@jouet ~]#
If we look at the verbose output:
[root@jouet ~]# perf evlist -v -i perf.data.guest
cycles:H: size: 112, { sample_period, sample_freq }: 4000, sample_type:
IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID, disabled: 1,
inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1,
exclude_guest: 1, mmap2: 1, comm_exec: 1
kvm:kvm_exit: type: 2, size: 112, config: 0x596, { sample_period,
sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER,
read_format: ID, disabled: 1, inherit: 1, sample_id_all: 1,
exclude_host: 1
# Tip: use 'perf evlist --trace-fields' to show fields for tracepoint
# events
[root@jouet ~]#
----------------------------------------------------------------------------
Which works as well with:
[root@jouet ~]# perf kvm --guest --host record -a -e cycles:H,kvm:kvm_exit
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.387 MB perf.data.kvm (1090 samples)
]
[root@jouet ~]# perf evlist -v -i perf.data.kvm
cycles:H: size: 112, { sample_period, sample_freq }: 4000, sample_type:
IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID, disabled: 1,
inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1,
exclude_guest: 1, mmap2: 1, comm_exec: 1
kvm:kvm_exit: type: 2, size: 112, config: 0x596, { sample_period,
sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER,
read_format: ID, disabled: 1, inherit: 1, sample_id_all: 1
# Tip: use 'perf evlist --trace-fields' to show fields for tracepoint
# events
[root@jouet ~]#
----------------------------------------------------------------------------
Comments?
- Arnaldo
next prev parent reply other threads:[~2016-03-22 19:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 9:07 [RFC 0/4] perf kvm: Guest Symbol Resolution for powerpc Ravi Bangoria
2016-02-24 9:07 ` [RFC 1/4] perf kvm: Enable 'record' on powerpc Ravi Bangoria
2016-03-22 19:12 ` Arnaldo Carvalho de Melo [this message]
2016-03-23 2:19 ` Arnaldo Carvalho de Melo
2016-03-24 21:15 ` Arnaldo Carvalho de Melo
2016-03-28 10:58 ` Ravi Bangoria
2016-03-28 12:28 ` Arnaldo Carvalho de Melo
2016-04-27 12:32 ` Ravi Bangoria
2016-04-27 21:47 ` Arnaldo Carvalho de Melo
2016-05-09 14:58 ` Ravi Bangoria
2016-02-24 9:07 ` [RFC 2/4] perf kvm: Introduce evsel as argument to perf_event__preprocess_sample Ravi Bangoria
2016-02-24 9:07 ` [RFC 3/4] perf kvm: Enable 'report' on powerpc Ravi Bangoria
2016-02-24 9:07 ` [RFC 4/4] perf kvm: Fix output fields instead of 'trace' for perf kvm report " Ravi Bangoria
2016-03-02 14:25 ` Arnaldo Carvalho de Melo
2016-03-02 15:46 ` Ravi Bangoria
2016-03-02 16:22 ` Arnaldo Carvalho de Melo
2016-03-03 1:19 ` Ravi Bangoria
2016-03-08 15:42 ` Ravi Bangoria
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=20160322191211.GD25862@kernel.org \
--to=acme@kernel.org \
--cc=hemant@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=ravi.bangoria@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).