Skip to contentSkip to conversation

ftrace: Consistently restore trace function on sysctl enabling

PATCH In review Jan Kiszka 2 participants 3 messages Mar 26, 2013

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 ftrace: Consistently restore trace function on sysctl enabling

If we reenable ftrace via syctl, we currently set ftrace_trace_function based on the previous simplistic algorithm. This is inconsistent with what update_ftrace_function does. So better call that helper instead.

---
 kernel/trace/ftrace.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
kernel/trace/ftrace.c +2 -6
index 62b71f6..b9b90f0 100644
@@ -4538,12 +4538,8 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
 		ftrace_startup_sysctl();
 
 		/* we are starting ftrace again */
-		if (ftrace_ops_list != &ftrace_list_end) {
-			if (ftrace_ops_list->next == &ftrace_list_end)
-				ftrace_trace_function = ftrace_ops_list->func;
-			else
-				ftrace_trace_function = ftrace_ops_list_func;
-		}
+		if (ftrace_ops_list != &ftrace_list_end)
+			update_ftrace_function();
 
 	} else {
 		/* stopping ftrace calls (just send to ftrace_stub) */
Signature · 1 line
1.7.3.4
maintainer
#1 lore raw
Quoted 14 lines · Jan Kiszka

If we reenable ftrace via syctl, we currently set ftrace_trace_function based on the previous simplistic algorithm. This is inconsistent with what update_ftrace_function does. So better call that helper instead.

---
 kernel/trace/ftrace.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
kernel/trace/ftrace.c +0 -0
index 62b71f6..b9b90f0 100644

kernel/trace/ftrace.c ftrace_enable_sysctl(struct ctl_table *table, int write, · line 4546

Quoted 9 lines
kernel/trace/ftrace.c +0 -6
@@ -4538,12 +4538,8 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
 		ftrace_startup_sysctl();
 
 		/* we are starting ftrace again */
-		if (ftrace_ops_list != &ftrace_list_end) {
-			if (ftrace_ops_list->next == &ftrace_list_end)
-				ftrace_trace_function = ftrace_ops_list->func;
-			else
-				ftrace_trace_function = ftrace_ops_list_func;
-		}

I remember there was a reason why I didn't update this, but I can't remember why. Looking at it now, it doesn't look like there is a reason.

I'll have to think about this one more. Another score for not commenting :-p

Thanks,

-- Steve

Quoted 5 lines
kernel/trace/ftrace.c +2 -0
+		if (ftrace_ops_list != &ftrace_list_end)
+			update_ftrace_function();
 
 	} else {
 		/* stopping ftrace calls (just send to ftrace_stub) */
maintainer
#2 lore raw
Quoted 2 lines · Steven Rostedt

I remember there was a reason why I didn't update this, but I can't remember why. Looking at it now, it doesn't look like there is a reason.

I remember now. I didn't add it because the update_ftrace_function was too much at the time. It was still doing the basic updates, but it was also doing a bit more too. But this was before I added the extra checks. I didn't call it because it seemed to be an overkill. But that doesn't apply today.

Quoted 3 lines

I'll have to think about this one more. Another score for not commenting :-p

OK, I'll add it and it looks like it needs to go immediately, as well as way back to 3.0 stable.

Thanks!

-- Steve