Am 23.03.2011 um 21:42 schrieb Andreas Färber:
Am 23.03.2011 um 08:39 schrieb Stefan Hajnoczi:
On Tue, Mar 22, 2011 at 11:52 PM, Andreas Färber <andreas.faer...@web.de
> 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 <stefa...@linux.vnet.ibm.com>
---
v2:
* 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:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html#Atomic-Builtins
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.
Indeed it compiles with --cc=gcc-4.2 --host-cc=gcc-4.2:
powerpc-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5577)
Copyright (C) 2007 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.
Still I would generally advise against requiring the latest and
greatest GCC.
Unfortunately compiling GLib from scratch (e.g., on Haiku) can be a
lot of work, too. The Mono folks abandoned it again in favor of their
own stripped-down GLib-compatible eglib implementation.
Andreas