Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[safe/jmp/linux-2.6] / include / trace / ftrace.h
index 824141d..3d685d1 100644 (file)
@@ -68,7 +68,7 @@
 
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, name, proto, args)      \
-       static struct ftrace_event_call                 \
+       static struct ftrace_event_call __used          \
        __attribute__((__aligned__(4))) event_##name
 
 #undef DEFINE_EVENT_PRINT
  *
  *     entry = iter->ent;
  *
- *     if (entry->type != event_<call>.id) {
+ *     if (entry->type != event_<call>->event.type) {
  *             WARN_ON_ONCE(1);
  *             return TRACE_TYPE_UNHANDLED;
  *     }
                ftrace_print_symbols_seq(p, value, symbols);            \
        })
 
+#undef __print_hex
+#define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len)
+
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
 static notrace enum print_line_t                                       \
@@ -221,7 +224,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags,    \
                                                                        \
        entry = iter->ent;                                              \
                                                                        \
-       if (entry->type != event->id) {                                 \
+       if (entry->type != event->event.type) {                         \
                WARN_ON_ONCE(1);                                        \
                return TRACE_TYPE_UNHANDLED;                            \
        }                                                               \
@@ -257,7 +260,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags,    \
                                                                        \
        entry = iter->ent;                                              \
                                                                        \
-       if (entry->type != event_##call.id) {                           \
+       if (entry->type != event_##call.event.type) {                   \
                WARN_ON_ONCE(1);                                        \
                return TRACE_TYPE_UNHANDLED;                            \
        }                                                               \
@@ -409,7 +412,7 @@ static inline notrace int ftrace_get_offsets_##call(                        \
  *     __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
  *
  *     event = trace_current_buffer_lock_reserve(&buffer,
- *                               event_<call>.id,
+ *                               event_<call>->event.type,
  *                               sizeof(*entry) + __data_size,
  *                               irq_flags, pc);
  *     if (!event)
@@ -510,7 +513,7 @@ ftrace_raw_event_##call(void *__data, proto)                                \
        __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
                                                                        \
        event = trace_current_buffer_lock_reserve(&buffer,              \
-                                event_call->id,                        \
+                                event_call->event.type,                \
                                 sizeof(*entry) + __data_size,          \
                                 irq_flags, pc);                        \
        if (!event)                                                     \
@@ -695,13 +698,15 @@ perf_trace_##call(void *__data, proto)                                    \
        struct ftrace_event_call *event_call = __data;                  \
        struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
        struct ftrace_raw_##call *entry;                                \
+       struct pt_regs __regs;                                          \
        u64 __addr = 0, __count = 1;                                    \
-       unsigned long irq_flags;                                        \
-       struct pt_regs *__regs;                                         \
+       struct hlist_head *head;                                        \
        int __entry_size;                                               \
        int __data_size;                                                \
        int rctx;                                                       \
                                                                        \
+       perf_fetch_caller_regs(&__regs, 1);                             \
+                                                                       \
        __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
        __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
                             sizeof(u64));                              \
@@ -710,19 +715,19 @@ perf_trace_##call(void *__data, proto)                                    \
        if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE,               \
                      "profile buffer not large enough"))               \
                return;                                                 \
+                                                                       \
        entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare(     \
-               __entry_size, event_call->id, &rctx, &irq_flags);       \
+               __entry_size, event_call->event.type, &__regs, &rctx);  \
        if (!entry)                                                     \
                return;                                                 \
+                                                                       \
        tstruct                                                         \
                                                                        \
        { assign; }                                                     \
                                                                        \
-       __regs = &__get_cpu_var(perf_trace_regs);                       \
-       perf_fetch_caller_regs(__regs, 2);                              \
-                                                                       \
+       head = per_cpu_ptr(event_call->perf_events, smp_processor_id());\
        perf_trace_buf_submit(entry, __entry_size, rctx, __addr,        \
-                              __count, irq_flags, __regs);             \
+               __count, &__regs, head);                                \
 }
 
 /*
@@ -735,7 +740,6 @@ perf_trace_##call(void *__data, proto)                                      \
 static inline void perf_test_probe_##call(void)                                \
 {                                                                      \
        check_trace_callback_type_##call(perf_trace_##template);        \
-                                                                       \
 }