Received: from eggs.gnu.org ([2001:4830:134:3::10]:34416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYHbi-0001g1-Lg for qemu-devel@nongnu.org; Tue, 23 Feb 2016 13:22:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYHbg-0006Z9-3I for qemu-devel@nongnu.org; Tue, 23 Feb 2016 13:22:46 -0500 Received: from roura.ac.upc.es ([147.83.33.10]:36355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYHbf-0006Yi-Ns for qemu-devel@nongnu.org; Tue, 23 Feb 2016 13:22:44 -0500 From: =?utf-8?b?TGx1w61z?= Vilanova Date: Tue, 23 Feb 2016 19:22:35 +0100 Message-Id: <145625175544.12025.6418420646368097245.stgit@localhost> In-Reply-To: <145625172744.12025.2350972792125742783.stgit@localhost> References: <145625172744.12025.2350972792125742783.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 5/5] trace: [all] Add "guest_vmem_user_syscall" event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , Riku Voipio , Stefan Hajnoczi Signed-off-by: Llu=C3=ADs Vilanova --- bsd-user/qemu.h | 10 ++++++++++ linux-user/qemu.h | 10 ++++++++++ trace-events | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 4dad254..090c09b 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -371,6 +371,16 @@ static inline void *do_lock_user(int type, abi_ulong= guest_addr, long len, int c host area will have the same contents as the guest. */ static inline void *lock_user(int type, abi_ulong guest_addr, long len, = int copy) { + if (type =3D=3D VERIFY_WRITE) { + if (copy) { + /* 'VERIFY_WRITE' implies read, but only with 'copy' */ + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, = false); + } + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, true= ); + } else { + /* should actually read only with 'copy', but a few places do wi= thout */ + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, fals= e); + } return do_lock_user(type, guest_addr, len, copy); } =20 diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 0b71683..3874cbd 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -395,6 +395,16 @@ static inline void *do_lock_user(int type, abi_ulong= guest_addr, long len, int c host area will have the same contents as the guest. */ static inline void *lock_user(int type, abi_ulong guest_addr, long len, = int copy) { + if (type =3D=3D VERIFY_WRITE) { + if (copy) { + /* 'VERIFY_WRITE' implies read, but only with 'copy' */ + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, = false); + } + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, true= ); + } else { + /* should actually read only with 'copy', but a few places do wi= thout */ + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, fals= e); + } return do_lock_user(type, guest_addr, len, copy); } =20 diff --git a/trace-events b/trace-events index 1088fe0..940b0ba 100644 --- a/trace-events +++ b/trace-events @@ -1903,3 +1903,13 @@ qio_channel_command_wait(void *ioc, int pid, int r= et, int status) "Command abort # # Targets: TCG(all) disable vcpu tcg guest_vmem(TCGv vaddr, uint8_t size, uint8_t store) "si= ze=3D%d store=3D%d", "vaddr=3D0x%016"PRIx64" size=3D%d store=3D%d" + +# @vaddr: Access' virtual address. +# @size : Access' size (bytes). +# @store: Whether the access is a store. +# +# Similar to 'guest_vmem' event, but raised inside syscall emulation cod= e when +# running in user-mode. +# +# Targets: TCG(all) +disable vcpu guest_vmem_user_syscall(uint64_t vaddr, uint64_t size, uint= 8_t store) "vaddr=3D0x%016"PRIx64" size=3D%"PRIu64" store=3D%d"