lkml.org 
[lkml]   [2012]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/3] perf, tool: Force guest machine definition option
On 4/15/12 8:05 AM, Jiri Olsa wrote:
> how about the patch below? it ensures there's machine record for
> the guest. The segfault issue still stays..
>
> jirka
>
> ---
> Running 'perf kvm record' without any of following options:
> --guestmount
> --guestvmlinux
> --guestkallsyms
> --guestmodules
>
> is causing the guest machine to be ommited from the data file,
> and all guest samples are counted in nr_unprocessable_samples.
>
> This patch makes sure the 'perf kvm record' command is not
> let through if guest machine isn't defined.


Doesn't work: it requires a 'default' vmlinux/modules/kallsyms even when
a proper guestmount has been specified.

Today guestmount works for the report path because of the hook in
machines__findnew() which creates a machine on first lookup. Really, the
guestmount argument should not be required for the report which could be
using a local symbol tree (symfs argument) -- e.g., capture on a host OS
which could have kallsyms/module information for each VM / VM being
profiled and then report file taken to another system for analysis where
that system has access to symbols.

Perhaps what is needed is for the machine to be created for the pid ==
DEFAULT_GUEST_KERNEL_ID on first need. This is not the right place --
but shows the sentiment:

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 1efd3be..20420fc 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -824,6 +824,7 @@ static struct machine *
perf_session__find_machine_for_cpumode(struct perf_session *session,
union perf_event *event)
{
+ struct machine *mach;
const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;

if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) {
@@ -834,7 +835,10 @@ static struct machine *
else
pid = event->ip.pid;

- return perf_session__find_machine(session, pid);
+ mach = perf_session__find_machine(session, pid);
+ if (!mach && pid == 0)
+ mach = machines__add(&session->machines, pid, "/dev/null");
+ return mach;
}

return perf_session__find_host_machine(session);
So basically it allows kernel maps to be attached to a pid 0 machine but
that machine has no tree for further symbols. If nothing else perf-kvm
does not segfault.

I am seeing other problems with perf-kvm too. e.g.,
perf kvm --guest --host --guestmount /tmp/guestmount record -p 21234 --
sleep 10


Dumping the samples:
perf script -i perf.data.guest
--> shows no samples (2 'openssl speed' commands are running in the
2-vcpu guest so something should be generated)

perf script -i perf.data.kvm

Failed to open [guest.kernel.kallsyms.21234]_text, continuing without
symbols
qemu-kvm 21234 cycles: ffffffff8103edaa [unknown]
([guest.kernel.kallsyms.21234]_text)
Anyways, perf-kvm needs some love. Gotta run.

David


\
 
 \ /
  Last update: 2012-04-15 23:35    [W:0.054 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site