Pull more tracing updates from Steven Rostedt: - Rename the staging files to give them some meaning. Just stage1,stag2,etc, does not show what they are for - Check for NULL from allocation in bootconfig - Hold event mutex for dyn_event call in user events - Mark user events to broken (to work on the API) - Remove eBPF updates from user events - Remove user events from uapi header to keep it from being installed. - Move ftrace_graph_is_dead() into inline as it is called from hot paths and also convert it into a static branch. * tag 'trace-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Move user_events.h temporarily out of include/uapi ftrace: Make ftrace_graph_is_dead() a static branch tracing: Set user_events to BROKEN tracing/user_events: Remove eBPF interfaces tracing/user_events: Hold event_mutex during dyn_event_add proc: bootconfig: Add null pointer check tracing: Rename the staging files for trace_events
Showing the changes to include (11 of 15 files). Show all
Unified · Split
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | #include <linux/trace_recursion.h> |
| 11 | 11 | #include <linux/trace_clock.h> |
| 12 | +#include <linux/jump_label.h> | |
| 12 | 13 | #include <linux/kallsyms.h> |
| 13 | 14 | #include <linux/linkage.h> |
| 14 | 15 | #include <linux/bitops.h> |
| @@ -1018,7 +1019,20 @@ unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx, · 1003 unmodified lines | ||
| 1018 | 1019 | extern int register_ftrace_graph(struct fgraph_ops *ops); |
| 1019 | 1020 | extern void unregister_ftrace_graph(struct fgraph_ops *ops); |
| 1020 | 1021 | |
| 1021 | −extern bool ftrace_graph_is_dead(void); | |
| 1022 | +/** | |
| 1023 | + * ftrace_graph_is_dead - returns true if ftrace_graph_stop() was called | |
| 1024 | + * | |
| 1025 | + * ftrace_graph_stop() is called when a severe error is detected in | |
| 1026 | + * the function graph tracing. This function is called by the critical | |
| 1027 | + * paths of function graph to keep those paths from doing any more harm. | |
| 1028 | + */ | |
| 1029 | +DECLARE_STATIC_KEY_FALSE(kill_ftrace_graph); | |
| 1030 | + | |
| 1031 | +static inline bool ftrace_graph_is_dead(void) | |
| 1032 | +{ | |
| 1033 | + return static_branch_unlikely(&kill_ftrace_graph); | |
| 1034 | +} | |
| 1035 | + | |
| 1022 | 1036 | extern void ftrace_graph_stop(void); |
| 1023 | 1037 | |
| 1024 | 1038 | /* The current handlers in use */ |
| @@ -32,9 +32,6 @@ · 31 unmodified lines | ||
| 32 | 32 | /* Create dynamic location entry within a 32-bit value */ |
| 33 | 33 | #define DYN_LOC(offset, size) ((size) << 16 | (offset)) |
| 34 | 34 | |
| 35 | −/* Use raw iterator for attached BPF program(s), no affect on ftrace/perf */ | |
| 36 | −#define FLAG_BPF_ITER (1 << 0) | |
| 37 | − | |
| 38 | 35 | /* |
| 39 | 36 | * Describes an event registration and stores the results of the registration. |
| 40 | 37 | * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum |
| @@ -63,54 +60,4 @@ struct user_reg { · 22 unmodified lines | ||
| 63 | 60 | /* Requests to delete a user_event */ |
| 64 | 61 | #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char*) |
| 65 | 62 | |
| 66 | −/* Data type that was passed to the BPF program */ | |
| 67 | −enum { | |
| 68 | − /* Data resides in kernel space */ | |
| 69 | − USER_BPF_DATA_KERNEL, | |
| 70 | − | |
| 71 | − /* Data resides in user space */ | |
| 72 | − USER_BPF_DATA_USER, | |
| 73 | − | |
| 74 | − /* Data is a pointer to a user_bpf_iter structure */ | |
| 75 | − USER_BPF_DATA_ITER, | |
| 76 | −}; | |
| 77 | − | |
| 78 | −/* | |
| 79 | − * Describes an iovec iterator that BPF programs can use to access data for | |
| 80 | − * a given user_event write() / writev() call. | |
| 81 | − */ | |
| 82 | −struct user_bpf_iter { | |
| 83 | − | |
| 84 | − /* Offset of the data within the first iovec */ | |
| 85 | − __u32 iov_offset; | |
| 86 | − | |
| 87 | − /* Number of iovec structures */ | |
| 88 | − __u32 nr_segs; | |
| 89 | − | |
| 90 | − /* Pointer to iovec structures */ | |
| 91 | − const struct iovec *iov; | |
| 92 | −}; | |
| 93 | − | |
| 94 | −/* Context that BPF programs receive when attached to a user_event */ | |
| 95 | −struct user_bpf_context { | |
| 96 | − | |
| 97 | − /* Data type being passed (see union below) */ | |
| 98 | − __u32 data_type; | |
| 99 | − | |
| 100 | − /* Length of the data */ | |
| 101 | − __u32 data_len; | |
| 102 | − | |
| 103 | − /* Pointer to data, varies by data type */ | |
| 104 | − union { | |
| 105 | − /* Kernel data (data_type == USER_BPF_DATA_KERNEL) */ | |
| 106 | − void *kdata; | |
| 107 | − | |
| 108 | − /* User data (data_type == USER_BPF_DATA_USER) */ | |
| 109 | − void *udata; | |
| 110 | − | |
| 111 | − /* Direct iovec (data_type == USER_BPF_DATA_ITER) */ | |
| 112 | − struct user_bpf_iter *iter; | |
| 113 | − }; | |
| 114 | −}; | |
| 115 | − | |
| 116 | 63 | #endif /* _UAPI_LINUX_USER_EVENTS_H */ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
| @@ -35,7 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | /* Stage 1 creates the structure of the recorded event layout */ |
| 37 | 37 | |
| 38 | −#include "stages/stage1_defines.h" | |
| 38 | +#include "stages/stage1_struct_define.h" | |
| 39 | 39 | |
| 40 | 40 | #undef DECLARE_CUSTOM_EVENT_CLASS |
| 41 | 41 | #define DECLARE_CUSTOM_EVENT_CLASS(name, proto, args, tstruct, assign, print) \ |
| @@ -56,7 +56,7 @@ · 14 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | /* Stage 2 creates the custom class */ |
| 58 | 58 | |
| 59 | −#include "stages/stage2_defines.h" | |
| 59 | +#include "stages/stage2_data_offsets.h" | |
| 60 | 60 | |
| 61 | 61 | #undef DECLARE_CUSTOM_EVENT_CLASS |
| 62 | 62 | #define DECLARE_CUSTOM_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -71,7 +71,7 @@ · 8 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | /* Stage 3 create the way to print the custom event */ |
| 73 | 73 | |
| 74 | −#include "stages/stage3_defines.h" | |
| 74 | +#include "stages/stage3_trace_output.h" | |
| 75 | 75 | |
| 76 | 76 | #undef DECLARE_CUSTOM_EVENT_CLASS |
| 77 | 77 | #define DECLARE_CUSTOM_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -102,7 +102,7 @@ static struct trace_event_functions trace_custom_event_type_funcs_##call = { \ · 24 unmodified lines | ||
| 102 | 102 | |
| 103 | 103 | /* Stage 4 creates the offset layout for the fields */ |
| 104 | 104 | |
| 105 | −#include "stages/stage4_defines.h" | |
| 105 | +#include "stages/stage4_event_fields.h" | |
| 106 | 106 | |
| 107 | 107 | #undef DECLARE_CUSTOM_EVENT_CLASS |
| 108 | 108 | #define DECLARE_CUSTOM_EVENT_CLASS(call, proto, args, tstruct, func, print) \ |
| @@ -114,7 +114,7 @@ static struct trace_event_fields trace_custom_event_fields_##call[] = { \ · 5 unmodified lines | ||
| 114 | 114 | |
| 115 | 115 | /* Stage 5 creates the helper function for dynamic fields */ |
| 116 | 116 | |
| 117 | −#include "stages/stage5_defines.h" | |
| 117 | +#include "stages/stage5_get_offsets.h" | |
| 118 | 118 | |
| 119 | 119 | #undef DECLARE_CUSTOM_EVENT_CLASS |
| 120 | 120 | #define DECLARE_CUSTOM_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -134,7 +134,7 @@ static inline notrace int trace_custom_event_get_offsets_##call( \ · 13 unmodified lines | ||
| 134 | 134 | |
| 135 | 135 | /* Stage 6 creates the probe function that records the event */ |
| 136 | 136 | |
| 137 | −#include "stages/stage6_defines.h" | |
| 137 | +#include "stages/stage6_event_callback.h" | |
| 138 | 138 | |
| 139 | 139 | #undef DECLARE_CUSTOM_EVENT_CLASS |
| 140 | 140 | #define DECLARE_CUSTOM_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -182,7 +182,7 @@ static inline void ftrace_test_custom_probe_##call(void) \ · 41 unmodified lines | ||
| 182 | 182 | |
| 183 | 183 | /* Stage 7 creates the actual class and event structure for the custom event */ |
| 184 | 184 | |
| 185 | −#include "stages/stage7_defines.h" | |
| 185 | +#include "stages/stage7_class_define.h" | |
| 186 | 186 | |
| 187 | 187 | #undef DECLARE_CUSTOM_EVENT_CLASS |
| 188 | 188 | #define DECLARE_CUSTOM_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -45,7 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | PARAMS(print)); \ |
| 46 | 46 | DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args)); |
| 47 | 47 | |
| 48 | −#include "stages/stage1_defines.h" | |
| 48 | +#include "stages/stage1_struct_define.h" | |
| 49 | 49 | |
| 50 | 50 | #undef DECLARE_EVENT_CLASS |
| 51 | 51 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \ |
| @@ -109,7 +109,7 @@ · 57 unmodified lines | ||
| 109 | 109 | * The size of an array is also encoded, in the higher 16 bits of <item>. |
| 110 | 110 | */ |
| 111 | 111 | |
| 112 | −#include "stages/stage2_defines.h" | |
| 112 | +#include "stages/stage2_data_offsets.h" | |
| 113 | 113 | |
| 114 | 114 | #undef DECLARE_EVENT_CLASS |
| 115 | 115 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -181,7 +181,7 @@ · 65 unmodified lines | ||
| 181 | 181 | * in binary. |
| 182 | 182 | */ |
| 183 | 183 | |
| 184 | −#include "stages/stage3_defines.h" | |
| 184 | +#include "stages/stage3_trace_output.h" | |
| 185 | 185 | |
| 186 | 186 | #undef DECLARE_EVENT_CLASS |
| 187 | 187 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -236,7 +236,7 @@ static struct trace_event_functions trace_event_type_funcs_##call = { \ · 48 unmodified lines | ||
| 236 | 236 | |
| 237 | 237 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 238 | 238 | |
| 239 | −#include "stages/stage4_defines.h" | |
| 239 | +#include "stages/stage4_event_fields.h" | |
| 240 | 240 | |
| 241 | 241 | #undef DECLARE_EVENT_CLASS |
| 242 | 242 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ |
| @@ -249,7 +249,7 @@ static struct trace_event_fields trace_event_fields_##call[] = { \ · 6 unmodified lines | ||
| 249 | 249 | |
| 250 | 250 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 251 | 251 | |
| 252 | −#include "stages/stage5_defines.h" | |
| 252 | +#include "stages/stage5_get_offsets.h" | |
| 253 | 253 | |
| 254 | 254 | #undef DECLARE_EVENT_CLASS |
| 255 | 255 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -372,7 +372,7 @@ static inline notrace int trace_event_get_offsets_##call( \ · 116 unmodified lines | ||
| 372 | 372 | #define _TRACE_PERF_INIT(call) |
| 373 | 373 | #endif /* CONFIG_PERF_EVENTS */ |
| 374 | 374 | |
| 375 | −#include "stages/stage6_defines.h" | |
| 375 | +#include "stages/stage6_event_callback.h" | |
| 376 | 376 | |
| 377 | 377 | #undef DECLARE_EVENT_CLASS |
| 378 | 378 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
| @@ -418,7 +418,7 @@ static inline void ftrace_test_probe_##call(void) \ · 39 unmodified lines | ||
| 418 | 418 | |
| 419 | 419 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 420 | 420 | |
| 421 | −#include "stages/stage7_defines.h" | |
| 421 | +#include "stages/stage7_class_define.h" | |
| 422 | 422 | |
| 423 | 423 | #undef DECLARE_EVENT_CLASS |
| 424 | 424 | #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |