Re: [PATCH -v5 15/17] ftrace: Rework event_create_dir()

Steven Rostedt
2019-11-14T14:08:00Z

On Mon, 11 Nov 2019 14:13:07 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> Rework event_create_dir() to use an array of static data instead of
> function pointers where possible.
>
> The problem is that it would call the function pointer on module load
> before parse_args(), possibly even before jump_labels were initialized.
> Luckily the generated functions don't use jump_labels but it still seems
> fragile. It also gets in the way of changing when we make the module map
> executable.
>
> The generated function are basically calling trace_define_field() with a
> bunch of static arguments. So instead of a function, capture these
> arguments in a static array, avoiding the function call.
>
> Now there are a number of cases where the fields are dynamic (syscall
> arguments, kprobes and uprobes), in which case a static array does not
> work, for these we preserve the function call. Luckily all these cases
> are not related to modules and so we can retain the function call for
> them.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> ---
> drivers/infiniband/hw/hfi1/trace_tid.h | 8 +-
> drivers/infiniband/hw/hfi1/trace_tx.h | 2
> drivers/lightnvm/pblk-trace.h | 8 +-
> drivers/net/fjes/fjes_trace.h | 2
> drivers/net/wireless/ath/ath10k/trace.h | 6 -
> fs/xfs/scrub/trace.h | 6 -
> fs/xfs/xfs_trace.h | 4 -
> include/linux/trace_events.h | 18 +++++
> include/trace/events/filemap.h | 2
> include/trace/events/rpcrdma.h | 2
> include/trace/trace_events.h | 64 ++++++-------------
> kernel/trace/trace.h | 31 ++++-----
> kernel/trace/trace_entries.h | 66 +++++--------------
> kernel/trace/trace_events.c | 20 +++++-
> kernel/trace/trace_events_hist.c | 8 ++
> kernel/trace/trace_export.c | 106 +++++++++++---------------------
> kernel/trace/trace_kprobe.c | 16 ++++
> kernel/trace/trace_syscalls.c | 50 ++++++---------
> kernel/trace/trace_uprobe.c | 9 ++
> net/mac80211/trace.h | 28 ++++----
> net/wireless/trace.h | 6 -
> 21 files changed, 213 insertions(+), 249 deletions(-)
>
>