From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAhR6-0001vI-F3 for qemu-devel@nongnu.org; Tue, 04 Feb 2014 09:57:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAhQy-0002Rs-1E for qemu-devel@nongnu.org; Tue, 04 Feb 2014 09:57:16 -0500 Received: from mail-qc0-x22c.google.com ([2607:f8b0:400d:c01::22c]:38847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAhQx-0002RN-TK for qemu-devel@nongnu.org; Tue, 04 Feb 2014 09:57:07 -0500 Received: by mail-qc0-f172.google.com with SMTP id c9so13585535qcz.17 for ; Tue, 04 Feb 2014 06:57:07 -0800 (PST) Sender: Richard Henderson Message-ID: <52F0FFBD.8050801@twiddle.net> Date: Tue, 04 Feb 2014 06:57:01 -0800 From: Richard Henderson MIME-Version: 1.0 References: <20140131160902.32741.2680.stgit@fimbulvetr.bsc.es> In-Reply-To: <20140131160902.32741.2680.stgit@fimbulvetr.bsc.es> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: =?UTF-8?B?TGx1w61zIFZpbGFub3Zh?= , qemu-devel@nongnu.org Cc: Stefan Hajnoczi On 01/31/2014 08:09 AM, LluĂ­s Vilanova wrote: > Adds the base ability to specify which events in the "trace-events" file may be > used to trace guest activity in the TCG code (using the "tcg" event propery). > > Such events generate an extra set of tracing functions that can be called during > TCG code generation and will automatically redirect a call to the appropriate > backend-dependent tracing functions when the guest code is executed. > > Files generating guest code (TCG) must include "trace-tcg.h". Files declaring > per-target helpers ("${target}/helper.h") must include > "trace/generated-helpers.h". > > The flow of the generated routines is: > > > [At translation time] > > * trace_${name}_tcg(bool, TCGv) > Declared: "trace/generated-tcg-tracers.h" > Defined : "trace/generated-tcg-tracers.h" > > * gen_helper_trace_${name}_tcg(bool, TCGv) > Declared: "trace/generated-helpers.h" > Defined : "trace/generated-helpers.h" > > Automatically transforms all the arguments and allocates them into the > appropriate TCG temporary values (which are also freed). Provides a more > streamlined interface by allowing events in "trace-events" to take a mix of > tracing-supported types and TCG types. > > * gen_helper_trace_${name}_tcg_proxy(TCGi32, TCGv) > Declared: "trace/generated-helpers.h" > Defined : "trace/generated-helpers.h" (using helper machinery) > > The actual TCG helper function, created using QEMU's TCG helper machinery. 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. If I read these patches right -- and since they're mostly python I'm not sure that I am -- we go through 5 layers of wrappers to get to the current trace_foo expansion. Where trace_foo contains the check to see whether the tracepoint is actually enabled. I would strongly suggest this is backward. One should perform the check for the tracepoint being enabled at translation time before emitting the call to the helper in the first place. r~