trace_mark: pass register values to probe
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Tue, 27 Oct 2009 21:36:58 +0000 (17:36 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Tue, 27 Oct 2009 22:35:28 +0000 (18:35 -0400)
This should be more efficient, disableable or done inside the probe. For GDB static tracepoints.

libust/marker.c
libust/marker.h
libust/serialize.c
libust/tracer.h

index 8b120195677690186839884ab5cfbb940546bef7..d4514f11a4f5faf4e34291c0839b4300c421c8f0 100644 (file)
@@ -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();
index 246d174e67caca18597a684dd6a2eda881a6dbbf..06f2b93f826d25fbf4ec976668b3ff14a3658126 100644 (file)
@@ -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, &regs, ## args);          \
                } else {                                                \
                        if (unlikely(_imv_read(                         \
                                        __mark_##channel##_##name.state))) \
                                (*__mark_##channel##_##name.call)       \
                                        (&__mark_##channel##_##name,    \
-                                       call_private, ## args);         \
+                                       call_private, &regs, ## 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, &regs, ## 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.
index 0055d99403e0bd57f63fa4d4db478d642c50e58c..f9e45b60751ed8060640d004df92f19d7ef4dec8 100644 (file)
@@ -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);
 }
 
index 601d19a74c668afd0b4de19cbbf81c9b00f45948..b2ac930293badb95aaef2e66430fb847b5030f4c 100644 (file)
@@ -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.
This page took 0.028069 seconds and 4 git commands to generate.