Skip to contentSkip to conversation

call stop_machine_text_poke() on all cpus

PATCH In review Jason Baron 3 participants 4 messages Oct 28, 2010 – Oct 30, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 call stop_machine_text_poke() on all cpus

Currently, text_poke_smp() passes a NULL as the third argument to __stop_machine(), which will only run stop_machine_text_poke() on 1 cpu. Change NULL -> cpu_online_mask, as stop_machine_text_poke() is intended to be run on all cpus.

I actually didn't notice any problems with stop_machine_text_poke() only being called on 1 cpu, but found this via code inspection.

---
 arch/x86/kernel/alternative.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/alternative.c +1 -1
index 9f39a1c..3c3f26f 100644
@@ -705,6 +705,6 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
 	atomic_set(&stop_machine_first, 1);
 	wrote_text = 0;
 	/* Use __stop_machine() because the caller already got online_cpus. */
-	__stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
+	__stop_machine(stop_machine_text_poke, (void *)&tpp, cpu_online_mask);
 	return addr;
 }
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · * Jason Baron ([email protected]) wrote:

Currently, text_poke_smp() passes a NULL as the third argument to __stop_machine(), which will only run stop_machine_text_poke() on 1 cpu. Change NULL -> cpu_online_mask, as stop_machine_text_poke() is intended to be run on all cpus.

I actually didn't notice any problems with stop_machine_text_poke() only being called on 1 cpu, but found this via code inspection.

Good catch!

The side-effect of this is that the other CPUs are not executing the memory barrier and not flushing the icache, as we would normally expect.

Thanks,

Quoted 19 lines
---
 arch/x86/kernel/alternative.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/alternative.c +1 -1
index 9f39a1c..3c3f26f 100644
@@ -705,6 +705,6 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
 	atomic_set(&stop_machine_first, 1);
 	wrote_text = 0;
 	/* Use __stop_machine() because the caller already got online_cpus. */
-	__stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
+	__stop_machine(stop_machine_text_poke, (void *)&tpp, cpu_online_mask);
 	return addr;
 }
Signature · 1 line
1.7.1
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
Acked-by on v1 1/1
#2 lore raw
In reply to Jason Baron
Quoted 4 lines · Jason Baron

Currently, text_poke_smp() passes a NULL as the third argument to __stop_machine(), which will only run stop_machine_text_poke() on 1 cpu. Change NULL -> cpu_online_mask, as stop_machine_text_poke() is intended to be run on all cpus.

That should be my misunderstand...

Quoted 3 lines

I actually didn't notice any problems with stop_machine_text_poke() only being called on 1 cpu, but found this via code inspection.

Thank you very much!

Quoted 18 lines
---
 arch/x86/kernel/alternative.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/alternative.c +1 -1
index 9f39a1c..3c3f26f 100644
@@ -705,6 +705,6 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
 	atomic_set(&stop_machine_first, 1);
 	wrote_text = 0;
 	/* Use __stop_machine() because the caller already got online_cpus. */
-	__stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
+	__stop_machine(stop_machine_text_poke, (void *)&tpp, cpu_online_mask);
 	return addr;
 }
Signature · 4 lines
Masami HIRAMATSU
2nd Dept. Linux Technology Center
Hitachi, Ltd., Systems Development Laboratory
E-mail: [email protected]
#3 lore raw

[tip:x86/urgent] x86, alternative: Call stop_machine_text_poke() on all cpus

In reply to Jason Baron
Commit-ID:  404ba5d7bb958d3d788bdaa0debc0bdf60f13ffe
Gitweb:     http://git.kernel.org/tip/404ba5d7bb958d3d788bdaa0debc0bdf60f13ffe
Author:     Jason Baron <[email protected]>
AuthorDate: Thu, 28 Oct 2010 11:20:27 -0400
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Fri, 29 Oct 2010 16:42:58 -0700

x86, alternative: Call stop_machine_text_poke() on all cpus

Currently, text_poke_smp() passes a NULL as the third argument to __stop_machine(), which will only run stop_machine_text_poke() on 1 cpu. Change NULL -> cpu_online_mask, as stop_machine_text_poke() is intended to be run on all cpus.

I actually didn't notice any problems with stop_machine_text_poke() only being called on 1 cpu, but found this via code inspection.

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/alternative.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/alternative.c +1 -1
index a36bb90..5ceeca3 100644
@@ -638,7 +638,7 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
 	atomic_set(&stop_machine_first, 1);
 	wrote_text = 0;
 	/* Use __stop_machine() because the caller already got online_cpus. */
-	__stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
+	__stop_machine(stop_machine_text_poke, (void *)&tpp, cpu_online_mask);
 	return addr;
 }