From: Greg Kroah-Hartman Date: Mon, 21 Jun 2021 15:43:37 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v5.4.128~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6bd935d7ffdfcd841064c1b1d09563f0805b09b8;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch --- diff --git a/queue-4.9/series b/queue-4.9/series index 0ce26ae467e..d8816346817 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -44,3 +44,5 @@ dmaengine-pl330-fix-wrong-usage-of-spinlock-flags-in-dma_cyclc.patch net-fec_ptp-add-clock-rate-zero-check.patch can-bcm-raw-isotp-use-per-module-netdevice-notifier.patch usb-dwc3-core-fix-kernel-panic-when-do-reboot.patch +tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch +tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch diff --git a/queue-4.9/tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch b/queue-4.9/tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch new file mode 100644 index 00000000000..0114fc0bfa5 --- /dev/null +++ b/queue-4.9/tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch @@ -0,0 +1,53 @@ +From 85550c83da421fb12dc1816c45012e1e638d2b38 Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (VMware)" +Date: Thu, 17 Jun 2021 13:47:25 -0400 +Subject: tracing: Do not stop recording cmdlines when tracing is off + +From: Steven Rostedt (VMware) + +commit 85550c83da421fb12dc1816c45012e1e638d2b38 upstream. + +The saved_cmdlines is used to map pids to the task name, such that the +output of the tracing does not just show pids, but also gives a human +readable name for the task. + +If the name is not mapped, the output looks like this: + + <...>-1316 [005] ...2 132.044039: ... + +Instead of this: + + gnome-shell-1316 [005] ...2 132.044039: ... + +The names are updated when tracing is running, but are skipped if tracing +is stopped. Unfortunately, this stops the recording of the names if the +top level tracer is stopped, and not if there's other tracers active. + +The recording of a name only happens when a new event is written into a +ring buffer, so there is no need to test if tracing is on or not. If +tracing is off, then no event is written and no need to test if tracing is +off or not. + +Remove the check, as it hides the names of tasks for events in the +instance buffers. + +Cc: stable@vger.kernel.org +Fixes: 7ffbd48d5cab2 ("tracing: Cache comms only after an event occurred") +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -1882,9 +1882,6 @@ void trace_find_cmdline(int pid, char co + + void tracing_record_cmdline(struct task_struct *tsk) + { +- if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on()) +- return; +- + if (!__this_cpu_read(trace_cmdline_save)) + return; + diff --git a/queue-4.9/tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch b/queue-4.9/tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch new file mode 100644 index 00000000000..92a9725ddab --- /dev/null +++ b/queue-4.9/tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch @@ -0,0 +1,56 @@ +From 4fdd595e4f9a1ff6d93ec702eaecae451cfc6591 Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (VMware)" +Date: Thu, 17 Jun 2021 14:32:34 -0400 +Subject: tracing: Do not stop recording comms if the trace file is being read + +From: Steven Rostedt (VMware) + +commit 4fdd595e4f9a1ff6d93ec702eaecae451cfc6591 upstream. + +A while ago, when the "trace" file was opened, tracing was stopped, and +code was added to stop recording the comms to saved_cmdlines, for mapping +of the pids to the task name. + +Code has been added that only records the comm if a trace event occurred, +and there's no reason to not trace it if the trace file is opened. + +Cc: stable@vger.kernel.org +Fixes: 7ffbd48d5cab2 ("tracing: Cache comms only after an event occurred") +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace.c | 9 --------- + 1 file changed, 9 deletions(-) + +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -1616,9 +1616,6 @@ struct saved_cmdlines_buffer { + }; + static struct saved_cmdlines_buffer *savedcmd; + +-/* temporary disable recording */ +-static atomic_t trace_record_cmdline_disabled __read_mostly; +- + static inline char *get_saved_cmdlines(int idx) + { + return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN]; +@@ -2825,9 +2822,6 @@ static void *s_start(struct seq_file *m, + return ERR_PTR(-EBUSY); + #endif + +- if (!iter->snapshot) +- atomic_inc(&trace_record_cmdline_disabled); +- + if (*pos != iter->pos) { + iter->ent = NULL; + iter->cpu = 0; +@@ -2870,9 +2864,6 @@ static void s_stop(struct seq_file *m, v + return; + #endif + +- if (!iter->snapshot) +- atomic_dec(&trace_record_cmdline_disabled); +- + trace_access_unlock(iter->cpu_file); + trace_event_read_unlock(); + }