From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afI1C-0007lG-2T for qemu-devel@nongnu.org; Sun, 13 Mar 2016 22:14:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afI18-00084j-PO for qemu-devel@nongnu.org; Sun, 13 Mar 2016 22:14:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afI18-00084Z-Js for qemu-devel@nongnu.org; Sun, 13 Mar 2016 22:13:58 -0400 Date: Mon, 14 Mar 2016 10:13:56 +0800 From: Fam Zheng Message-ID: <20160314021356.GD2112@ad.usersys.redhat.com> References: <20160210102337.GE7317@stefanha-x1.localdomain> <56BB2FB3.2070809@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] Tracking the VM making an IO request List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Aarian P. Aleahmad" Cc: Paolo Bonzini , qemu-devel@nongnu.org, 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 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 > >