]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jun 2021 15:43:21 +0000 (17:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jun 2021 15:43:21 +0000 (17:43 +0200)
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

queue-4.4/series
queue-4.4/tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch [new file with mode: 0644]
queue-4.4/tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch [new file with mode: 0644]

index 6d7a10764ce1ddfc5690d4eef1b8cc753877acb5..2fbe5bf3af7d30946302fa56759e7eae6c6bccf6 100644 (file)
@@ -36,3 +36,5 @@ arcv2-save-abi-registers-across-signal-handling.patch
 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
+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.4/tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch b/queue-4.4/tracing-do-not-stop-recording-cmdlines-when-tracing-is-off.patch
new file mode 100644 (file)
index 0000000..adfbf43
--- /dev/null
@@ -0,0 +1,53 @@
+From 85550c83da421fb12dc1816c45012e1e638d2b38 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
+Date: Thu, 17 Jun 2021 13:47:25 -0400
+Subject: tracing: Do not stop recording cmdlines when tracing is off
+
+From: Steven Rostedt (VMware) <rostedt@goodmis.org>
+
+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) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace.c |    3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -1635,9 +1635,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.4/tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch b/queue-4.4/tracing-do-not-stop-recording-comms-if-the-trace-file-is-being-read.patch
new file mode 100644 (file)
index 0000000..e76e4d4
--- /dev/null
@@ -0,0 +1,56 @@
+From 4fdd595e4f9a1ff6d93ec702eaecae451cfc6591 Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
+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) <rostedt@goodmis.org>
+
+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) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/trace.c |    9 ---------
+ 1 file changed, 9 deletions(-)
+
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -1369,9 +1369,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];
+@@ -2497,9 +2494,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;
+@@ -2542,9 +2536,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();
+ }