Skip to contentSkip to conversation

tracing: do not create option file latency-format

PATCH In review Changbin Du 2 participants 3 messages May 16, 2020 – May 17, 2020 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: do not create option file latency-format

The flag LATENCY_FMT actually is usually set by latency tracers internally. So I think we should not export it to userspace. This patch removes the option file 'latency-format' but keep the flag defined as usual.

---
 kernel/trace/trace.c | 4 ++++
 kernel/trace/trace.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)
kernel/trace/trace.c +4 -0
index 29615f15a820..0d190e0021d5 100644
@@ -4733,6 +4733,8 @@ static int tracing_trace_options_show(struct seq_file *m, void *v)
 	trace_opts = tr->current_trace->flags->opts;
 
 	for (i = 0; trace_options[i]; i++) {
+		if (strlen(trace_options[i]) == 0)
+			continue;
 		if (tr->trace_flags & (1 << i))
 			seq_printf(m, "%s\n", trace_options[i]);
 		else
@@ -8359,6 +8361,8 @@ static void create_trace_options_dir(struct trace_array *tr)
 		return;
 
 	for (i = 0; trace_options[i]; i++) {
+		if (strlen(trace_options[i]) == 0)
+			continue;
 		if (top_level ||
 		    !((1 << i) & TOP_LEVEL_TRACE_FLAGS))
 			create_trace_option_core_file(tr, trace_options[i], i);
kernel/trace/trace.h +3 -1
index 4eb1d004d5f2..6d9f0bba09c3 100644
@@ -1264,6 +1264,8 @@ extern void trace_parser_put(struct trace_parser *parser);
 extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
 	size_t cnt, loff_t *ppos);
 
+#define TRACE_OPTION_HIDE_NAME	""
+
 /*
  * Only create function graph options if function graph is configured.
  */
@@ -1321,7 +1323,7 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
 		C(SYM_USEROBJ,		"sym-userobj"),		\
 		C(PRINTK_MSGONLY,	"printk-msg-only"),	\
 		C(CONTEXT_INFO,		"context-info"),   /* Print pid/cpu/time */ \
-		C(LATENCY_FMT,		"latency-format"),	\
+		C(LATENCY_FMT,		TRACE_OPTION_HIDE_NAME),\
 		C(RECORD_CMD,		"record-cmd"),		\
 		C(RECORD_TGID,		"record-tgid"),		\
 		C(OVERWRITE,		"overwrite"),		\
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 6 lines · On Sun, 17 May 2020 00:10:17 +0800 Changbin Du <[email protected]> wrote:

The flag LATENCY_FMT actually is usually set by latency tracers internally. So I think we should not export it to userspace. This patch removes the option file 'latency-format' but keep the flag defined as usual.

---

Sorry, I actually do sometimes use that option for things other than latency tracers. So NACK.

-- Steve

#2 lore raw

Hi Steven,

Quoted 7 lines · Steven Rostedt
Quoted 4 lines · On Sun, 17 May 2020 00:10:17 +0800 Changbin Du <[email protected]> wrote:

The flag LATENCY_FMT actually is usually set by latency tracers internally. So I think we should not export it to userspace. This patch removes the option file 'latency-format' but keep the flag defined as usual.

Quoted 6 lines
Quoted 2 lines

---

Sorry, I actually do sometimes use that option for things other than latency tracers. So NACK.

May I know which tracer use this option as well? As far as I know, besides latency tracers, the fgraph tracer also uses it.

I think 'irq-info' and 'latency-format' is somewhat overlaps. So my thought is:
1) function and function graph tracers should use irq-info.
2) latency tracers should set latency-format.

I am not quite sure whether this is a good idea. :)

Quoted 1 line

-- Steve

Signature · 2 lines
Cheers,
Changbin Du