[PATCH -next-20080709] fixup stop_machine use cpu mask vs ftrace

Subsystems: function hooks (ftrace), the rest, tracing

STALE6597d

5 messages, 3 authors, 2008-07-11 · open the first message on its own page

[PATCH -next-20080709] fixup stop_machine use cpu mask vs ftrace

From: Milton Miller <hidden>
Date: 2008-07-10 21:40:26


Hi Rusty, Ingo.

Rusty's patch [PATCH 3/3] stop_machine: use cpu mask rather than magic numbers
didn't find kernel/trace/ftrace.c in -next, causing an immediate almost NULL
pointer dereference in ftrace_dynamic_init.


Signed-off-by: Milton Miller <redacted>
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0f271c4..c29acb5 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -587,7 +587,7 @@ static int __ftrace_modify_code(void *data)
 
 static void ftrace_run_update_code(int command)
 {
-	stop_machine_run(__ftrace_modify_code, &command, NR_CPUS);
+	stop_machine_run(__ftrace_modify_code, &command, NULL);
 }
 
 void ftrace_disable_daemon(void)
@@ -787,7 +787,7 @@ static int ftrace_update_code(void)
 	    !ftrace_enabled || !ftraced_trigger)
 		return 0;
 
-	stop_machine_run(__ftrace_update_code, NULL, NR_CPUS);
+	stop_machine_run(__ftrace_update_code, NULL, NULL);
 
 	return 1;
 }
@@ -1564,7 +1564,7 @@ static int __init ftrace_dynamic_init(void)
 
 	addr = (unsigned long)ftrace_record_ip;
 
-	stop_machine_run(ftrace_dyn_arch_init, &addr, NR_CPUS);
+	stop_machine_run(ftrace_dyn_arch_init, &addr, NULL);
 
 	/* ftrace_dyn_arch_init places the return code in addr */
 	if (addr) {

Re: [PATCH -next-20080709] fixup stop_machine use cpu mask vs ftrace

From: Rusty Russell <hidden>
Date: 2008-07-11 06:43:44

On Friday 11 July 2008 07:07:57 Milton Miller wrote:
Hi Rusty, Ingo.

Rusty's patch [PATCH 3/3] stop_machine: use cpu mask rather than magic
numbers didn't find kernel/trace/ftrace.c in -next, causing an immediate
almost NULL pointer dereference in ftrace_dynamic_init.
Yes, I'm switching the patches around, so it does the transition correctly. 
Introduces a new stop_machine() fn with the new interface and deprecates the 
old stop_machine_run().  We can remove stop_machine_run() after everyone is 
switched.

Thanks,
Rusty.

Re: [PATCH -next-20080709] fixup stop_machine use cpu mask vs ftrace

From: Ingo Molnar <hidden>
Date: 2008-07-11 07:46:51

* Milton Miller [off-list ref] wrote:
Hi Rusty, Ingo.

Rusty's patch [PATCH 3/3] stop_machine: use cpu mask rather than magic 
numbers didn't find kernel/trace/ftrace.c in -next, causing an 
immediate almost NULL pointer dereference in ftrace_dynamic_init.
Rusty - what's going on here? Please do not change APIs like that, which 
cause code to crash. Either do a compatible API change, or change it 
over in a way that causes clear build failures, not crashes.

	Ingo

Re: [PATCH -next-20080709] fixup stop_machine use cpu mask vs ftrace

From: Ingo Molnar <hidden>
Date: 2008-07-11 08:56:20

* Ingo Molnar [off-list ref] wrote:
* Milton Miller [off-list ref] wrote:
quoted
Hi Rusty, Ingo.

Rusty's patch [PATCH 3/3] stop_machine: use cpu mask rather than magic 
numbers didn't find kernel/trace/ftrace.c in -next, causing an 
immediate almost NULL pointer dereference in ftrace_dynamic_init.
Rusty - what's going on here? Please do not change APIs like that, 
which cause code to crash. Either do a compatible API change, or 
change it over in a way that causes clear build failures, not crashes.
ah, i see it from Rusty's other reply that there's going to be another 
version of this. Good :-)

	Ingo

Re: [PATCH -next-20080709] fixup stop_machine use cpu mask vs ftrace

From: Rusty Russell <hidden>
Date: 2008-07-11 12:34:24

On Friday 11 July 2008 17:46:03 Ingo Molnar wrote:
* Milton Miller [off-list ref] wrote:
quoted
Hi Rusty, Ingo.

Rusty's patch [PATCH 3/3] stop_machine: use cpu mask rather than magic
numbers didn't find kernel/trace/ftrace.c in -next, causing an
immediate almost NULL pointer dereference in ftrace_dynamic_init.
Rusty - what's going on here? Please do not change APIs like that, which
cause code to crash. Either do a compatible API change, or change it
over in a way that causes clear build failures, not crashes.
To be fair, I did.  Unfortunately GCC only warns about passing an int to a 
pointer arg, and boom.

But compatible is even better.  Given the number of stop_machine_run users I 
thought it unlikely that a new one would be introduced during the change.  I 
was wrong, so I'll do it the Right Way.

Cheers,
Rusty.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help