From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55352 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtlAi-0000CE-MY for qemu-devel@nongnu.org; Sun, 27 Feb 2011 13:16:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PtlAh-000845-GE for qemu-devel@nongnu.org; Sun, 27 Feb 2011 13:16:44 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:61368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PtlAh-000841-7U for qemu-devel@nongnu.org; Sun, 27 Feb 2011 13:16:43 -0500 Received: by wyb29 with SMTP id 29so3227934wyb.4 for ; Sun, 27 Feb 2011 10:16:38 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4D6A9502.1030100@redhat.com> Date: Sun, 27 Feb 2011 19:16:34 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1298818682-5404-1-git-send-email-stefanha@linux.vnet.ibm.com> <4D6A6A08.8000300@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] simpletrace: Thread-safe tracing List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Prerna Saxena On 02/27/2011 06:02 PM, Stefan Hajnoczi wrote: > On Sun, Feb 27, 2011 at 3:13 PM, Paolo Bonzini wrote: >> On 02/27/2011 03:58 PM, Stefan Hajnoczi wrote: >>> >>> + * Trace records are written out by a dedicated thread. The thread waits >>> for >>> + * records to become available, writes them out, and then waits again. >>> + */ >>> +static pthread_mutex_t trace_lock = PTHREAD_MUTEX_INITIALIZER; >>> +static pthread_cond_t trace_available_cond = PTHREAD_COND_INITIALIZER; >>> +static pthread_cond_t trace_empty_cond = PTHREAD_COND_INITIALIZER; >>> +static bool trace_available; >>> +static bool trace_writeout_enabled; >> >> Please use QemuThread. > > The tracing code itself should use avoid core QEMU code. Otherwise we > can't trace QemuThread - we'd have an infinite loop. Hmm, right... they'll use stdio to trace Win32 then... :) I was actually thinking more of the code duplication. But do you really need tracing at such a low level? I'd expect tracing wrappers like qemu_lock_mutex_iothread, not mutexes in general. Paolo