• Steven Rostedt's avatar
    tracing: Remove per event trace registering · 2239291a
    Steven Rostedt authored
    This patch removes the register functions of TRACE_EVENT() to enable
    and disable tracepoints. The registering of a event is now down
    directly in the trace_events.c file. The tracepoint_probe_register()
    is now called directly.
    The prototypes are no longer type checked, but this should not be
    an issue since the tracepoints are created automatically by the
    macros. If a prototype is incorrect in the TRACE_EVENT() macro, then
    other macros will catch it.
    The trace_event_class structure now holds the probes to be called
    by the callbacks. This removes needing to have each event have
    a separate pointer for the probe.
    To handle kprobes and syscalls, since they register probes in a
    different manner, a "reg" field is added to the ftrace_event_class
    structure. If the "reg" field is assigned, then it will be called for
    enabling and disabling of the probe for either ftrace or perf. To let
    the reg function know what is happening, a new enum (trace_reg) is
    created that has the type of control that is needed.
    With this new rework, the 82 kernel events and 618 syscall events
    has their footprint dramatically lowered:
       text	   data	    bss	    dec	    hex	filename
    4913961	1088356	 861512	6863829	 68bbd5	vmlinux.orig
    4914025	1088868	 861512	6864405	 68be15	vmlinux.class
    4918492	1084612	 861512	6864616	 68bee8	vmlinux.tracepoint
    4900252	1057412	 861512	6819176	 680d68	vmlinux.regs
    The size went from 6863829 to 6819176, that's a total of 44K
    in savings. With tracepoints being continuously added, this is
    critical that the footprint becomes minimal.
    v5: Added #ifdef CONFIG_PERF_EVENTS around a reference to perf
        specific structure in trace_events.c.
    v4: Fixed trace self tests to check probe because regfunc no longer
    v3: Updated to handle void *data in beginning of probe parameters.
        Also added the tracepoint: check_trace_callback_type_##call().
    v2: Changed the callback probes to pass void * and typecast the
        value within the function.
    Acked-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Acked-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
    Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
ftrace.h 20.8 KB