tracing: Fix for sparse warnings and anonymous unions
Steven Rostedt
maintainercover tracing: Fix for sparse warnings and anonymous unions
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next
Head SHA1: abb43f6998eb6466ea392d3757e673bbdb6ae171
Mathieu Desnoyers (2):
tracepoint: Fix sparse warnings in tracepoint.c
tracing: Fix anonymous unions in struct ftrace_event_call
----
include/linux/syscalls.h | 8 ++++++-- include/linux/tracepoint.h | 5 +++++ include/trace/events/syscalls.h | 3 --- include/trace/ftrace.h | 12 +++++++++--- kernel/trace/trace_export.c | 6 ++++-- kernel/tracepoint.c | 6 ++++-- 6 files changed, 28 insertions(+), 12 deletions(-)
Steven Rostedt
maintainerPATCH 1/2 tracepoint: Fix sparse warnings in tracepoint.c
From: Mathieu Desnoyers <[email protected]>
Fix the following sparse warnings:
CHECK kernel/tracepoint.ckernel/tracepoint.c:184:18: warning: incorrect type in assignment (different address spaces)kernel/tracepoint.c:184:18: expected struct tracepoint_func *tp_funcskernel/tracepoint.c:184:18: got struct tracepoint_func [noderef] <asn:4>*funcskernel/tracepoint.c:216:18: warning: incorrect type in assignment (different address spaces)kernel/tracepoint.c:216:18: expected struct tracepoint_func *tp_funcskernel/tracepoint.c:216:18: got struct tracepoint_func [noderef] <asn:4>*funcskernel/tracepoint.c:392:24: error: return expression in void function
CC kernel/tracepoint.okernel/tracepoint.c: In function tracepoint_module_going:kernel/tracepoint.c:491:6: warning: symbol 'syscall_regfunc' was not declared. Should it be static? kernel/tracepoint.c:508:6: warning: symbol 'syscall_unregfunc' was not declared. Should it be static?
--- include/linux/tracepoint.h | 5 +++++ include/trace/events/syscalls.h | 3 --- kernel/tracepoint.c | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-)
include/linux/tracepoint.h +5 -0
@@ -80,6 +80,11 @@ static inline void tracepoint_synchronize_unregister(void)synchronize_sched (); } +#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS +extern void syscall_regfunc (void ); +extern void syscall_unregfunc (void ); +#endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */ + #define PARAMS(args...) args#endif /* _LINUX_TRACEPOINT_H */
include/trace/events/syscalls.h +0 -3
@@ -13,9 +13,6 @@#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS -extern void syscall_regfunc (void ); -extern void syscall_unregfunc (void ); - TRACE_EVENT_FN(sys_enter, TP_PROTO(struct pt_regs *regs, long id),
kernel/tracepoint.c +4 -2
@@ -181,7 +181,8 @@ static int tracepoint_add_func(struct tracepoint *tp,if (tp->regfunc && !static_key_enabled (&tp->key)) tp->regfunc (); - tp_funcs = tp->funcs; + tp_funcs =rcu_dereference_protected (tp->funcs, +lockdep_is_held (&tracepoints_mutex)); old =func_add (&tp_funcs, func);if (IS_ERR (old)) {WARN_ON_ONCE (1 );
@@ -213,7 +214,8 @@ static int tracepoint_remove_func(struct tracepoint *tp, {struct tracepoint_func *old, *tp_funcs; - tp_funcs = tp->funcs; + tp_funcs =rcu_dereference_protected (tp->funcs, +lockdep_is_held (&tracepoints_mutex)); old =func_remove (&tp_funcs, func);if (IS_ERR (old)) {WARN_ON_ONCE (1 );
Signature · 1 line
1.8.5.3
Steven Rostedt
maintainerPATCH 2/2 tracing: Fix anonymous unions in struct ftrace_event_call
In reply to Steven RostedtFrom: Mathieu Desnoyers <[email protected]>
gcc <= 4.5.x has significant limitations with respect to initialization of anonymous unions within structures. They need to be surrounded by brackets, _and_ they need to be initialized in the same order in which they appear in the structure declaration.
--- include/linux/syscalls.h | 8 ++++++-- include/trace/ftrace.h | 12 +++++++++--- kernel/trace/trace_export.c | 6 ++++-- 3 files changed, 19 insertions(+), 7 deletions(-)
include/linux/syscalls.h +6 -2
@@ -119,8 +119,10 @@ extern struct trace_event_functions exit_syscall_print_funcs; static struct syscall_metadata __syscall_meta_##sname; \ static struct ftrace_event_call __used \ event_enter_##sname = { \ - .name = "sys_enter"#sname, \ .class = &event_class_syscall_enter, \ + { \ + .name = "sys_enter"#sname, \ + }, \ .event.funcs = &enter_syscall_print_funcs, \ .data = (void *)&__syscall_meta_##sname,\ .flags = TRACE_EVENT_FL_CAP_ANY, \
@@ -133,8 +135,10 @@ extern struct trace_event_functions exit_syscall_print_funcs; static struct syscall_metadata __syscall_meta_##sname; \ static struct ftrace_event_call __used \ event_exit_##sname = { \ - .name = "sys_exit"#sname, \ .class = &event_class_syscall_exit, \ + { \ + .name = "sys_exit"#sname, \ + }, \ .event.funcs = &exit_syscall_print_funcs, \ .data = (void *)&__syscall_meta_##sname,\ .flags = TRACE_EVENT_FL_CAP_ANY, \
include/trace/ftrace.h +9 -3
@@ -470,8 +470,10 @@ static inline notrace int ftrace_get_offsets_##call( \* }; * * static struct ftrace_event_call event_<call> = { -* .tp = &__tracepoint_<call>, * .class = event_class_<template>, +* { +* .tp = &__tracepoint_<call>, +* }, * .event = &ftrace_event_type_<call>, * .print_fmt = print_fmt_<call>, * .flags = TRACE_EVENT_FL_TRACEPOINT,
@@ -606,8 +608,10 @@ static struct ftrace_event_class __used __refdata event_class_##call = { \#define DEFINE_EVENT (template, call, proto, args) \ \ static struct ftrace_event_call __used event_##call = { \ - .tp = &__tracepoint_##call, \ .class = &event_class_##template, \ + { \ + .tp = &__tracepoint_##call, \ + }, \ .event.funcs = &ftrace_event_type_funcs_##template, \ .print_fmt = print_fmt_##template, \ .flags = TRACE_EVENT_FL_TRACEPOINT, \
@@ -621,8 +625,10 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call static const char print_fmt_##call[] = print; \ \ static struct ftrace_event_call __used event_##call = { \ - .tp = &__tracepoint_##call, \ .class = &event_class_##template, \ + { \ + .tp = &__tracepoint_##call, \ + }, \ .event.funcs = &ftrace_event_type_funcs_##call, \ .print_fmt = print_fmt_##call, \ .flags = TRACE_EVENT_FL_TRACEPOINT, \
kernel/trace/trace_export.c +4 -2
@@ -173,9 +173,11 @@ struct ftrace_event_class __refdata event_class_ftrace_##call = { \ }; \ \ struct ftrace_event_call __used event_##call = { \ - .name = #call, \ - .event.type = etype, \ .class = &event_class_ftrace_##call, \ + { \ + .name = #call, \ + }, \ + .event.type = etype, \ .print_fmt = print, \ .flags = TRACE_EVENT_FL_IGNORE_ENABLE | TRACE_EVENT_FL_USE_CALL_FILTER, \ }; \
Signature · 1 line
1.8.5.3