Received: from eggs.gnu.org ([2001:4830:134:3::10]:56537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiMtM-0006Zx-1u for qemu-devel@nongnu.org; Tue, 22 Mar 2016 10:02:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiMtH-0002jc-Sj for qemu-devel@nongnu.org; Tue, 22 Mar 2016 10:02:40 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:34083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiMtH-0002il-H7 for qemu-devel@nongnu.org; Tue, 22 Mar 2016 10:02:35 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <145625172744.12025.2350972792125742783.stgit@localhost> <20160302105553.GB11268@stefanha-x1.localdomain> <20160322125502.GH29248@stefanha-x1.localdomain> Date: Tue, 22 Mar 2016 15:02:29 +0100 In-Reply-To: <20160322125502.GH29248@stefanha-x1.localdomain> (Stefan Hajnoczi's message of "Tue, 22 Mar 2016 12:55:02 +0000") Message-ID: <877fgud30q.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 0/5] trace: Add events for vCPU memory accesses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Peter Maydell , Richard Henderson , QEMU Developers , Stefan Hajnoczi Stefan Hajnoczi writes: > On Wed, Mar 16, 2016 at 03:10:01PM +0000, Peter Maydell wrote: >> On 2 March 2016 at 10:55, Stefan Hajnoczi wrote: >> > On Tue, Feb 23, 2016 at 07:22:07PM +0100, Llu=C3=ADs Vilanova wrote: >> >> NOTE: This series applies on top of "trace: Show vCPU info in guest c= ode events" >> >> >> >> This series adds to new events: >> >> >> >> * guest_vmem: memory accesses performed by vCPUs (guest code) >> >> >> >> * guest_vmem_user_syscall: memory accesses performed by syscall emula= tion when >> >> running QEMU in user-mode. >> >> >> >> Signed-off-by: Llu=C3=ADs Vilanova >> >> --- >> >> >> >> Llu=C3=ADs Vilanova (5): >> >> exec: [tcg] Track which vCPU is performing translation and exec= ution >> >> trace: [all] Add "guest_vmem" event >> >> user: Refactor lock_user body into do_lock_user >> >> user: Set current vCPU during syscall execution >> >> trace: [all] Add "guest_vmem_user_syscall" event >>=20 >> > Any comments from TCG folks? >>=20 >> The first two patches which add TCG guest data access tracing look >> OK to me, but I'm much less sure about the last three which are >> adding tracing into linux-user syscall emulation. I'm not sure >> that lock_user is the right place to put that tracepoint. > Any thoughts on this, Llu=C3=ADs? Mmmm, I was struggling to find a place to easily add the tracing events whe= never the syscall emulation code accesses guest memory. The lock_user function is used precisely for that, but it can be a bit heavy-handed as to what memory is actually read/written, since it only mark= s the "potential" ability of doing so (it's a sort of acquire/release interface t= hat differentiates between read and write acquires). So, while it's not the perfect place to do it, I think it's the best one we= have now. Having calls to both lock_user and trace_guest_vmem_user_syscall in sy= scall emulation code should be avoided to keep the code cleaner. Thanks, Lluis