tracing: Final clean ups for 5.20 (or 6.0)
Steven Rostedt
maintainercover tracing: Final clean ups for 5.20 (or 6.0)
Li zeming (1):
tracepoints: It is CONFIG_TRACEPOINTS not CONFIG_TRACEPOINT
Masami Hiramatsu (Google) (1):
tracing/eprobe: Show syntax error logs in error_log file
Slark Xiao (1):
scripts/tracing: Fix typo 'the the' in comment
Steven Rostedt (Google) (1):
tracing: Use alignof__(struct {type b;}) instead of offsetof()
Zhiqiang Liu (1):
tracing: Use free_trace_buffer() in allocate_trace_buffers()
----
include/linux/tracepoint.h | 2 +- include/trace/stages/stage4_event_fields.h | 2 +- kernel/trace/trace.c | 25 +++++++++++-------------- kernel/trace/trace_eprobe.c | 11 +++++++++-- kernel/trace/trace_probe.h | 5 ++++- scripts/tracing/draw_functrace.py | 2 +- 6 files changed, 27 insertions(+), 20 deletions(-)
Steven Rostedt
maintainerPATCH 1/5 tracing: Use free_trace_buffer() in allocate_trace_buffers()
From: Zhiqiang Liu <[email protected]>
In allocate_trace_buffers(), if allocating tr->max_buffer fails, we can directly call free_trace_buffer to free tr->array_buffer.
--- kernel/trace/trace.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)
kernel/trace/trace.c +11 -14
@@ -9101,6 +9101,16 @@ allocate_trace_buffer(struct trace_array *tr, struct array_buffer *buf, int sizereturn 0 ; } +static void free_trace_buffer (struct array_buffer *buf) +{ +if (buf->buffer) { +ring_buffer_free (buf->buffer); + buf->buffer =NULL ; +free_percpu (buf->data); + buf->data =NULL ; + } +} +static int allocate_trace_buffers (struct trace_array *tr,int size) {int ret;
@@ -9113,10 +9123,7 @@ static int allocate_trace_buffers(struct trace_array *tr, int size) ret =allocate_trace_buffer (tr, &tr->max_buffer, allocate_snapshot ? size :1 );if (MEM_FAIL (ret,"Failed to allocate trace buffer\n" )) { -ring_buffer_free (tr->array_buffer.buffer); - tr->array_buffer.buffer =NULL ; -free_percpu (tr->array_buffer.data); - tr->array_buffer.data =NULL ; +free_trace_buffer (&tr->array_buffer);return -ENOMEM ; } tr->allocated_snapshot = allocate_snapshot;
@@ -9131,16 +9138,6 @@ static int allocate_trace_buffers(struct trace_array *tr, int size)return 0 ; } -static void free_trace_buffer (struct array_buffer *buf) -{ -if (buf->buffer) { -ring_buffer_free (buf->buffer); - buf->buffer =NULL ; -free_percpu (buf->data); - buf->data =NULL ; - } -} -static void free_trace_buffers (struct trace_array *tr) {if (!tr)
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 2/5 tracepoints: It is CONFIG_TRACEPOINTS not CONFIG_TRACEPOINT
In reply to Steven RostedtFrom: Li zeming <[email protected]>
When reading this note, CONFIG_TRACEPOINT searches my configuration file, and the result is CONFIG_TRACEPOINTS, the search results are consistent with the following macro definitions. I think it should be repaired.
--- include/linux/tracepoint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/tracepoint.h +1 -1
@@ -151,7 +151,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)/* * Individual subsystem my have a separate configuration to * enable their tracepoints. By default, this file will create -* the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem +* the tracepoints if CONFIG_TRACEPOINTS is defined. If a subsystem * wants to be able to disable its tracepoints from being created * it can define NOTRACE before including the tracepoint headers. */
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 3/5 scripts/tracing: Fix typo the the in comment
In reply to Steven RostedtFrom: Slark Xiao <[email protected]>
Replace 'the the' with 'the' in the comment.
--- scripts/tracing/draw_functrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/tracing/draw_functrace.py +1 -1
@@ -8,7 +8,7 @@ This script parses a trace provided by the function tracer in kernel/trace/trace_functions.c The resulted trace is processed into a tree to produce a more human view of the call stack by drawing textual but hierarchical tree of -calls. Only the functions's names and the the call time are provided. +calls. Only the functions's names and the call time are provided. Usage: Be sure that you have CONFIG_FUNCTION_TRACER
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 4/5 tracing/eprobe: Show syntax error logs in error_log file
In reply to Steven RostedtFrom: "Masami Hiramatsu (Google)" <[email protected]>
Show the syntax errors for event probes in error_log file as same as other dynamic events, so that user can understand what is the problem.
--- kernel/trace/trace_eprobe.c | 11 +++++++++-- kernel/trace/trace_probe.h | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-)
kernel/trace/trace_eprobe.c +9 -2
@@ -839,8 +839,11 @@ static int trace_eprobe_tp_update_arg(struct trace_eprobe *ep, const char *argv[if (ret)return ret; -if (ep->tp.args[i].code->op ==FETCH_OP_TP_ARG ) +if (ep->tp.args[i].code->op ==FETCH_OP_TP_ARG ) { ret =trace_eprobe_tp_arg_update (ep, i); +if (ret) +trace_probe_log_err (0 ,BAD_ATTACH_ARG ); + }return ret; }
@@ -880,8 +883,10 @@ static int __trace_eprobe_create(int argc, const char *argv[])trace_probe_log_set_index (1 ); sys_event = argv[1 ]; ret =traceprobe_parse_event_name (&sys_event, &sys_name, buf2,0 ); -if (!sys_event || !sys_name) +if (!sys_event || !sys_name) { +trace_probe_log_err (0 ,NO_EVENT_INFO ); goto parse_error; + }if (!event) {strscpy (buf1, argv[1 ],MAX_EVENT_NAME_LEN );
@@ -896,6 +901,8 @@ static int __trace_eprobe_create(int argc, const char *argv[])if (IS_ERR (ep)) { ret =PTR_ERR (ep); +if (ret == -ENODEV ) +trace_probe_log_err (0 ,BAD_ATTACH_EVENT );/* This must return -ENOMEM or missing event, else there is a bug */ WARN_ON_ONCE (ret != -ENOMEM && ret != -ENODEV ); ep =NULL ;
kernel/trace/trace_probe.h +4 -1
@@ -442,7 +442,10 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,C (FAIL_REG_PROBE ,"Failed to register probe event" ),\C (DIFF_PROBE_TYPE ,"Probe type is different from existing probe" ),\C (DIFF_ARG_TYPE ,"Argument type or name is different from existing probe" ),\ -C (SAME_PROBE ,"There is already the exact same probe event" ), +C (SAME_PROBE ,"There is already the exact same probe event" ),\ +C (NO_EVENT_INFO ,"This requires both group and event name to attach" ),\ +C (BAD_ATTACH_EVENT ,"Attached event does not exist" ),\ +C (BAD_ATTACH_ARG ,"Attached event does not have this field" ), #undef C #define C(a, b) TP_ERR_##a
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 5/5 tracing: Use alignof__(struct {type b;}) instead of offsetof()
In reply to Steven RostedtFrom: "Steven Rostedt (Google)" <[email protected]>
Simplify:
#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b)))with
#define ALIGN_STRUCTFIELD(type) __alignof__(struct {type b;})Which works just the same.
--- include/trace/stages/stage4_event_fields.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/stages/stage4_event_fields.h +1 -1
@@ -2,7 +2,7 @@/* Stage 4 definitions for creating trace events */ -#define ALIGN_STRUCTFIELD (type) ((int)(offsetof(struct {char a; type b;}, b))) +#define ALIGN_STRUCTFIELD (type) ((int)(__alignof__(struct {type b;})))#undef __field_ext#define __field_ext (_type, _item, _filter_type) { \
Signature · 1 line
2.35.1