History

Merge tag 'trace-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Tracing fixes for 5.15: - Fix defined but not use warning/error for osnoise function - Fix memory leak in event probe - Fix memblock leak in bootconfig - Fix the API of event probes to be like kprobes - Added test to check removal of event probe API - Fix recordmcount.pl for nds32 failed build * tag 'trace-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: nds32/ftrace: Fix Error: invalid operands (*UND* and *UND* sections) for `^' selftests/ftrace: Update test for more eprobe removal process tracing: Fix event probe removal from dynamic events tracing: Fix missing * in comment block bootconfig: init: Fix memblock leak in xbc_make_cmdline() tracing: Fix memory leak in eprobe_register() tracing: Fix missing osnoise tracer on max_latency

Linus Torvalds committed 5 years ago

Commit 368a9782 parents 6985c40 be358af6 files · +117 −14Browse files

Showing the changes to kernel (3 of 6 files). Show all

Unified · Split

3 files
  1. kernel/trace/trace.c +4 −7
  2. kernel/trace/trace_eprobe.c +58 −3
  3. kernel/trace/trace_events_hist.c +1 −1
kernel/trace/trace.c+4−7
@@ -1744,16 +1744,15 @@ void latency_fsnotify(struct trace_array *tr) · 1743 unmodified lines
17441744 irq_work_queue(&tr->fsnotify_irqwork);
17451745 }
17461746
1747−/*
1748− * (defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)) && \
1749− * defined(CONFIG_FSNOTIFY)
1750− */
1751−#else
1747+#elif defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) \
1748+ || defined(CONFIG_OSNOISE_TRACER)
17521749
17531750 #define trace_create_maxlat_file(tr, d_tracer) \
17541751 trace_create_file("tracing_max_latency", 0644, d_tracer, \
17551752 &tr->max_latency, &tracing_max_lat_fops)
17561753
1754+#else
1755+#define trace_create_maxlat_file(tr, d_tracer) do { } while (0)
17571756 #endif
17581757
17591758 #ifdef CONFIG_TRACER_MAX_TRACE
@@ -9473,9 +9472,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer) · 7713 unmodified lines
94739472
94749473 create_trace_options_dir(tr);
94759474
9476−#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
94779475 trace_create_maxlat_file(tr, d_tracer);
9478−#endif
94799476
94809477 if (ftrace_create_function_files(tr, d_tracer))
94819478 MEM_FAIL(1, "Could not allocate function filter files");
kernel/trace/trace_eprobe.c+58−3
@@ -119,10 +119,58 @@ static bool eprobe_dyn_event_match(const char *system, const char *event, · 118 unmodified lines
119119 int argc, const char **argv, struct dyn_event *ev)
120120 {
121121 struct trace_eprobe *ep = to_trace_eprobe(ev);
122+ const char *slash;
122123
123− return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
124− (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
125− trace_probe_match_command_args(&ep->tp, argc, argv);
124+ /*
125+ * We match the following:
126+ * event only - match all eprobes with event name
127+ * system and event only - match all system/event probes
128+ *
129+ * The below has the above satisfied with more arguments:
130+ *
131+ * attached system/event - If the arg has the system and event
132+ * the probe is attached to, match
133+ * probes with the attachment.
134+ *
135+ * If any more args are given, then it requires a full match.
136+ */
137+
138+ /*
139+ * If system exists, but this probe is not part of that system
140+ * do not match.
141+ */
142+ if (system && strcmp(trace_probe_group_name(&ep->tp), system) != 0)
143+ return false;
144+
145+ /* Must match the event name */
146+ if (strcmp(trace_probe_name(&ep->tp), event) != 0)
147+ return false;
148+
149+ /* No arguments match all */
150+ if (argc < 1)
151+ return true;
152+
153+ /* First argument is the system/event the probe is attached to */
154+
155+ slash = strchr(argv[0], '/');
156+ if (!slash)
157+ slash = strchr(argv[0], '.');
158+ if (!slash)
159+ return false;
160+
161+ if (strncmp(ep->event_system, argv[0], slash - argv[0]))
162+ return false;
163+ if (strcmp(ep->event_name, slash + 1))
164+ return false;
165+
166+ argc--;
167+ argv++;
168+
169+ /* If there are no other args, then match */
170+ if (argc < 1)
171+ return true;
172+
173+ return trace_probe_match_command_args(&ep->tp, argc, argv);
126174 }
127175
128176 static struct dyn_event_operations eprobe_dyn_event_ops = {
@@ -632,6 +680,13 @@ static int disable_eprobe(struct trace_eprobe *ep, · 503 unmodified lines
632680
633681 trace_event_trigger_enable_disable(file, 0);
634682 update_cond_flag(file);
683+
684+ /* Make sure nothing is using the edata or trigger */
685+ tracepoint_synchronize_unregister();
686+
687+ kfree(edata);
688+ kfree(trigger);
689+
635690 return 0;
636691 }
637692
kernel/trace/trace_events_hist.c+1−1
@@ -2506,7 +2506,7 @@ find_synthetic_field_var(struct hist_trigger_data *target_hist_data, · 2505 unmodified lines
25062506 * events. However, for convenience, users are allowed to directly
25072507 * specify an event field in an action, which will be automatically
25082508 * converted into a variable on their behalf.
2509−
2509+ *
25102510 * If a user specifies a field on an event that isn't the event the
25112511 * histogram currently being defined (the target event histogram), the
25122512 * only way that can be accomplished is if a new hist trigger is