Skip to contentSkip to conversation

perf probe: Correct probe syntax on command line help

PATCH Superseded Masami Hiramatsu 2 participants 6 messages Mar 3, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 perf probe: Correct probe syntax on command line help

Move @SRC right after FUNC in syntax according to syntax change on command line help.

Cc Ingo Molnar <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc K.Prasad <[email protected]>

---

 tools/perf/builtin-probe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/builtin-probe.c +1 -1
index e3dfd0d..c30a335 100644
@@ -177,7 +177,7 @@ static const struct option options[] = {
 #ifdef NO_DWARF_SUPPORT
 		"[EVENT=]FUNC[+OFF|%return] [ARG ...]",
 #else
-		"[EVENT=]FUNC[+OFF|%return|:RL|;PT][@SRC]|SRC:AL|SRC;PT"
+		"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
 		" [ARG ...]",
 #endif
 		"probe point definition, where\n"
Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
#1 lore raw

PATCH 2/2 x86: Issue at least one memory barrier in stop_machine_text_poke().

Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting loop. Also, use ACCESS_ONCE() to check a flag according to Mathieu's comment.

Cc Mathieu Desnoyers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jason Baron <[email protected]>

---

 arch/x86/kernel/alternative.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/alternative.c +3 -3
index 635e4f4..3236a11 100644
@@ -596,9 +596,9 @@ static int __kprobes stop_machine_text_poke(void *data)
 		smp_wmb();	/* Make sure other cpus see that this has run */
 		wrote_text = 1;
 	} else {
-		while (!wrote_text)
-			smp_rmb();
-		sync_core();
+		while (!ACCESS_ONCE(wrote_text))
+			cpu_relax();
+		smp_mb();	/* Load wrote_text before following execution */
 	}
 
 	flush_icache_range((unsigned long)tpp->addr,
Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
#2 lore raw

Re: [PATCH -tip 2/2] x86: Issue at least one memory barrier in stop_machine_text_poke().

Quoted 18 lines · * Masami Hiramatsu ([email protected]) wrote:

Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting loop. Also, use ACCESS_ONCE() to check a flag according to Mathieu's comment.

Cc Mathieu Desnoyers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jason Baron <[email protected]>

---

 arch/x86/kernel/alternative.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/alternative.c +0 -0
index 635e4f4..3236a11 100644

arch/x86/kernel/alternative.c static int __kprobes stop_machine_text_poke(void *data) · line 599

Quoted 7 lines
arch/x86/kernel/alternative.c +1 -3
@@ -596,9 +596,9 @@ static int __kprobes stop_machine_text_poke(void *data)
 		smp_wmb();	/* Make sure other cpus see that this has run */
 		wrote_text = 1;
 	} else {
-		while (!wrote_text)
-			smp_rmb();
-		sync_core();
+		while (!ACCESS_ONCE(wrote_text))

Well, cpu_relax() has a "memory" clobber, so the access once is not required to ensure the variable is re-read. And, sorry to contradict my previous statement somewhat, but given that we don't care if the compiler fetches wrote_text in chunks or not, ACCESS_ONCE() is not required here. So rather than leaving people wondering why we put an ACCESS_ONCE() here, it's probably better to leave it out.

Thanks,

Mathieu

Quoted 15 lines
arch/x86/kernel/alternative.c +2 -0
+			cpu_relax();
+		smp_mb();	/* Load wrote_text before following execution */
 	}
 
 	flush_icache_range((unsigned long)tpp->addr,
Signature · 8 lines
-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency Consultant
EfficiOS Inc.
http://www.efficios.com
#3 lore raw

Re: [PATCH -tip 2/2] x86: Issue at least one memory barrier in stop_machine_text_poke().

Quoted 25 lines · Mathieu Desnoyers
Quoted 24 lines · * Masami Hiramatsu ([email protected]) wrote:

Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting loop. Also, use ACCESS_ONCE() to check a flag according to Mathieu's comment.

Cc Mathieu Desnoyers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jason Baron <[email protected]>

---

 arch/x86/kernel/alternative.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/alternative.c +0 -3
index 635e4f4..3236a11 100644
@@ -596,9 +596,9 @@ static int __kprobes stop_machine_text_poke(void *data)
 		smp_wmb();	/* Make sure other cpus see that this has run */
 		wrote_text = 1;
 	} else {
-		while (!wrote_text)
-			smp_rmb();
-		sync_core();
Quoted 8 lines

arch/x86/kernel/alternative.c static int __kprobes stop_machine_text_poke(void *data) · line 599

Quoted 1 line
arch/x86/kernel/alternative.c +1 -0
+		while (!ACCESS_ONCE(wrote_text))

Well, cpu_relax() has a "memory" clobber, so the access once is not required to ensure the variable is re-read. And, sorry to contradict my previous statement somewhat, but given that we don't care if the compiler fetches wrote_text in chunks or not, ACCESS_ONCE() is not required here. So rather than leaving people wondering why we put an ACCESS_ONCE() here, it's probably better to leave it out.

Ah, OK. Indeed, volatile is for compiler...

Thank you,

Signature · 2 lines
Masami Hiramatsu
e-mail: [email protected]
#4 lore raw

PATCH 1/1 x86: Issue at least one memory barrier in stop_machine_text_poke().

In reply to Mathieu Desnoyers

Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting loop, and use cpu_relax() for waiting.

Cc Mathieu Desnoyers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jason Baron <[email protected]>

---

 arch/x86/kernel/alternative.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/alternative.c +2 -2
index 635e4f4..3a4bf35 100644
@@ -597,8 +597,8 @@ static int __kprobes stop_machine_text_poke(void *data)
 		wrote_text = 1;
 	} else {
 		while (!wrote_text)
-			smp_rmb();
-		sync_core();
+			cpu_relax();
+		smp_mb();	/* Load wrote_text before following execution */
 	}
 
 	flush_icache_range((unsigned long)tpp->addr,
Signature · 7 lines
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
Acked-by on v1 1/1
#5 lore raw

Re: [PATCH -tip] x86: Issue at least one memory barrier in stop_machine_text_poke().

Quoted 2 lines · * Masami Hiramatsu ([email protected]) wrote:

Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting loop, and use cpu_relax() for waiting.

Quoted 35 lines
Cc Mathieu Desnoyers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jason Baron <[email protected]>

---

 arch/x86/kernel/alternative.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/alternative.c +2 -2
index 635e4f4..3a4bf35 100644
@@ -597,8 +597,8 @@ static int __kprobes stop_machine_text_poke(void *data)
 		wrote_text = 1;
 	} else {
 		while (!wrote_text)
-			smp_rmb();
-		sync_core();
+			cpu_relax();
+		smp_mb();	/* Load wrote_text before following execution */
 	}
 
 	flush_icache_range((unsigned long)tpp->addr,
Signature · 8 lines
-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: [email protected]
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency Consultant
EfficiOS Inc.
http://www.efficios.com