History

ftrace: Rework event_create_dir()

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. Also fix up all broken tracepoint definitions that now generate a compile error.

Peter Zijlstra committed 7 years ago

Commit 04ae87a1 parent 958de6621 files · +213 −249Browse files

Showing the changes to include/linux (1 of 21 files). Show all

Unified · Split

include/linux/trace_events.h+17−1
@@ -187,6 +187,22 @@ enum trace_reg { · 186 unmodified lines
187 187
188struct trace_event_call;188struct trace_event_call;
189 189
190#define TRACE_FUNCTION_TYPE ((const char *)~0UL)
191
192struct trace_event_fields {
193 const char *type;
194 union {
195 struct {
196 const char *name;
197 const int size;
198 const int align;
199 const int is_signed;
200 const int filter_type;
201 };
202 int (*define_fields)(struct trace_event_call *);
203 };
204};
205
190struct trace_event_class {206struct trace_event_class {
191 const char *system;207 const char *system;
192 void *probe;208 void *probe;
@@ -195,7 +211,7 @@ struct trace_event_class { · 2 unmodified lines
195#endif211#endif
196 int (*reg)(struct trace_event_call *event,212 int (*reg)(struct trace_event_call *event,
197 enum trace_reg type, void *data);213 enum trace_reg type, void *data);
198 int (*define_fields)(struct trace_event_call *);214 struct trace_event_fields *fields_array;
199 struct list_head *(*get_fields)(struct trace_event_call *);215 struct list_head *(*get_fields)(struct trace_event_call *);
200 struct list_head fields;216 struct list_head fields;
201 int (*raw_init)(struct trace_event_call *);217 int (*raw_init)(struct trace_event_call *);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t