mirror of https://gitee.com/openkylin/linux.git
tracing: Pull up calls to trace_define_common_fields()
Call trace_define_common_fields() in event_create_dir() only. This avoids trace events to handle it from their define_fields callbacks and shrinks the kernel code size: text data bss dec hex filename 5346802 1961864 7103260 14411926 dbe896 vmlinux.o.old 5345151 1961864 7103260 14410275 dbe223 vmlinux.o Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jason Baron <jbaron@redhat.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> LKML-Reference: <4B1DC49C.8000107@cn.fujitsu.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
parent
87d9b4e1c5
commit
614a71a26b
|
@ -159,7 +159,6 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int trace_event_raw_init(struct ftrace_event_call *call);
|
extern int trace_event_raw_init(struct ftrace_event_call *call);
|
||||||
extern int trace_define_common_fields(struct ftrace_event_call *call);
|
|
||||||
extern int trace_define_field(struct ftrace_event_call *call, const char *type,
|
extern int trace_define_field(struct ftrace_event_call *call, const char *type,
|
||||||
const char *name, int offset, int size,
|
const char *name, int offset, int size,
|
||||||
int is_signed, int filter_type);
|
int is_signed, int filter_type);
|
||||||
|
|
|
@ -436,10 +436,6 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
|
||||||
struct ftrace_raw_##call field; \
|
struct ftrace_raw_##call field; \
|
||||||
int ret; \
|
int ret; \
|
||||||
\
|
\
|
||||||
ret = trace_define_common_fields(event_call); \
|
|
||||||
if (ret) \
|
|
||||||
return ret; \
|
|
||||||
\
|
|
||||||
tstruct; \
|
tstruct; \
|
||||||
\
|
\
|
||||||
return ret; \
|
return ret; \
|
||||||
|
|
|
@ -78,7 +78,7 @@ EXPORT_SYMBOL_GPL(trace_define_field);
|
||||||
if (ret) \
|
if (ret) \
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
int trace_define_common_fields(struct ftrace_event_call *call)
|
static int trace_define_common_fields(struct ftrace_event_call *call)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct trace_entry ent;
|
struct trace_entry ent;
|
||||||
|
@ -91,7 +91,6 @@ int trace_define_common_fields(struct ftrace_event_call *call)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(trace_define_common_fields);
|
|
||||||
|
|
||||||
void trace_destroy_fields(struct ftrace_event_call *call)
|
void trace_destroy_fields(struct ftrace_event_call *call)
|
||||||
{
|
{
|
||||||
|
@ -927,7 +926,9 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
|
||||||
id);
|
id);
|
||||||
|
|
||||||
if (call->define_fields) {
|
if (call->define_fields) {
|
||||||
ret = call->define_fields(call);
|
ret = trace_define_common_fields(call);
|
||||||
|
if (!ret)
|
||||||
|
ret = call->define_fields(call);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_warning("Could not initialize trace point"
|
pr_warning("Could not initialize trace point"
|
||||||
" events/%s\n", call->name);
|
" events/%s\n", call->name);
|
||||||
|
|
|
@ -184,10 +184,6 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
|
||||||
struct struct_name field; \
|
struct struct_name field; \
|
||||||
int ret; \
|
int ret; \
|
||||||
\
|
\
|
||||||
ret = trace_define_common_fields(event_call); \
|
|
||||||
if (ret) \
|
|
||||||
return ret; \
|
|
||||||
\
|
|
||||||
tstruct; \
|
tstruct; \
|
||||||
\
|
\
|
||||||
return ret; \
|
return ret; \
|
||||||
|
|
|
@ -1113,10 +1113,6 @@ static int kprobe_event_define_fields(struct ftrace_event_call *event_call)
|
||||||
struct kprobe_trace_entry field;
|
struct kprobe_trace_entry field;
|
||||||
struct trace_probe *tp = (struct trace_probe *)event_call->data;
|
struct trace_probe *tp = (struct trace_probe *)event_call->data;
|
||||||
|
|
||||||
ret = trace_define_common_fields(event_call);
|
|
||||||
if (!ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
DEFINE_FIELD(unsigned long, ip, FIELD_STRING_IP, 0);
|
DEFINE_FIELD(unsigned long, ip, FIELD_STRING_IP, 0);
|
||||||
DEFINE_FIELD(int, nargs, FIELD_STRING_NARGS, 1);
|
DEFINE_FIELD(int, nargs, FIELD_STRING_NARGS, 1);
|
||||||
/* Set argument names as fields */
|
/* Set argument names as fields */
|
||||||
|
@ -1131,10 +1127,6 @@ static int kretprobe_event_define_fields(struct ftrace_event_call *event_call)
|
||||||
struct kretprobe_trace_entry field;
|
struct kretprobe_trace_entry field;
|
||||||
struct trace_probe *tp = (struct trace_probe *)event_call->data;
|
struct trace_probe *tp = (struct trace_probe *)event_call->data;
|
||||||
|
|
||||||
ret = trace_define_common_fields(event_call);
|
|
||||||
if (!ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
DEFINE_FIELD(unsigned long, func, FIELD_STRING_FUNC, 0);
|
DEFINE_FIELD(unsigned long, func, FIELD_STRING_FUNC, 0);
|
||||||
DEFINE_FIELD(unsigned long, ret_ip, FIELD_STRING_RETIP, 0);
|
DEFINE_FIELD(unsigned long, ret_ip, FIELD_STRING_RETIP, 0);
|
||||||
DEFINE_FIELD(int, nargs, FIELD_STRING_NARGS, 1);
|
DEFINE_FIELD(int, nargs, FIELD_STRING_NARGS, 1);
|
||||||
|
|
|
@ -217,10 +217,6 @@ int syscall_enter_define_fields(struct ftrace_event_call *call)
|
||||||
int i;
|
int i;
|
||||||
int offset = offsetof(typeof(trace), args);
|
int offset = offsetof(typeof(trace), args);
|
||||||
|
|
||||||
ret = trace_define_common_fields(call);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
|
ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -241,10 +237,6 @@ int syscall_exit_define_fields(struct ftrace_event_call *call)
|
||||||
struct syscall_trace_exit trace;
|
struct syscall_trace_exit trace;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = trace_define_common_fields(call);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
|
ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue