提交 fbb1d85b 编写于 作者: S Steven Rostedt (VMware) 提交者: Yang Yingliang

tracing: Do not stop recording comms if the trace file is being read

stable inclusion
from linux-4.19.196
commit 04e7a7c95027e72bba8973e1c4b9b4a1b29f7a0c

--------------------------------

commit 4fdd595e 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: 7ffbd48d ("tracing: Cache comms only after an event occurred")
Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 0b2ba3ef
...@@ -1741,9 +1741,6 @@ struct saved_cmdlines_buffer { ...@@ -1741,9 +1741,6 @@ struct saved_cmdlines_buffer {
}; };
static struct saved_cmdlines_buffer *savedcmd; static struct saved_cmdlines_buffer *savedcmd;
/* temporary disable recording */
static atomic_t trace_record_taskinfo_disabled __read_mostly;
static inline char *get_saved_cmdlines(int idx) static inline char *get_saved_cmdlines(int idx)
{ {
return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN]; return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN];
...@@ -3254,9 +3251,6 @@ static void *s_start(struct seq_file *m, loff_t *pos) ...@@ -3254,9 +3251,6 @@ static void *s_start(struct seq_file *m, loff_t *pos)
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
#endif #endif
if (!iter->snapshot)
atomic_inc(&trace_record_taskinfo_disabled);
if (*pos != iter->pos) { if (*pos != iter->pos) {
iter->ent = NULL; iter->ent = NULL;
iter->cpu = 0; iter->cpu = 0;
...@@ -3299,9 +3293,6 @@ static void s_stop(struct seq_file *m, void *p) ...@@ -3299,9 +3293,6 @@ static void s_stop(struct seq_file *m, void *p)
return; return;
#endif #endif
if (!iter->snapshot)
atomic_dec(&trace_record_taskinfo_disabled);
trace_access_unlock(iter->cpu_file); trace_access_unlock(iter->cpu_file);
trace_event_read_unlock(); trace_event_read_unlock();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册