X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libust%2Fserialize.c;h=32df0b96ddbae05c9b4c1765444684418e20980f;hb=eddb0f66ac5c9175433828c3f72211115474ddb7;hp=011206afbe94dd7e0cdee20e9d2aae34e72627d6;hpb=83d5c36238fba656181d36faadac7e48a7eab118;p=ust.git diff --git a/libust/serialize.c b/libust/serialize.c index 011206a..32df0b9 100644 --- a/libust/serialize.c +++ b/libust/serialize.c @@ -32,14 +32,14 @@ #include #include -#include #define _LGPL_SOURCE #include #include +#include +#include #include "buffers.h" #include "tracer.h" -//#include "list.h" #include "usterr.h" #include "ust_snprintf.h" @@ -50,11 +50,6 @@ enum ltt_type { LTT_TYPE_NONE, }; -static int ust_get_cpu(void) -{ - return sched_getcpu(); -} - #define LTT_ATTRIBUTE_NETWORK_BYTE_ORDER (1<<1) /* @@ -623,11 +618,11 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, return; rcu_read_lock(); //ust// rcu_read_lock_sched_notrace(); -//ust// cpu = smp_processor_id(); cpu = ust_get_cpu(); -//ust// __get_cpu_var(ltt_nesting)++; - /* FIXME: should nesting be per-cpu? */ - ltt_nesting++; + + /* Force volatile access. */ + STORE_SHARED(ltt_nesting, LOAD_SHARED(ltt_nesting) + 1); + barrier(); pdata = (struct ltt_active_marker *)probe_data; eID = mdata->event_id; @@ -689,10 +684,9 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, } /* reserve space : header and data */ - ret = ltt_reserve_slot(trace, channel, &transport_data, - data_size, &slot_size, &buf_offset, - &tsc, &rflags, - largest_align, cpu); + ret = ltt_reserve_slot(channel, trace, data_size, largest_align, + cpu, &buf, &slot_size, &buf_offset, + &tsc, &rflags); if (unlikely(ret < 0)) continue; /* buffer full */ @@ -701,8 +695,7 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, //ust// buf = ((struct rchan *)channel->trans_channel_data)->buf[cpu]; buf = channel->buf[cpu]; /* Out-of-order write : header and data */ - buf_offset = ltt_write_event_header(trace, - channel, buf, buf_offset, + buf_offset = ltt_write_event_header(channel, buf, buf_offset, eID, data_size, tsc, rflags); ltt_write_event_data(buf, buf_offset, &closure, serialize_private, @@ -712,8 +705,10 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, ltt_commit_slot(channel, buf, buf_offset, data_size, slot_size); DBG("just commited event (%s/%s) at offset %ld and size %zd", mdata->channel, mdata->name, buf_offset, slot_size); } -//ust// __get_cpu_var(ltt_nesting)--; - ltt_nesting--; + + barrier(); + STORE_SHARED(ltt_nesting, LOAD_SHARED(ltt_nesting) - 1); + rcu_read_unlock(); //ust// rcu_read_unlock_sched_notrace(); }