From: Pierre-Marc Fournier Date: Tue, 27 Oct 2009 21:36:58 +0000 (-0400) Subject: trace_mark: pass register values to probe X-Git-Tag: v1.9.1~850 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=75667d04f4c255687def1876cf15baf3bbd1ffc5;p=lttng-ust.git trace_mark: pass register values to probe This should be more efficient, disableable or done inside the probe. For GDB static tracepoints. --- diff --git a/libust/marker.c b/libust/marker.c index 8b120195..d4514f11 100644 --- a/libust/marker.c +++ b/libust/marker.c @@ -89,7 +89,7 @@ struct marker_entry { char *format; char *name; /* Probe wrapper */ - void (*call)(const struct marker *mdata, void *call_private, ...); + void (*call)(const struct marker *mdata, void *call_private, struct registers *regs, ...); struct marker_probe_closure single; struct marker_probe_closure *multi; int refcount; /* Number of times armed. 0 if disarmed. */ @@ -125,7 +125,7 @@ static void marker_update_processes(void) * operations that modifies the execution flow of preemptible code. */ notrace void __mark_empty_function(const struct marker *mdata, - void *probe_private, void *call_private, const char *fmt, va_list *args) + void *probe_private, struct registers *regs, void *call_private, const char *fmt, va_list *args) { } //ust// EXPORT_SYMBOL_GPL(__mark_empty_function); @@ -141,7 +141,7 @@ notrace void __mark_empty_function(const struct marker *mdata, * rcu_dereference() for the pointer read. */ notrace void marker_probe_cb(const struct marker *mdata, - void *call_private, ...) + void *call_private, struct registers *regs, ...) { va_list args; char ptype; @@ -162,8 +162,8 @@ notrace void marker_probe_cb(const struct marker *mdata, /* Must read the ptr before private data. They are not data * dependant, so we put an explicit smp_rmb() here. */ smp_rmb(); - va_start(args, call_private); - func(mdata, mdata->single.probe_private, call_private, + va_start(args, regs); + func(mdata, mdata->single.probe_private, regs, call_private, mdata->format, &args); va_end(args); } else { @@ -183,9 +183,9 @@ notrace void marker_probe_cb(const struct marker *mdata, */ smp_read_barrier_depends(); for (i = 0; multi[i].func; i++) { - va_start(args, call_private); + va_start(args, regs); multi[i].func(mdata, multi[i].probe_private, - call_private, mdata->format, &args); + regs, call_private, mdata->format, &args); va_end(args); } } @@ -202,7 +202,7 @@ notrace void marker_probe_cb(const struct marker *mdata, * Should be connected to markers "MARK_NOARGS". */ static notrace void marker_probe_cb_noarg(const struct marker *mdata, - void *call_private, ...) + void *call_private, struct registers *regs, ...) { va_list args; /* not initialized */ char ptype; @@ -218,7 +218,7 @@ static notrace void marker_probe_cb_noarg(const struct marker *mdata, /* Must read the ptr before private data. They are not data * dependant, so we put an explicit smp_rmb() here. */ smp_rmb(); - func(mdata, mdata->single.probe_private, call_private, + func(mdata, mdata->single.probe_private, regs, call_private, mdata->format, &args); } else { struct marker_probe_closure *multi; @@ -237,7 +237,7 @@ static notrace void marker_probe_cb_noarg(const struct marker *mdata, */ smp_read_barrier_depends(); for (i = 0; multi[i].func; i++) - multi[i].func(mdata, multi[i].probe_private, + multi[i].func(mdata, multi[i].probe_private, regs, call_private, mdata->format, &args); } //ust// rcu_read_unlock_sched_notrace(); diff --git a/libust/marker.h b/libust/marker.h index 246d174e..06f2b93f 100644 --- a/libust/marker.h +++ b/libust/marker.h @@ -51,7 +51,7 @@ struct marker; * format string to recover the variable argument list. */ typedef void marker_probe_func(const struct marker *mdata, - void *probe_private, void *call_private, + void *probe_private, struct registers *regs, void *call_private, const char *fmt, va_list *args); struct marker_probe_closure { @@ -70,7 +70,7 @@ struct marker { /* Probe wrapper */ u16 channel_id; /* Numeric channel identifier, dynamic */ u16 event_id; /* Numeric event identifier, dynamic */ - void (*call)(const struct marker *mdata, void *call_private, ...); + void (*call)(const struct marker *mdata, void *call_private, struct registers *regs, ...); struct marker_probe_closure single; struct marker_probe_closure *multi; const char *tp_name; /* Optional tracepoint name */ @@ -85,6 +85,7 @@ struct marker { static const char __mstrtab_##channel##_##name[] \ __attribute__((section("__markers_strings"))) \ = #channel "\0" #name "\0" format; \ + struct registers regs; \ static struct marker __mark_##channel##_##name \ __attribute__((section("__markers"), aligned(8))) = \ { __mstrtab_##channel##_##name, \ @@ -128,13 +129,13 @@ struct marker { __mark_##channel##_##name.state))) \ (*__mark_##channel##_##name.call) \ (&__mark_##channel##_##name, \ - call_private, ## args); \ + call_private, ®s, ## args); \ } else { \ if (unlikely(_imv_read( \ __mark_##channel##_##name.state))) \ (*__mark_##channel##_##name.call) \ (&__mark_##channel##_##name, \ - call_private, ## args); \ + call_private, ®s, ## args); \ } \ } while (0) @@ -148,7 +149,7 @@ struct marker { DEFINE_MARKER_TP(channel, name, tp_name, tp_cb, format);\ __mark_check_format(format, ## args); \ (*__mark_##channel##_##name.call)(&__mark_##channel##_##name, \ - call_private, ## args); \ + call_private, ®s, ## args); \ } while (0) extern void marker_update_probe_range(struct marker *begin, @@ -242,7 +243,7 @@ static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...) extern marker_probe_func __mark_empty_function; extern void marker_probe_cb(const struct marker *mdata, - void *call_private, ...); + void *call_private, struct registers *regs, ...); /* * Connect a probe to a marker. diff --git a/libust/serialize.c b/libust/serialize.c index 0055d994..f9e45b60 100644 --- a/libust/serialize.c +++ b/libust/serialize.c @@ -583,7 +583,8 @@ void ltt_write_event_data(struct rchan_buf *buf, size_t buf_offset, notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, - void *call_data, const char *fmt, va_list *args) + struct registers *regs, void *call_data, + const char *fmt, va_list *args) { int largest_align, ret; struct ltt_active_marker *pdata; @@ -697,12 +698,13 @@ notrace void ltt_vtrace(const struct marker *mdata, void *probe_data, } notrace void ltt_trace(const struct marker *mdata, void *probe_data, - void *call_data, const char *fmt, ...) + struct registers *regs, void *call_data, + const char *fmt, ...) { va_list args; va_start(args, fmt); - ltt_vtrace(mdata, probe_data, call_data, fmt, &args); + ltt_vtrace(mdata, probe_data, regs, call_data, fmt, &args); va_end(args); } diff --git a/libust/tracer.h b/libust/tracer.h index 601d19a7..b2ac9302 100644 --- a/libust/tracer.h +++ b/libust/tracer.h @@ -110,9 +110,9 @@ struct ltt_active_marker { struct marker; //ust// extern void ltt_vtrace(const struct marker *mdata, void *probe_data, - void *call_data, const char *fmt, va_list *args); + struct registers *regs, void *call_data, const char *fmt, va_list *args); extern void ltt_trace(const struct marker *mdata, void *probe_data, - void *call_data, const char *fmt, ...); + struct registers *regs, void *call_data, const char *fmt, ...); /* * Unique ID assigned to each registered probe.