[Top][All Lists]

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

Re: [Qemu-devel] [PATCH] simpletrace: Thread-safe tracing

From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] simpletrace: Thread-safe tracing
Date: Wed, 23 Mar 2011 21:42:16 +0100

Am 23.03.2011 um 08:39 schrieb Stefan Hajnoczi:

On Tue, Mar 22, 2011 at 11:52 PM, Andreas Färber <address@hidden > wrote:
Am 28.02.2011 um 10:38 schrieb Stefan Hajnoczi:

Trace events outside the global mutex cannot be used with the simple
trace backend since it is not thread-safe. There is no check to prevent
them being enabled so people sometimes learn this the hard way.

This patch restructures the simple trace backend with a ring buffer
suitable for multiple concurrent writers. A writeout thread empties the
trace buffer when threshold fill levels are reached.  Should the
writeout thread be unable to keep up with trace generation, records will
simply be dropped.

Each time events are dropped a special record is written to the trace
file indicating how many events were dropped.  The event ID is
0xfffffffffffffffe and its signature is dropped(uint32_t count).

Signed-off-by: Stefan Hajnoczi <address@hidden>
* Add 'dropped' event so we know when events were lost.


+ __sync_synchronize(); /* read memory barrier before accessing record

Getting this at HEAD on Darwin/ppc64:

 CC    simpletrace.o
/Users/andreas/QEMU/qemu/simpletrace.c: In function ‘get_trace_record’: /Users/andreas/QEMU/qemu/simpletrace.c:81: warning: implicit declaration of
function ‘__sync_synchronize’
/Users/andreas/QEMU/qemu/simpletrace.c:81: warning: nested extern
declaration of ‘__sync_synchronize’
/Users/andreas/QEMU/qemu/simpletrace.c: In function ‘trace’:
/Users/andreas/QEMU/qemu/simpletrace.c:161: warning: implicit declaration of
function ‘__sync_fetch_and_add’
/Users/andreas/QEMU/qemu/simpletrace.c:161: warning: nested extern
declaration of ‘__sync_fetch_and_add’
 LINK  qemu-nbd
Undefined symbols:
 "___sync_fetch_and_add", referenced from:
     _trace in simpletrace.o
 "___sync_synchronize", referenced from:
     _get_trace_record in simpletrace.o
     _trace in simpletrace.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [qemu-nbd] Error 1

Haven't investigated further yet.

/me shakes his fist at Apple gcc!

Well, due to ppc I'm stuck at Leopard. Could be different on Snow Leopard...

These are gcc builtins, I believe the were added in gcc 4.1:

Which version of gcc are you running?

$ gcc --version
powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


reply via email to

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