kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [RFC][PATCH] KVM: perf: a smart tool to analyse kvm events
Date: Mon, 16 Jan 2012 21:49:44 -0700	[thread overview]
Message-ID: <4F14FDE8.6000805@gmail.com> (raw)
In-Reply-To: <4F14DFBC.7050908@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1037 bytes --]


On 01/16/2012 07:41 PM, Xiao Guangrong wrote:
>> Have you thought about dumping a time history -- something similar to
>> what perf-script can do with dumping events but adding in kvm-specific
>> analysis like what you are doing in these examples?
>>
> 
> 
> I will look into it and put it to my todo list if it is possible.
> Thanks, David!
> 

I've played around with ways to do it as time (and motivation) allowed.
Attached is one example using perf with the trace-cmd plugin plus a
patch on perf-script to dump time between events:

perf record -e kvm:* -fo /tmp/perf.data -p 2540 -- sleep 1
perf script -i /tmp/perf.data

The output of perf-script is in the attached file. The 5th column is the
dt between successive events which is mainly a convenience.

A perf-kvm-events type command would allow more customization in the
output -- like correlating specific events and computing total time
between exit and entry accounting for HLT reasons -- as well as various
statistical dumps (average, stddev, max/min, histograms).

David


[-- Attachment #2: kvm-trace-example.txt --]
[-- Type: text/plain, Size: 2525 bytes --]


qemu-kvm  2542 [001] 20757.662426  0.000001 kvm_cr: cr_write 3 = 0x6f3000
qemu-kvm  2542 [001] 20757.662430  0.000004 kvm_entry: vcpu 0
qemu-kvm  2542 [001] 20757.662432  0.000002 kvm_exit: reason IO_INSTRUCTION rip 0x806d8dbc info b008000b 0

qemu-kvm  2542 [001] 20757.662434  0.000002 kvm_emulate_insn: 0:806d8dbc: ed
qemu-kvm  2542 [001] 20757.662435  0.000001 kvm_pio: pio_read at 0xb008 size 4 count 1
qemu-kvm  2542 [001] 20757.662436  0.000001 kvm_userspace_exit: reason KVM_EXIT_IO (2)
qemu-kvm  2542 [001] 20757.662442  0.000006 kvm_entry: vcpu 0
qemu-kvm  2542 [001] 20757.662444  0.000002 kvm_exit: reason HLT rip 0xf770fd3d info 0 0

qemu-kvm  2540 [000] 20757.666479  0.004287 kvm_set_irq: gsi 9 level 1 source 0
qemu-kvm  2540 [000] 20757.666481  0.000002 kvm_pic_set_irq: chip 1 pin 1 (edge|masked)
qemu-kvm  2540 [000] 20757.666482  0.000001 kvm_apic_accept_irq: apicid 0 vec 177 (LowPrio|level)
qemu-kvm  2540 [000] 20757.666485  0.000003 kvm_ioapic_set_irq: pin 9 dst 1 vec=177 (LowPrio|logical|level)

qemu-kvm  2542 [001] 20757.666505  0.004061 kvm_inj_virq: irq 177
qemu-kvm  2542 [001] 20757.666506  0.000001 kvm_entry: vcpu 0
qemu-kvm  2542 [001] 20757.666512  0.000006 kvm_exit: reason IO_INSTRUCTION rip 0x806d88ca info b0000009 0

qemu-kvm  2542 [001] 20757.666516  0.000004 kvm_emulate_insn: 0:806d88ca: 66 ed
qemu-kvm  2542 [001] 20757.666517  0.000001 kvm_pio: pio_read at 0xb000 size 2 count 1
qemu-kvm  2542 [001] 20757.666519  0.000002 kvm_userspace_exit: reason KVM_EXIT_IO (2)
qemu-kvm  2542 [001] 20757.666528  0.000009 kvm_entry: vcpu 0
qemu-kvm  2542 [001] 20757.666531  0.000003 kvm_exit: reason IO_INSTRUCTION rip 0x806d88be info afe00008 0

qemu-kvm  2542 [001] 20757.666534  0.000003 kvm_emulate_insn: 0:806d88be: ec
qemu-kvm  2542 [001] 20757.666535  0.000001 kvm_pio: pio_read at 0xafe0 size 1 count 1
qemu-kvm  2542 [001] 20757.666537  0.000002 kvm_userspace_exit: reason KVM_EXIT_IO (2)
qemu-kvm  2542 [001] 20757.666544  0.000007 kvm_entry: vcpu 0
qemu-kvm  2542 [001] 20757.666547  0.000003 kvm_exit: reason IO_INSTRUCTION rip 0x806d88be info afe10008 0

qemu-kvm  2542 [001] 20757.666550  0.000003 kvm_emulate_insn: 0:806d88be: ec
qemu-kvm  2542 [001] 20757.666551  0.000001 kvm_pio: pio_read at 0xafe1 size 1 count 1
qemu-kvm  2542 [001] 20757.666552  0.000001 kvm_userspace_exit: reason KVM_EXIT_IO (2)
qemu-kvm  2542 [001] 20757.666558  0.000006 kvm_entry: vcpu 0
qemu-kvm  2542 [001] 20757.666562  0.000004 kvm_exit: reason IO_INSTRUCTION rip 0x806d8934 info b0000001 0


      reply	other threads:[~2012-01-17  4:49 UTC|newest]

Thread overview: 25+ 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
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 [this message]

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=4F14FDE8.6000805@gmail.com \
    --to=dsahern@gmail.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=xiaoguangrong@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).