qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Tracking the VM making an IO request
@ 2016-02-10  9:05 Aarian P. Aleahmad
  2016-02-10 10:23 ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Aarian P. Aleahmad @ 2016-02-10  9:05 UTC (permalink / raw)
  To: qemu-devel

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

Hi there

I'm a student, engaged in a project in which QEMU is a candidate to be used
to make some studies about IO usage etc.
I need to track the IO requests made to the block devices (e.g. HDD, SSD,
etc.). I check the source code but I was confused. What I want to know is
that when an IO request is made, find out that which on of the VMs has made
that request. I'll thank you if you help me on this issue.

Sincerely Yours,
Aarian

[-- Attachment #2: Type: text/html, Size: 533 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Tracking the VM making an IO request
  2016-02-10  9:05 [Qemu-devel] Tracking the VM making an IO request Aarian P. Aleahmad
@ 2016-02-10 10:23 ` Stefan Hajnoczi
  2016-02-10 12:40   ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2016-02-10 10:23 UTC (permalink / raw)
  To: Aarian P. Aleahmad; +Cc: qemu-devel

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

On Wed, Feb 10, 2016 at 12:35:54PM +0330, Aarian P. Aleahmad wrote:
> I'm a student, engaged in a project in which QEMU is a candidate to be used
> to make some studies about IO usage etc.
> I need to track the IO requests made to the block devices (e.g. HDD, SSD,
> etc.). I check the source code but I was confused. What I want to know is
> that when an IO request is made, find out that which on of the VMs has made
> that request. I'll thank you if you help me on this issue.

There are trace events that you can use.  See docs/tracing.txt and
trace-events.

virtio_blk_handle_write and virtio_blk_handle_read can be used if your
guest has virtio-blk.

The QEMU block layer also has trace events named bdrv_aio_*.

Or you could use blktrace(8) in the guest or on the host, depending on
how you've set up storage.

Finally, if you prefer you could set up an iSCSI or NBD target and
simply use Wireshark to record and analyze the I/O request patterns.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Tracking the VM making an IO request
  2016-02-10 10:23 ` Stefan Hajnoczi
@ 2016-02-10 12:40   ` Paolo Bonzini
  2016-03-12 12:47     ` Aarian P. Aleahmad
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2016-02-10 12:40 UTC (permalink / raw)
  To: Stefan Hajnoczi, Aarian P. Aleahmad; +Cc: qemu-devel



On 10/02/2016 11:23, Stefan Hajnoczi wrote:
> On Wed, Feb 10, 2016 at 12:35:54PM +0330, Aarian P. Aleahmad
> wrote:
>> I'm a student, engaged in a project in which QEMU is a candidate
>> to be used to make some studies about IO usage etc. I need to
>> track the IO requests made to the block devices (e.g. HDD, SSD, 
>> etc.). I check the source code but I was confused. What I want to
>> know is that when an IO request is made, find out that which on
>> of the VMs has made that request. I'll thank you if you help me
>> on this issue.
> 
> There are trace events that you can use.  See docs/tracing.txt and 
> trace-events.
> 
> virtio_blk_handle_write and virtio_blk_handle_read can be used if
> your guest has virtio-blk.
> 
> The QEMU block layer also has trace events named bdrv_aio_*.
> 
> Or you could use blktrace(8) in the guest or on the host, depending
> on how you've set up storage.

It's the third time I've gotten the question recently which makes me
believe the others were friends with Aarian...

Each QEMU process represents a single VM.  Therefore, it is simple to
answer the question "which VM is making the request"; the answer is
"the one for the QEMU process you are tracing".

You probably want to use blktrace if you care about multiple VMs.
Alternatively, you can use tracing as mentioned by Stefan.  If you
compile QEMU with --enable-trace-backend=simple, the resulting files
can be parsed with Python programs (see scripts/simpletrace.py).  The
trace files include the pid and a timestamp based on CLOCK_MONOTONIC,
so it should be easy to merge the traces together.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Tracking the VM making an IO request
  2016-02-10 12:40   ` Paolo Bonzini
@ 2016-03-12 12:47     ` Aarian P. Aleahmad
  2016-03-14  2:13       ` Fam Zheng
  0 siblings, 1 reply; 5+ messages in thread
From: Aarian P. Aleahmad @ 2016-03-12 12:47 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Stefan Hajnoczi, qemu-devel

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

Thanks for helping me. what should I do in case of using KVM?

On Wed, Feb 10, 2016 at 4:10 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:

>
>
> On 10/02/2016 11:23, Stefan Hajnoczi wrote:
> > On Wed, Feb 10, 2016 at 12:35:54PM +0330, Aarian P. Aleahmad
> > wrote:
> >> I'm a student, engaged in a project in which QEMU is a candidate
> >> to be used to make some studies about IO usage etc. I need to
> >> track the IO requests made to the block devices (e.g. HDD, SSD,
> >> etc.). I check the source code but I was confused. What I want to
> >> know is that when an IO request is made, find out that which on
> >> of the VMs has made that request. I'll thank you if you help me
> >> on this issue.
> >
> > There are trace events that you can use.  See docs/tracing.txt and
> > trace-events.
> >
> > virtio_blk_handle_write and virtio_blk_handle_read can be used if
> > your guest has virtio-blk.
> >
> > The QEMU block layer also has trace events named bdrv_aio_*.
> >
> > Or you could use blktrace(8) in the guest or on the host, depending
> > on how you've set up storage.
>
> It's the third time I've gotten the question recently which makes me
> believe the others were friends with Aarian...
>
> Each QEMU process represents a single VM.  Therefore, it is simple to
> answer the question "which VM is making the request"; the answer is
> "the one for the QEMU process you are tracing".
>
> You probably want to use blktrace if you care about multiple VMs.
> Alternatively, you can use tracing as mentioned by Stefan.  If you
> compile QEMU with --enable-trace-backend=simple, the resulting files
> can be parsed with Python programs (see scripts/simpletrace.py).  The
> trace files include the pid and a timestamp based on CLOCK_MONOTONIC,
> so it should be easy to merge the traces together.
>
> Paolo
>

[-- Attachment #2: Type: text/html, Size: 2432 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Tracking the VM making an IO request
  2016-03-12 12:47     ` Aarian P. Aleahmad
@ 2016-03-14  2:13       ` Fam Zheng
  0 siblings, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2016-03-14  2:13 UTC (permalink / raw)
  To: Aarian P. Aleahmad; +Cc: Paolo Bonzini, qemu-devel, Stefan Hajnoczi

On Sat, 03/12 16:17, Aarian P. Aleahmad wrote:
> Thanks for helping me. what should I do in case of using KVM?

The said method works exactly the same with or without -enable-kvm.

Fam

> 
> On Wed, Feb 10, 2016 at 4:10 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> >
> >
> > On 10/02/2016 11:23, Stefan Hajnoczi wrote:
> > > On Wed, Feb 10, 2016 at 12:35:54PM +0330, Aarian P. Aleahmad
> > > wrote:
> > >> I'm a student, engaged in a project in which QEMU is a candidate
> > >> to be used to make some studies about IO usage etc. I need to
> > >> track the IO requests made to the block devices (e.g. HDD, SSD,
> > >> etc.). I check the source code but I was confused. What I want to
> > >> know is that when an IO request is made, find out that which on
> > >> of the VMs has made that request. I'll thank you if you help me
> > >> on this issue.
> > >
> > > There are trace events that you can use.  See docs/tracing.txt and
> > > trace-events.
> > >
> > > virtio_blk_handle_write and virtio_blk_handle_read can be used if
> > > your guest has virtio-blk.
> > >
> > > The QEMU block layer also has trace events named bdrv_aio_*.
> > >
> > > Or you could use blktrace(8) in the guest or on the host, depending
> > > on how you've set up storage.
> >
> > It's the third time I've gotten the question recently which makes me
> > believe the others were friends with Aarian...
> >
> > Each QEMU process represents a single VM.  Therefore, it is simple to
> > answer the question "which VM is making the request"; the answer is
> > "the one for the QEMU process you are tracing".
> >
> > You probably want to use blktrace if you care about multiple VMs.
> > Alternatively, you can use tracing as mentioned by Stefan.  If you
> > compile QEMU with --enable-trace-backend=simple, the resulting files
> > can be parsed with Python programs (see scripts/simpletrace.py).  The
> > trace files include the pid and a timestamp based on CLOCK_MONOTONIC,
> > so it should be easy to merge the traces together.
> >
> > Paolo
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-14  2:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-10  9:05 [Qemu-devel] Tracking the VM making an IO request Aarian P. Aleahmad
2016-02-10 10:23 ` Stefan Hajnoczi
2016-02-10 12:40   ` Paolo Bonzini
2016-03-12 12:47     ` Aarian P. Aleahmad
2016-03-14  2:13       ` Fam Zheng

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).