|
From: | Andreas Färber |
Subject: | Re: [Qemu-devel] [PATCH] simpletrace: Thread-safe tracing |
Date: | Wed, 23 Mar 2011 00:52:07 +0100 |
Am 28.02.2011 um 10:38 schrieb Stefan Hajnoczi:
Trace events outside the global mutex cannot be used with the simpletrace backend since it is not thread-safe. There is no check to preventthem being enabled so people sometimes learn this the hard way. This patch restructures the simple trace backend with a ring buffersuitable for multiple concurrent writers. A writeout thread empties thetrace buffer when threshold fill levels are reached. Should thewriteout thread be unable to keep up with trace generation, records willsimply 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> --- 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. Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |