Skip to contentSkip to conversation

Patch "tracing: Fix incorrect enabling of trace events by boot cmdline" has been added to the 3.19-stable tree

PATCH [email protected] 1 participant 1 message May 2, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tracing: Fix incorrect enabling of trace events by boot cmdline

to the 3.19-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tracing-fix-incorrect-enabling-of-trace-events-by-boot-cmdline.patch
and it can be found in the queue-3.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 84fce9db4d7eaebd6cb2ee30c15da6d4e4daf846 Mon Sep 17 00:00:00 2001

From: Joonsoo Kim <[email protected]>
Date: Thu, 16 Apr 2015 13:44:44 +0900
Subject: tracing: Fix incorrect enabling of trace events by boot cmdline

From: Joonsoo Kim <[email protected]>

commit 84fce9db4d7eaebd6cb2ee30c15da6d4e4daf846 upstream.

There is a problem that trace events are not properly enabled with boot cmdline. The problem is that if we pass "trace_event=kmem:mm_page_alloc" to the boot cmdline, it enables all kmem trace events, and not just the page_alloc event.

This is caused by the parsing mechanism. When we parse the cmdline, the buffer contents is modified due to tokenization. And, if we use this buffer again, we will get the wrong result.

Unfortunately, this buffer is be accessed three times to set trace events properly at boot time. So, we need to handle this situation.

There is already code handling ",", but we need another for ":". This patch adds it.

[ added missing return ret; ]
---
 kernel/trace/trace_events.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/trace/trace_events.c +8 -1
@@ -565,6 +565,7 @@ static int __ftrace_set_clr_event(struct
 static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
 {
 	char *event = NULL, *sub = NULL, *match;
+	int ret;
 
 	/*
 	 * The buf format can be <subsystem>:<event-name>
@@ -590,7 +591,13 @@ static int ftrace_set_clr_event(struct t
 			event = NULL;
 	}
 
-	return __ftrace_set_clr_event(tr, match, sub, event, set);
+	ret = __ftrace_set_clr_event(tr, match, sub, event, set);
+
+	/* Put back the colon to allow this to be called again */
+	if (buf)
+		*(buf - 1) = ':';
+
+	return ret;
 }
 
 /**

Patches currently in stable-queue which might be from [email protected] are

queue-3.19/tracing-fix-incorrect-enabling-of-trace-events-by-boot-cmdline.patch