From: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH 3/3] KVM: perf: kvm events analysis tool
Date: Tue, 17 Jan 2012 10:30:17 +0800 [thread overview]
Message-ID: <4F14DD39.5000703@linux.vnet.ibm.com> (raw)
In-Reply-To: <4F13F631.9010804@redhat.com>
On 01/16/2012 06:04 PM, Avi Kivity wrote:
> On 01/16/2012 11:32 AM, Xiao Guangrong wrote:
>> Add 'perf kvm-events' support to analyze kvm vmexit/mmio/ioport smartly
>>
>> Usage:
>> perf kvm-events record
>
> Why not 'perf record -e kvm'?
It works, many perf tools have this style, like:
perf lock record,
perf sched record,
perf kmem record,
I think the reason is that only enable the tracepoints we need to avoid
unnecessary overload so that the result is more exacter.
>
>> perf kvm-events report
>
>
>
>> +static const char *get_exit_reason(long isa, u64 exit_code)
>> +{
>> + int table_size = ARRAY_SIZE(svm_exit_reasons);
>> + struct exit_reasons_table *table = svm_exit_reasons;
>> +
>> +
>> + if (isa == 1) {
>> + table = vmx_exit_reasons;
>> + table_size = ARRAY_SIZE(vmx_exit_reasons);
>> + }
>> +
>> + while (table_size--) {
>> + if (table->exit_code == exit_code)
>> + return table->reason;
>
> ... table[exit_code] ...
>
Actually, this array is not indexed by exit_code, it means:
table[exit_code].exit_code != exit_code.
>> + table++;
>> + }
>> +
>> + die("unkonw kvm exit code:%ld on %s\n", exit_code, isa == 1 ?
>> + "VMX" : "SVM");
>
> "unknown"
>
......
>> +
>> +struct kvm_events_ops {
>> + bool (*is_begain_event)(struct event *event, void *data);
>
> begin
>
Sorry for my careless.
>> + bool (*is_end_event)(struct event *event);
>> + struct event_key (*get_key)(struct event *event, void *data);
>> + void (*decode_key)(struct event_key *key, char decode[20]);
>> + const char *name;
>> +};
>> +
>> +
>> +static struct event_key exit_event_get_key(struct event *event, void *data)
>> +{
>> + struct event_key key;
>> +
>> + key.key = raw_field_value(event, "exit_reason", data);
>> + key.info = raw_field_value(event, "isa", data);
>
> "isa" is not available on all kernel versions; need to fall back to
> /proc/cpuid detection.
>
Got it, will do it in the next version. Thanks Avi!
next prev parent reply other threads:[~2012-01-17 2:30 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 9:30 [RFC][PATCH] KVM: perf: a smart tool to analyse kvm events Xiao Guangrong
2012-01-16 9:31 ` [PATCH 1/3] KVM: trace mmio read event properly Xiao Guangrong
2012-01-16 10:18 ` Avi Kivity
2012-01-17 2:36 ` Xiao Guangrong
2012-01-16 9:32 ` [PATCH 2/3] KVM: improve trace events of vmexit/mmio/ioport Xiao Guangrong
2012-01-16 9:38 ` Avi Kivity
2012-01-17 2:28 ` Xiao Guangrong
2012-01-17 11:55 ` Marcelo Tosatti
2012-01-17 17:31 ` David Ahern
2012-01-18 2:32 ` Xiao Guangrong
2012-01-18 5:34 ` David Ahern
2012-01-24 12:44 ` Avi Kivity
2012-01-16 9:32 ` [PATCH 3/3] KVM: perf: kvm events analysis tool Xiao Guangrong
2012-01-16 10:04 ` Avi Kivity
2012-01-17 2:30 ` Xiao Guangrong [this message]
2012-01-24 12:49 ` Avi Kivity
2012-01-16 10:08 ` Stefan Hajnoczi
2012-01-17 2:37 ` Xiao Guangrong
2012-01-17 11:59 ` Marcelo Tosatti
2012-01-24 12:51 ` Avi Kivity
2012-01-16 10:11 ` [RFC][PATCH] KVM: perf: a smart tool to analyse kvm events Avi Kivity
2012-01-17 2:30 ` Xiao Guangrong
2012-01-16 22:53 ` David Ahern
2012-01-17 2:41 ` Xiao Guangrong
2012-01-17 4:49 ` David Ahern
-- strict thread matches above, loose matches on Subject: below --
2012-02-09 9:06 [PATCH v4 0/3] KVM: perf: kvm events analysis tool Xiao Guangrong
2012-02-09 9:09 ` [PATCH 3/3] " Xiao Guangrong
2012-02-13 3:04 ` David Ahern
2012-02-13 5:00 ` Xiao Guangrong
2012-02-20 23:47 ` David Ahern
2012-02-21 3:52 ` Xiao Guangrong
2012-02-21 4:58 ` David Ahern
2012-02-27 4:57 ` Xiao Guangrong
2012-02-13 5:32 David Ahern
2012-02-13 5:32 ` David Ahern
2012-02-13 10:06 ` Xiao Guangrong
2012-02-13 15:52 ` David Ahern
2012-02-16 4:59 ` Xiao Guangrong
2012-02-16 5:05 ` David Ahern
2012-02-16 5:33 ` Xiao Guangrong
2012-02-16 16:35 ` Arnaldo Carvalho de Melo
2012-03-06 8:55 [PATCH v5 0/3] " Xiao Guangrong
2012-03-06 8:58 ` [PATCH 3/3] " Xiao Guangrong
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=4F14DD39.5000703@linux.vnet.ibm.com \
--to=xiaoguangrong@linux.vnet.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.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 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.