Received: from eggs.gnu.org ([2001:4830:134:3::10]:34918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAmr1-0008FQ-Gr for qemu-devel@nongnu.org; Tue, 04 Feb 2014 15:44:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAmqr-0001Ro-Sp for qemu-devel@nongnu.org; Tue, 04 Feb 2014 15:44:23 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:48527 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAmqr-0001Qv-HS for qemu-devel@nongnu.org; Tue, 04 Feb 2014 15:44:13 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <20140131160902.32741.2680.stgit@fimbulvetr.bsc.es> <52F0FFBD.8050801@twiddle.net> <52F10482.8010808@twiddle.net> Date: Tue, 04 Feb 2014 21:44:08 +0100 In-Reply-To: <52F10482.8010808@twiddle.net> (Richard Henderson's message of "Tue, 04 Feb 2014 07:17:22 -0800") Message-ID: <87d2j2txpj.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 00/12] trace: [tcg] Allow tracing guest events in TCG-generated code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Peter Maydell , QEMU Developers , Stefan Hajnoczi Richard Henderson writes: > On 02/04/2014 07:02 AM, Peter Maydell wrote: >> On 4 February 2014 14:57, Richard Henderson wrote: >>> I suppose I have no major objection to the feature, although frankly it's >>> not especially exciting. I can't really imagine ever wanting to bulk trace >>> all of the helpers. Tracing specific helpers on a target-by-target basis, >>> sure. But that can be done just as easily as adding tracing code to any >>> other bit of C. >> >> I think the things people seem to actually want (judging >> from occasional postings to the list) are things like: >> * trace all guest memory accesses >> * trace all guest instruction executions >> >> Does this patchset get us usefully towards that kind of thing? >> Not sure... > If that's the goal, I would suggest that they do not. One does not need to > hook all of the helpers in order to achieve that. > A hook in tcg_gen_qemu_{ld,st}_i{32,64} to (conditionally) emit a call to a > helper to log the access gets you all (non-execution) guest memory accesses. That's what this series does, but in a generic way so that you can trace any event that is "identified" at translation time (i.e., when calling 'trace_foo_tcg', like 'trace_guest_vmem_tcg' in the last patch). > Guest instruction executions is quite a bit harder, of course. But any start > in that direction could be done through a pair of trace events: Log the insn > address range covered by a TB + a uuid at translation time; log the uuid at the > start of execution of the TB. A script should be able to put the two together > to complete the trace. Right, that's a common approach to have a much more compact trace (people usually call it BBL dictionary). I could extend the patches so that calling 'trace_foo_tcg' also generated a traceable event. This way every event could be traced at translation and/or execution time. Thus adding this on "trace-events": tcg foo(...) "..." Would be equivalent to: foo(...) "..." foo_tcg(...) "..." If you enable the "foo_tcg" event, you'll see traces from translation time (calls to 'trace_foo_tcg'). If you enable the "foo" event, 'trace_foo_tcg' will generate a call to 'trace_foo', and thus you'll see traces from execution time. Does this make sense? Thanks, Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth