qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 00/12] trace: [tcg] Allow tracing guest events i


From: Lluís Vilanova
Subject: Re: [Qemu-devel] [PATCH 00/12] trace: [tcg] Allow tracing guest events in TCG-generated code
Date: Tue, 04 Feb 2014 21:44:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Richard Henderson writes:

> On 02/04/2014 07:02 AM, Peter Maydell wrote:
>> On 4 February 2014 14:57, Richard Henderson <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]