From patchwork Tue Feb 23 18:22:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 8395391 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 96829C0553 for ; Tue, 23 Feb 2016 18:26:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC390202EC for ; Tue, 23 Feb 2016 18:26:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3815A202E6 for ; Tue, 23 Feb 2016 18:26:13 +0000 (UTC) Received: from localhost ([::1]:59182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYHf2-0006j8-LY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 23 Feb 2016 13:26:12 -0500 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 Received: from gw-3.ac.upc.es (gw-3.ac.upc.es [147.83.30.9]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u1NIMaQw000916; Tue, 23 Feb 2016 19:22:36 +0100 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id CE15A7EF; Tue, 23 Feb 2016 19:22:35 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Tue, 23 Feb 2016 19:22:35 +0100 Message-Id: <145625175544.12025.6418420646368097245.stgit@localhost> X-Mailer: git-send-email 2.7.0 In-Reply-To: <145625172744.12025.2350972792125742783.stgit@localhost> References: <145625172744.12025.2350972792125742783.stgit@localhost> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id u1NIMaQw000916 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Cc: Blue Swirl , Riku Voipio , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 5/5] trace: [all] Add "guest_vmem_user_syscall" event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: LluĂ­s 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 == 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 without */ + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, false); + } return do_lock_user(type, guest_addr, len, copy); } 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 == 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 without */ + trace_guest_vmem_user_syscall(current_cpu, guest_addr, len, false); + } return do_lock_user(type, guest_addr, len, copy); } 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 ret, int status) "Command abort # # Targets: TCG(all) disable vcpu tcg guest_vmem(TCGv vaddr, uint8_t size, uint8_t store) "size=%d store=%d", "vaddr=0x%016"PRIx64" size=%d store=%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 code when +# running in user-mode. +# +# Targets: TCG(all) +disable vcpu guest_vmem_user_syscall(uint64_t vaddr, uint64_t size, uint8_t store) "vaddr=0x%016"PRIx64" size=%"PRIu64" store=%d"