You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(32) |
Jun
(66) |
Jul
(102) |
Aug
(78) |
Sep
(106) |
Oct
(137) |
Nov
(147) |
Dec
(147) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(71) |
Feb
(139) |
Mar
(86) |
Apr
(76) |
May
(57) |
Jun
(10) |
Jul
(12) |
Aug
(6) |
Sep
(8) |
Oct
(12) |
Nov
(12) |
Dec
(18) |
| 2011 |
Jan
(16) |
Feb
(19) |
Mar
(3) |
Apr
(1) |
May
(16) |
Jun
(17) |
Jul
(74) |
Aug
(22) |
Sep
(18) |
Oct
(24) |
Nov
(21) |
Dec
(30) |
| 2012 |
Jan
(31) |
Feb
(16) |
Mar
(22) |
Apr
(25) |
May
(18) |
Jun
(13) |
Jul
(83) |
Aug
(49) |
Sep
(20) |
Oct
(60) |
Nov
(35) |
Dec
(28) |
| 2013 |
Jan
(39) |
Feb
(61) |
Mar
(35) |
Apr
(21) |
May
(45) |
Jun
(56) |
Jul
(20) |
Aug
(9) |
Sep
(10) |
Oct
(31) |
Nov
(8) |
Dec
(4) |
| 2014 |
Jan
(6) |
Feb
(7) |
Mar
(7) |
Apr
(6) |
May
(4) |
Jun
(8) |
Jul
(5) |
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
(11) |
Dec
(5) |
| 2015 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(4) |
May
(9) |
Jun
(4) |
Jul
(15) |
Aug
(8) |
Sep
(16) |
Oct
(18) |
Nov
(15) |
Dec
(7) |
| 2016 |
Jan
(20) |
Feb
(9) |
Mar
(15) |
Apr
(24) |
May
(16) |
Jun
(28) |
Jul
(22) |
Aug
(23) |
Sep
(18) |
Oct
(30) |
Nov
(40) |
Dec
(9) |
| 2017 |
Jan
(1) |
Feb
(8) |
Mar
(37) |
Apr
(26) |
May
(25) |
Jun
(46) |
Jul
(24) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: tip-bot f. M. H. <mhi...@re...> - 2010-03-13 12:26:36
|
Commit-ID: 594087a04eea544356f9c52e83c1a9bc380ce80f Gitweb: http://git.kernel.org/tip/594087a04eea544356f9c52e83c1a9bc380ce80f Author: Masami Hiramatsu <mhi...@re...> AuthorDate: Fri, 12 Mar 2010 18:22:17 -0500 Committer: Ingo Molnar <mi...@el...> CommitDate: Sat, 13 Mar 2010 08:32:22 +0100 perf probe: Fix probe_point buffer overrun Fix probe_point array-size overrun problem. In some cases (e.g. inline function), one user-specified probe-point can be translated to many probe address, and it overruns pre-defined array-size. This also removes redundant MAX_PROBES macro definition. Signed-off-by: Masami Hiramatsu <mhi...@re...> Cc: systemtap <sys...@so...> Cc: DLE <dle...@li...> Cc: <st...@ke...> LKML-Reference: <20100312232217.2017.45017.stgit@localhost6.localdomain6> [ Note that only root can create new probes. Eventually we should remove the MAX_PROBES limit, but that is a larger patch not eligible to perf/urgent treatment. ] Signed-off-by: Ingo Molnar <mi...@el...> --- tools/perf/builtin-probe.c | 1 - tools/perf/util/probe-finder.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index c30a335..152d6c9 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -47,7 +47,6 @@ #include "util/probe-event.h" #define MAX_PATH_LEN 256 -#define MAX_PROBES 128 /* Session management structure */ static struct { diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 1e6c65e..f9cbbf1 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -455,6 +455,9 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf) /* *pf->fb_ops will be cached in libdw. Don't free it. */ pf->fb_ops = NULL; + if (pp->found == MAX_PROBES) + die("Too many( > %d) probe point found.\n", MAX_PROBES); + pp->probes[pp->found] = strdup(tmp); pp->found++; } |
|
From: Ingo M. <mi...@el...> - 2010-03-13 07:27:54
|
* Masami Hiramatsu <mhi...@re...> wrote: > config OPTPROBES > - bool "Kprobes jump optimization support (EXPERIMENTAL)" > - default y > - depends on KPROBES > + def_bool y > + depends on KPROBES && HAVE_OPTPROBES > depends on !PREEMPT > - depends on HAVE_OPTPROBES > select KALLSYMS_ALL > help > This option will allow kprobes to optimize breakpoint to The help text can be removed too, now that it's not interactive. Also, i'd suggest to add a comment that this just relays HAVE_OPTPROBES now, set by the arch. Ingo |
|
From: Masami H. <mhi...@re...> - 2010-03-12 23:14:10
|
Set need_dwarf if lazy matching pattern is specified, because lazy matching requires real source path for which we must use debuginfo. Signed-off-by: Masami Hiramatsu <mhi...@re...> Cc: Ingo Molnar <mi...@el...> --- tools/perf/util/probe-event.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 53181db..7c004b6 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -242,7 +242,7 @@ void parse_perf_probe_event(const char *str, struct probe_point *pp, /* Parse probe point */ parse_perf_probe_probepoint(argv[0], pp); - if (pp->file || pp->line) + if (pp->file || pp->line || pp->lazy_line) *need_dwarf = true; /* Copy arguments and ensure return probe has no C argument */ -- Masami Hiramatsu e-mail: mhi...@re... |
|
From: Masami H. <mhi...@re...> - 2010-03-12 23:14:06
|
Fix probe_point array-size overrun problem. In some cases (e.g. inline
function), one user-specified probe-point can be translated to many
probe address, and it overruns pre-defined array-size.
This also removes redundant MAX_PROBES macro definition.
Signed-off-by: Masami Hiramatsu <mhi...@re...>
Cc: Ingo Molnar <mi...@el...>
---
tools/perf/builtin-probe.c | 1 -
tools/perf/util/probe-finder.c | 3 +++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index c30a335..152d6c9 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -47,7 +47,6 @@
#include "util/probe-event.h"
#define MAX_PATH_LEN 256
-#define MAX_PROBES 128
/* Session management structure */
static struct {
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 1e6c65e..f9cbbf1 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -455,6 +455,9 @@ static void show_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
/* *pf->fb_ops will be cached in libdw. Don't free it. */
pf->fb_ops = NULL;
+ if (pp->found == MAX_PROBES)
+ die("Too many( > %d) probe point found.\n", MAX_PROBES);
+
pp->probes[pp->found] = strdup(tmp);
pp->found++;
}
--
Masami Hiramatsu
e-mail: mhi...@re...
|
|
From: Masami H. <mhi...@re...> - 2010-03-12 23:14:04
|
Hide CONFIG_OPTPROBES and set if arch support optimized kprobes, since this option doesn't change the behavior of kprobes, but just reduces the overhead. Signed-off-by: Masami Hiramatsu <mhi...@re...> Cc: Dieter Ries <ma...@di...> Cc: Ingo Molnar <mi...@el...> Cc: Ananth N Mavinakayanahalli <an...@in...> --- Documentation/kprobes.txt | 10 ++-------- arch/Kconfig | 6 ++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index 2f9115c..61c291c 100644 --- a/Documentation/kprobes.txt +++ b/Documentation/kprobes.txt @@ -165,8 +165,8 @@ the user entry_handler invocation is also skipped. 1.4 How Does Jump Optimization Work? -If you configured your kernel with CONFIG_OPTPROBES=y (currently -this option is supported on x86/x86-64, non-preemptive kernel) and +If your kernel is built with CONFIG_OPTPROBES=y (currently this flag +is automatically set 'y' on x86/x86-64, non-preemptive kernel) and the "debug.kprobes_optimization" kernel parameter is set to 1 (see sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump instruction instead of a breakpoint instruction at each probepoint. @@ -271,8 +271,6 @@ tweak the kernel's execution path, you need to suppress optimization, using one of the following techniques: - Specify an empty function for the kprobe's post_handler or break_handler. or -- Config CONFIG_OPTPROBES=n. - or - Execute 'sysctl -w debug.kprobes_optimization=n' 2. Architectures Supported @@ -307,10 +305,6 @@ it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), so you can use "objdump -d -l vmlinux" to see the source-to-object code mapping. -If you want to reduce probing overhead, set "Kprobes jump optimization -support" (CONFIG_OPTPROBES) to "y". You can find this option under the -"Kprobes" line. - 4. API Reference The Kprobes API includes a "register" function and an "unregister" diff --git a/arch/Kconfig b/arch/Kconfig index e5eb133..12f9dcc 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -42,11 +42,9 @@ config KPROBES If in doubt, say "N". config OPTPROBES - bool "Kprobes jump optimization support (EXPERIMENTAL)" - default y - depends on KPROBES + def_bool y + depends on KPROBES && HAVE_OPTPROBES depends on !PREEMPT - depends on HAVE_OPTPROBES select KALLSYMS_ALL help This option will allow kprobes to optimize breakpoint to -- Masami Hiramatsu e-mail: mhi...@re... |
|
From: tip-bot f. M. H. <mhi...@re...> - 2010-03-04 17:34:29
|
Commit-ID: 32cb0dd50672056e510ccab442dc9c3a03be649e Gitweb: http://git.kernel.org/tip/32cb0dd50672056e510ccab442dc9c3a03be649e Author: Masami Hiramatsu <mhi...@re...> AuthorDate: Wed, 3 Mar 2010 22:38:43 -0500 Committer: Ingo Molnar <mi...@el...> CommitDate: Thu, 4 Mar 2010 11:39:21 +0100 perf probe: Correct probe syntax on command line help Move @SRC right after FUNC in syntax according to syntax change on command line help. Signed-off-by: Masami Hiramatsu <mhi...@re...> Cc: systemtap <sys...@so...> Cc: DLE <dle...@li...> Cc: Frederic Weisbecker <fwe...@gm...> Cc: Arnaldo Carvalho de Melo <ac...@re...> Cc: Peter Zijlstra <pe...@in...> Cc: Paul Mackerras <pa...@sa...> Cc: Mike Galbraith <ef...@gm...> Cc: K.Prasad <pr...@li...> LKML-Reference: <20100304033843.3819.10087.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mi...@el...> --- tools/perf/builtin-probe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index e3dfd0d..c30a335 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -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" |
|
From: tip-bot f. M. H. <mhi...@re...> - 2010-03-04 17:34:06
|
Commit-ID: e5a11016643d1ab7172193591506d33a844734cc Gitweb: http://git.kernel.org/tip/e5a11016643d1ab7172193591506d33a844734cc Author: Masami Hiramatsu <mhi...@re...> AuthorDate: Wed, 3 Mar 2010 22:38:50 -0500 Committer: Ingo Molnar <mi...@el...> CommitDate: Thu, 4 Mar 2010 11:39:21 +0100 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, and use cpu_relax() for waiting. Changes in v2: - Don't use ACCESS_ONCE(). Signed-off-by: Masami Hiramatsu <mhi...@re...> Acked-by: Mathieu Desnoyers <mat...@ef...> Cc: systemtap <sys...@so...> Cc: DLE <dle...@li...> Cc: Jason Baron <jb...@re...> LKML-Reference: <20100304033850.3819.74590.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mi...@el...> --- arch/x86/kernel/alternative.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index c41f13c..e0b8770 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -595,8 +595,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, |
|
From: Masami H. <mhi...@re...> - 2010-03-04 03:32:33
|
Move @SRC right after FUNC in syntax according to syntax change
on command line help.
Signed-off-by: Masami Hiramatsu <mhi...@re...>
Cc: Ingo Molnar <mi...@el...>
Cc: Frederic Weisbecker <fwe...@gm...>
Cc: Arnaldo Carvalho de Melo <ac...@re...>
Cc: Peter Zijlstra <pe...@in...>
Cc: Paul Mackerras <pa...@sa...>
Cc: Mike Galbraith <ef...@gm...>
Cc: K.Prasad <pr...@li...>
---
tools/perf/builtin-probe.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index e3dfd0d..c30a335 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -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"
--
Masami Hiramatsu
e-mail: mhi...@re...
|
|
From: Masami H. <mhi...@re...> - 2010-03-04 03:32:33
|
Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting
loop, and use cpu_relax() for waiting.
Changes in v2:
- Don't use ACCESS_ONCE().
Signed-off-by: Masami Hiramatsu <mhi...@re...>
Acked-by: Mathieu Desnoyers <mat...@ef...>
Cc: Ingo Molnar <mi...@el...>
Cc: Jason Baron <jb...@re...>
---
arch/x86/kernel/alternative.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 635e4f4..3a4bf35 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -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,
--
Masami Hiramatsu
e-mail: mhi...@re...
|
|
From: Mathieu D. <mat...@ef...> - 2010-03-03 21:49:04
|
* Masami Hiramatsu (mhi...@re...) wrote:
> Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting
> loop, and use cpu_relax() for waiting.
Acked-by: Mathieu Desnoyers <mat...@ef...>
>
> Signed-off-by: Masami Hiramatsu <mhi...@re...>
> Cc: Mathieu Desnoyers <mat...@ef...>
> Cc: Ingo Molnar <mi...@el...>
> Cc: Jason Baron <jb...@re...>
> ---
>
> arch/x86/kernel/alternative.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 635e4f4..3a4bf35 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -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,
>
>
> --
> Masami Hiramatsu
>
> Software Engineer
> Hitachi Computer Products (America), Inc.
> Software Solutions Division
>
> e-mail: mhi...@re...
--
Mathieu Desnoyers
Operating System Efficiency Consultant
EfficiOS Inc.
http://www.efficios.com
|
|
From: Masami H. <mhi...@re...> - 2010-03-03 21:42:47
|
Fix stop_machine_text_poke() to issue smp_mb() before exiting waiting
loop, and use cpu_relax() for waiting.
Signed-off-by: Masami Hiramatsu <mhi...@re...>
Cc: Mathieu Desnoyers <mat...@ef...>
Cc: Ingo Molnar <mi...@el...>
Cc: Jason Baron <jb...@re...>
---
arch/x86/kernel/alternative.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 635e4f4..3a4bf35 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -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,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhi...@re...
|
|
From: Masami H. <mhi...@re...> - 2010-03-03 21:39:40
|
Mathieu Desnoyers wrote:
> * Masami Hiramatsu (mhi...@re...) 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.
>>
>> Signed-off-by: Masami Hiramatsu <mhi...@re...>
>> Cc: Mathieu Desnoyers <mat...@ef...>
>> Cc: Ingo Molnar <mi...@el...>
>> Cc: Jason Baron <jb...@re...>
>> ---
>>
>> arch/x86/kernel/alternative.c | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
>> index 635e4f4..3236a11 100644
>> --- a/arch/x86/kernel/alternative.c
>> +++ b/arch/x86/kernel/alternative.c
>> @@ -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.
Ah, OK. Indeed, volatile is for compiler...
Thank you,
--
Masami Hiramatsu
e-mail: mhi...@re...
|
|
From: Mathieu D. <mat...@ef...> - 2010-03-03 21:36:23
|
* Masami Hiramatsu (mhi...@re...) 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.
>
> Signed-off-by: Masami Hiramatsu <mhi...@re...>
> Cc: Mathieu Desnoyers <mat...@ef...>
> Cc: Ingo Molnar <mi...@el...>
> Cc: Jason Baron <jb...@re...>
> ---
>
> arch/x86/kernel/alternative.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 635e4f4..3236a11 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -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
> + cpu_relax();
> + smp_mb(); /* Load wrote_text before following execution */
> }
>
> flush_icache_range((unsigned long)tpp->addr,
>
>
> --
> Masami Hiramatsu
>
> Software Engineer
> Hitachi Computer Products (America), Inc.
> Software Solutions Division
>
> e-mail: mhi...@re...
--
Mathieu Desnoyers
Operating System Efficiency Consultant
EfficiOS Inc.
http://www.efficios.com
|
|
From: Masami H. <mhi...@re...> - 2010-03-03 21:22:40
|
Move @SRC right after FUNC in syntax according to syntax change
on command line help.
Signed-off-by: Masami Hiramatsu <mhi...@re...>
Cc: Ingo Molnar <mi...@el...>
Cc: Frederic Weisbecker <fwe...@gm...>
Cc: Arnaldo Carvalho de Melo <ac...@re...>
Cc: Peter Zijlstra <pe...@in...>
Cc: Paul Mackerras <pa...@sa...>
Cc: Mike Galbraith <ef...@gm...>
Cc: K.Prasad <pr...@li...>
---
tools/perf/builtin-probe.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index e3dfd0d..c30a335 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -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"
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhi...@re...
|
|
From: Masami H. <mhi...@re...> - 2010-03-03 21:20:58
|
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.
Signed-off-by: Masami Hiramatsu <mhi...@re...>
Cc: Mathieu Desnoyers <mat...@ef...>
Cc: Ingo Molnar <mi...@el...>
Cc: Jason Baron <jb...@re...>
---
arch/x86/kernel/alternative.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 635e4f4..3236a11 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -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,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhi...@re...
|
|
From: Mrs. F. <fri...@ya...> - 2010-03-03 01:55:58
|
Dear Applicant,
We take this opportunity to inform you about new job openings in the Offshore Oil and Gas Industry. At the moment there is a big need for new personnel (skilled and unskilled workers)to work on Offshore Oil platforms.
Our Company has experience in the overseas job market. We help applicant get a job. Due to the expansion in the North Sea (United Kingdom and Norway) more personnel will be required. Transjones Plc, UK provides employment solution to Applicants. Assisting companies and individuals easy access to overseas jobs.
If you are looking for employment, vacancies includes\"
Petroleum Engineer - Drilling Engineer - Mechanical Engineer - Electrical Engineer - Control Engineer - Chemical Engineer - Civil Engineer - Engineering Management in the Oil sector, Motor Mechanics, Chefs, Reservation Desk, Web Developer, IT Consultant, Qualified English Teacher ,Trained Nurse, Medical/Lab Attendant, Receptionist and Security Personnel.
Send your CV online at tra...@ya..., Resume options plans will be available soon to give your CV the needed attention.
The applicant must understand that Transjones Plc, UK shall put the applicant in direct contact with prospective employers for the applicant`s particulars occupation and in accordance with the applicant`s application. Your employers will shoulder the payment of visa and flight ticket of all selected employees. Other mouth-watering benefits awaits you.
Thanking you in advance for permitting us to be of service to you, and you will receive a follow- up letter from the Company as soon as we hear from you.
Sincerely,
Mrs.Felicia.
|
|
From: Mathieu D. <mat...@ef...> - 2010-03-03 01:04:52
|
* Masami Hiramatsu (mhi...@re...) wrote:
> Mathieu Desnoyers wrote:
> > * Masami Hiramatsu (mhi...@re...) wrote:
> [...]
> >> +
> >> +/*
> >> + * Cross-modifying kernel text with stop_machine().
> >> + * This code originally comes from immediate value.
> >> + */
> >> +static atomic_t stop_machine_first;
> >> +static int wrote_text;
> >> +
> >> +struct text_poke_params {
> >> + void *addr;
> >> + const void *opcode;
> >> + size_t len;
> >> +};
> >> +
> >> +static int __kprobes stop_machine_text_poke(void *data)
> >> +{
> >> + struct text_poke_params *tpp = data;
> >> +
> >> + if (atomic_dec_and_test(&stop_machine_first)) {
> >> + text_poke(tpp->addr, tpp->opcode, tpp->len);
> >> + smp_wmb(); /* Make sure other cpus see that this has run */
> >> + wrote_text = 1;
> >> + } else {
> >> + while (!wrote_text)
> >> + smp_rmb();
> >> + sync_core();
> >
> > Hrm, there is a problem in there. The last loop, when wrote_text becomes
> > true, does not perform any smp_mb(), so you end up in a situation where
> > cpus in the "else" branch may never issue any memory barrier. I'd rather
> > do:
>
> Hmm, so how about this? :)
> ---
> } else {
> do {
> smp_rmb();
> while (!wrote_text);
> sync_core();
> }
> ---
>
The ordering we are looking for here are:
Write-side: smp_wmb() orders text_poke stores before store to wrote_text.
Read-side: order wrote_text load before subsequent execution of modified
instructions.
Here again, strictly speaking, wrote_text load is not ordered with respect to
following instructions. So maybe it's fine on x86-TSO specifically, but I would
not count on this kind of synchronization to work in the general case.
Given the very small expected performance impact of this code path, I would
recomment using the more solid/generic alternative below. If there is really a
gain to get by creating this weird wait loop with strange memory barrier
semantics, fine, otherwise I'd be reluctant to accept your proposals as
obviously correct.
If you really, really want to go down the route of proving the correctness of
your memory barrier usage, I can recommend looking at the memory barrier formal
verification framework I did as part of my thesis. But, really, in this case,
the performance gain is just not there, so there is no point in spending time
trying to prove this.
Thanks,
Mathieu
> >
> > +static volatile int wrote_text;
> >
> > ...
> >
> > +static int __kprobes stop_machine_text_poke(void *data)
> > +{
> > + struct text_poke_params *tpp = data;
> > +
> > + if (atomic_dec_and_test(&stop_machine_first)) {
> > + text_poke(tpp->addr, tpp->opcode, tpp->len);
> > + smp_wmb(); /* order text_poke stores before store to wrote_text */
> > + wrote_text = 1;
> > + } else {
> > + while (!wrote_text)
> > + cpu_relax();
> > + smp_mb(); /* order wrote_text load before following execution */
> > + }
> >
> > If you don't like the "volatile int" definition of wrote_text, then we
> > should probably use the ACCESS_ONCE() macro instead.
>
> hm, yeah, volatile will be required.
>
> Thank you,
>
>
> --
> Masami Hiramatsu
> e-mail: mhi...@re...
>
>
>
--
Mathieu Desnoyers
Operating System Efficiency Consultant
EfficiOS Inc.
http://www.efficios.com
|
|
From: Masami H. <mhi...@re...> - 2010-03-03 00:57:40
|
Mathieu Desnoyers wrote:
> * Masami Hiramatsu (mhi...@re...) wrote:
>> Mathieu Desnoyers wrote:
>>> * Masami Hiramatsu (mhi...@re...) wrote:
>> [...]
>>>> +
>>>> +/*
>>>> + * Cross-modifying kernel text with stop_machine().
>>>> + * This code originally comes from immediate value.
>>>> + */
>>>> +static atomic_t stop_machine_first;
>>>> +static int wrote_text;
>>>> +
>>>> +struct text_poke_params {
>>>> + void *addr;
>>>> + const void *opcode;
>>>> + size_t len;
>>>> +};
>>>> +
>>>> +static int __kprobes stop_machine_text_poke(void *data)
>>>> +{
>>>> + struct text_poke_params *tpp = data;
>>>> +
>>>> + if (atomic_dec_and_test(&stop_machine_first)) {
>>>> + text_poke(tpp->addr, tpp->opcode, tpp->len);
>>>> + smp_wmb(); /* Make sure other cpus see that this has run */
>>>> + wrote_text = 1;
>>>> + } else {
>>>> + while (!wrote_text)
>>>> + smp_rmb();
>>>> + sync_core();
>>>
>>> Hrm, there is a problem in there. The last loop, when wrote_text becomes
>>> true, does not perform any smp_mb(), so you end up in a situation where
>>> cpus in the "else" branch may never issue any memory barrier. I'd rather
>>> do:
>>
>> Hmm, so how about this? :)
>> ---
>> } else {
>> do {
>> smp_rmb();
>> while (!wrote_text);
>> sync_core();
>> }
>> ---
>>
>
> The ordering we are looking for here are:
>
> Write-side: smp_wmb() orders text_poke stores before store to wrote_text.
>
> Read-side: order wrote_text load before subsequent execution of modified
> instructions.
>
> Here again, strictly speaking, wrote_text load is not ordered with respect to
> following instructions. So maybe it's fine on x86-TSO specifically, but I would
> not count on this kind of synchronization to work in the general case.
>
> Given the very small expected performance impact of this code path, I would
> recomment using the more solid/generic alternative below. If there is really a
> gain to get by creating this weird wait loop with strange memory barrier
> semantics, fine, otherwise I'd be reluctant to accept your proposals as
> obviously correct.
>
> If you really, really want to go down the route of proving the correctness of
> your memory barrier usage, I can recommend looking at the memory barrier formal
> verification framework I did as part of my thesis. But, really, in this case,
> the performance gain is just not there, so there is no point in spending time
> trying to prove this.
OK, that was my misunderstand. and cpu_relax() will be better for HT processors.
I'll update it according to your code below.
Thank you,
>
> Thanks,
>
> Mathieu
>
>>>
>>> +static volatile int wrote_text;
>>>
>>> ...
>>>
>>> +static int __kprobes stop_machine_text_poke(void *data)
>>> +{
>>> + struct text_poke_params *tpp = data;
>>> +
>>> + if (atomic_dec_and_test(&stop_machine_first)) {
>>> + text_poke(tpp->addr, tpp->opcode, tpp->len);
>>> + smp_wmb(); /* order text_poke stores before store to wrote_text */
>>> + wrote_text = 1;
>>> + } else {
>>> + while (!wrote_text)
>>> + cpu_relax();
>>> + smp_mb(); /* order wrote_text load before following execution */
>>> + }
>>>
>>> If you don't like the "volatile int" definition of wrote_text, then we
>>> should probably use the ACCESS_ONCE() macro instead.
>>
>> hm, yeah, volatile will be required.
>>
>> Thank you,
>>
>>
>> --
>> Masami Hiramatsu
>> e-mail: mhi...@re...
>>
>>
>>
>
--
Masami Hiramatsu
e-mail: mhi...@re...
|
|
From: Mathieu D. <co...@kr...> - 2010-03-03 00:51:10
|
* Masami Hiramatsu (mhi...@re...) wrote: > Masami Hiramatsu wrote: > > Mathieu Desnoyers wrote: > >> * Masami Hiramatsu (mhi...@re...) wrote: > >>> Make insn_slot framework support various size slots. > >>> Current insn_slot just supports one-size instruction buffer slot. However, > >>> kprobes jump optimization needs larger size buffers. > >> > >> OK, so you end up having one insn slot cache for kprobes and one insn > >> slot (eventually) for the static jump patching (which needs larger > >> instruction slots than kprobes). That seems like a good way to ensure > >> you do not use more memory than necessary. > >> > >> We could possibly go even further and automatically use the right insn > >> slot cache given the size of the instruction entry that must be added (a > >> bit like the memory allocator which have different pools for each > >> allocation order). > > > > Sure, that will be simpler interface. > > > >> Possibly that using the terminology of "memory pools" rather than > >> "cache" could be a better fit too. So what this really becomes is an > >> instruction slot allocator and garbage collector. > > > > Ah, right. It would be better to rename kprobe_insn_pool() :) > > Hmm, I tried it. And finally, I found that this doesn't help > to simplify code... Maybe it is better to postpone it until > another user needs this feature. I guess it's a tradeoff between the genericity of the API you provide and the complexity of the code that provides this API. So as you say, maybe it's better to wait until more users appears before improving the API. Thanks, Mathieu > > Thank you, > > -- > Masami Hiramatsu > e-mail: mhi...@re... > -- Mathieu Desnoyers Operating System Efficiency Consultant EfficiOS Inc. http://www.efficios.com |
|
From: Masami H. <mhi...@re...> - 2010-03-03 00:36:35
|
Mathieu Desnoyers wrote: > * Masami Hiramatsu (mhi...@re...) wrote: >> Masami Hiramatsu wrote: >>> Mathieu Desnoyers wrote: >>>> * Masami Hiramatsu (mhi...@re...) wrote: >>>>> Make insn_slot framework support various size slots. >>>>> Current insn_slot just supports one-size instruction buffer slot. However, >>>>> kprobes jump optimization needs larger size buffers. >>>> >>>> OK, so you end up having one insn slot cache for kprobes and one insn >>>> slot (eventually) for the static jump patching (which needs larger >>>> instruction slots than kprobes). That seems like a good way to ensure >>>> you do not use more memory than necessary. >>>> >>>> We could possibly go even further and automatically use the right insn >>>> slot cache given the size of the instruction entry that must be added (a >>>> bit like the memory allocator which have different pools for each >>>> allocation order). >>> >>> Sure, that will be simpler interface. >>> >>>> Possibly that using the terminology of "memory pools" rather than >>>> "cache" could be a better fit too. So what this really becomes is an >>>> instruction slot allocator and garbage collector. >>> >>> Ah, right. It would be better to rename kprobe_insn_pool() :) >> >> Hmm, I tried it. And finally, I found that this doesn't help >> to simplify code... Maybe it is better to postpone it until >> another user needs this feature. > > I guess it's a tradeoff between the genericity of the API you provide > and the complexity of the code that provides this API. So as you say, > maybe it's better to wait until more users appears before improving the > API. OK, I'll hold that generalizing patch until that. :) Thank you, -- Masami Hiramatsu e-mail: mhi...@re... |
|
From: Masami H. <mhi...@re...> - 2010-03-03 00:19:35
|
Masami Hiramatsu wrote: > Mathieu Desnoyers wrote: >> * Masami Hiramatsu (mhi...@re...) wrote: >>> Make insn_slot framework support various size slots. >>> Current insn_slot just supports one-size instruction buffer slot. However, >>> kprobes jump optimization needs larger size buffers. >> >> OK, so you end up having one insn slot cache for kprobes and one insn >> slot (eventually) for the static jump patching (which needs larger >> instruction slots than kprobes). That seems like a good way to ensure >> you do not use more memory than necessary. >> >> We could possibly go even further and automatically use the right insn >> slot cache given the size of the instruction entry that must be added (a >> bit like the memory allocator which have different pools for each >> allocation order). > > Sure, that will be simpler interface. > >> Possibly that using the terminology of "memory pools" rather than >> "cache" could be a better fit too. So what this really becomes is an >> instruction slot allocator and garbage collector. > > Ah, right. It would be better to rename kprobe_insn_pool() :) Hmm, I tried it. And finally, I found that this doesn't help to simplify code... Maybe it is better to postpone it until another user needs this feature. Thank you, -- Masami Hiramatsu e-mail: mhi...@re... |
|
From: Masami H. <mhi...@re...> - 2010-03-02 02:56:25
|
Mathieu Desnoyers wrote: > * Masami Hiramatsu (mhi...@re...) wrote: >> Make insn_slot framework support various size slots. >> Current insn_slot just supports one-size instruction buffer slot. However, >> kprobes jump optimization needs larger size buffers. > > OK, so you end up having one insn slot cache for kprobes and one insn > slot (eventually) for the static jump patching (which needs larger > instruction slots than kprobes). That seems like a good way to ensure > you do not use more memory than necessary. > > We could possibly go even further and automatically use the right insn > slot cache given the size of the instruction entry that must be added (a > bit like the memory allocator which have different pools for each > allocation order). Sure, that will be simpler interface. > Possibly that using the terminology of "memory pools" rather than > "cache" could be a better fit too. So what this really becomes is an > instruction slot allocator and garbage collector. Ah, right. It would be better to rename kprobe_insn_pool() :) Thank you, -- Masami Hiramatsu e-mail: mhi...@re... |
|
From: Masami H. <mhi...@re...> - 2010-02-26 03:52:45
|
Mathieu Desnoyers wrote:
> * Masami Hiramatsu (mhi...@re...) wrote:
[...]
>> +
>> +/*
>> + * Cross-modifying kernel text with stop_machine().
>> + * This code originally comes from immediate value.
>> + */
>> +static atomic_t stop_machine_first;
>> +static int wrote_text;
>> +
>> +struct text_poke_params {
>> + void *addr;
>> + const void *opcode;
>> + size_t len;
>> +};
>> +
>> +static int __kprobes stop_machine_text_poke(void *data)
>> +{
>> + struct text_poke_params *tpp = data;
>> +
>> + if (atomic_dec_and_test(&stop_machine_first)) {
>> + text_poke(tpp->addr, tpp->opcode, tpp->len);
>> + smp_wmb(); /* Make sure other cpus see that this has run */
>> + wrote_text = 1;
>> + } else {
>> + while (!wrote_text)
>> + smp_rmb();
>> + sync_core();
>
> Hrm, there is a problem in there. The last loop, when wrote_text becomes
> true, does not perform any smp_mb(), so you end up in a situation where
> cpus in the "else" branch may never issue any memory barrier. I'd rather
> do:
Hmm, so how about this? :)
---
} else {
do {
smp_rmb();
while (!wrote_text);
sync_core();
}
---
>
> +static volatile int wrote_text;
>
> ...
>
> +static int __kprobes stop_machine_text_poke(void *data)
> +{
> + struct text_poke_params *tpp = data;
> +
> + if (atomic_dec_and_test(&stop_machine_first)) {
> + text_poke(tpp->addr, tpp->opcode, tpp->len);
> + smp_wmb(); /* order text_poke stores before store to wrote_text */
> + wrote_text = 1;
> + } else {
> + while (!wrote_text)
> + cpu_relax();
> + smp_mb(); /* order wrote_text load before following execution */
> + }
>
> If you don't like the "volatile int" definition of wrote_text, then we
> should probably use the ACCESS_ONCE() macro instead.
hm, yeah, volatile will be required.
Thank you,
--
Masami Hiramatsu
e-mail: mhi...@re...
|
|
From: tip-bot f. M. H. <mhi...@re...> - 2010-02-25 19:33:11
|
Commit-ID: 2a9c8c36092de41c13fdd81fe59556915b080c3e Gitweb: http://git.kernel.org/tip/2a9c8c36092de41c13fdd81fe59556915b080c3e Author: Masami Hiramatsu <mhi...@re...> AuthorDate: Thu, 25 Feb 2010 08:36:12 -0500 Committer: Ingo Molnar <mi...@el...> CommitDate: Thu, 25 Feb 2010 17:49:30 +0100 perf probe: Add lazy line matching support Add lazy line matching support for specifying new probes. This also changes the syntax of perf probe a bit. Now perf probe accepts one of below probe event definitions. 1) Define event based on function name [EVENT=]FUNC[@SRC][:RLN|+OFF|%return|;PTN] [ARG ...] 2) Define event based on source file with line number [EVENT=]SRC:ALN [ARG ...] 3) Define event based on source file with lazy pattern [EVENT=]SRC;PTN [ARG ...] - New lazy matching pattern(PTN) follows ';' (semicolon). And it must be put the end of the definition. - So, @SRC is no longer the part which must be put at the end of the definition. Note that ';' (semicolon) can be interpreted as the end of a command by the shell. This means that you need to quote it. (anyway you will need to quote the lazy pattern itself too, because it may contains other sensitive characters, like '[',']' etc.). Lazy matching ------------- The lazy line matching is similar to glob matching except ignoring spaces in both of pattern and target. e.g. 'a=*' can matches 'a=b', 'a = b', 'a == b' and so on. This provides some sort of flexibility and robustness to probe point definitions against minor code changes. (for example, actual 10th line of schedule() can be changed easily by modifying schedule(), but the same line matching 'rq=cpu_rq*' may still exist.) Changes in v3: - Cast Dwarf_Addr to uintmax_t for printf-formats. Changes in v2: - Cast Dwarf_Addr to unsigned long long for printf-formats. Signed-off-by: Masami Hiramatsu <mhi...@re...> Cc: systemtap <sys...@so...> Cc: DLE <dle...@li...> Cc: Frederic Weisbecker <fwe...@gm...> Cc: Arnaldo Carvalho de Melo <ac...@re...> Cc: Peter Zijlstra <pe...@in...> Cc: Paul Mackerras <pa...@sa...> Cc: Mike Galbraith <ef...@gm...> Cc: K.Prasad <pr...@li...> Cc: Frederic Weisbecker <fwe...@gm...> Cc: Ananth N Mavinakayanahalli <an...@in...> LKML-Reference: <20100225133611.6725.45078.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mi...@el...> --- tools/perf/Documentation/perf-probe.txt | 30 ++++- tools/perf/builtin-probe.c | 12 +- tools/perf/util/probe-event.c | 48 ++++--- tools/perf/util/probe-finder.c | 249 +++++++++++++++++++++++-------- tools/perf/util/probe-finder.h | 2 + tools/perf/util/string.c | 55 +++++-- tools/perf/util/string.h | 1 + 7 files changed, 298 insertions(+), 99 deletions(-) diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt index 5fe63c0..34202b1 100644 --- a/tools/perf/Documentation/perf-probe.txt +++ b/tools/perf/Documentation/perf-probe.txt @@ -61,11 +61,19 @@ PROBE SYNTAX ------------ Probe points are defined by following syntax. - "[EVENT=]FUNC[+OFFS|:RLN|%return][@SRC]|SRC:ALN [ARG ...]" + 1) Define event based on function name + [EVENT=]FUNC[@SRC][:RLN|+OFFS|%return|;PTN] [ARG ...] + + 2) Define event based on source file with line number + [EVENT=]SRC:ALN [ARG ...] + + 3) Define event based on source file with lazy pattern + [EVENT=]SRC;PTN [ARG ...] + 'EVENT' specifies the name of new event, if omitted, it will be set the name of the probed function. Currently, event group name is set as 'probe'. -'FUNC' specifies a probed function name, and it may have one of the following options; '+OFFS' is the offset from function entry address in bytes, 'RLN' is the relative-line number from function entry line, and '%return' means that it probes function return. In addition, 'SRC' specifies a source file which has that function. -It is also possible to specify a probe point by the source line number by using 'SRC:ALN' syntax, where 'SRC' is the source file path and 'ALN' is the line number. +'FUNC' specifies a probed function name, and it may have one of the following options; '+OFFS' is the offset from function entry address in bytes, ':RLN' is the relative-line number from function entry line, and '%return' means that it probes function return. And ';PTN' means lazy matching pattern (see LAZY MATCHING). Note that ';PTN' must be the end of the probe point definition. In addition, '@SRC' specifies a source file which has that function. +It is also possible to specify a probe point by the source line number or lazy matching by using 'SRC:ALN' or 'SRC;PTN' syntax, where 'SRC' is the source file path, ':ALN' is the line number and ';PTN' is the lazy matching pattern. 'ARG' specifies the arguments of this probe point. You can use the name of local variable, or kprobe-tracer argument format (e.g. $retval, %ax, etc). LINE SYNTAX @@ -81,6 +89,16 @@ and 'ALN2' is end line number in the file. It is also possible to specify how many lines to show by using 'NUM'. So, "source.c:100-120" shows lines between 100th to l20th in source.c file. And "func:10+20" shows 20 lines from 10th line of func function. +LAZY MATCHING +------------- + The lazy line matching is similar to glob matching but ignoring spaces in both of pattern and target. So this accepts wildcards('*', '?') and character classes(e.g. [a-z], [!A-Z]). + +e.g. + 'a=*' can matches 'a=b', 'a = b', 'a == b' and so on. + +This provides some sort of flexibility and robustness to probe point definitions against minor code changes. For example, actual 10th line of schedule() can be moved easily by modifying schedule(), but the same line matching 'rq=cpu_rq*' may still exist in the function.) + + EXAMPLES -------- Display which lines in schedule() can be probed: @@ -95,6 +113,12 @@ Add a probe on schedule() function 12th line with recording cpu local variable: this will add one or more probes which has the name start with "schedule". + Add probes on lines in schedule() function which calls update_rq_clock(). + + ./perf probe 'schedule;update_rq_clock*' + or + ./perf probe --add='schedule;update_rq_clock*' + Delete all probes on schedule(). ./perf probe --del='schedule*' diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index d8d3f05..e3dfd0d 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -175,22 +175,24 @@ static const struct option options[] = { opt_del_probe_event), OPT_CALLBACK('a', "add", NULL, #ifdef NO_DWARF_SUPPORT - "[EVENT=]FUNC[+OFFS|%return] [ARG ...]", + "[EVENT=]FUNC[+OFF|%return] [ARG ...]", #else - "[EVENT=]FUNC[+OFFS|%return|:RLN][@SRC]|SRC:ALN [ARG ...]", + "[EVENT=]FUNC[+OFF|%return|:RL|;PT][@SRC]|SRC:AL|SRC;PT" + " [ARG ...]", #endif "probe point definition, where\n" "\t\tGROUP:\tGroup name (optional)\n" "\t\tEVENT:\tEvent name\n" "\t\tFUNC:\tFunction name\n" - "\t\tOFFS:\tOffset from function entry (in byte)\n" + "\t\tOFF:\tOffset from function entry (in byte)\n" "\t\t%return:\tPut the probe at function return\n" #ifdef NO_DWARF_SUPPORT "\t\tARG:\tProbe argument (only \n" #else "\t\tSRC:\tSource code path\n" - "\t\tRLN:\tRelative line number from function entry.\n" - "\t\tALN:\tAbsolute line number in file.\n" + "\t\tRL:\tRelative line number from function entry.\n" + "\t\tAL:\tAbsolute line number in file.\n" + "\t\tPT:\tLazy expression of line code.\n" "\t\tARG:\tProbe argument (local variable name or\n" #endif "\t\t\tkprobe-tracer argument format.)\n", diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 91f55f2..fa156f0 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -119,14 +119,14 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) char c, nc = 0; /* * <Syntax> - * perf probe [EVENT=]SRC:LN - * perf probe [EVENT=]FUNC[+OFFS|%return][@SRC] + * perf probe [EVENT=]SRC[:LN|;PTN] + * perf probe [EVENT=]FUNC[@SRC][+OFFS|%return|:LN|;PAT] * * TODO:Group name support */ - ptr = strchr(arg, '='); - if (ptr) { /* Event name */ + ptr = strpbrk(arg, ";=@+%"); + if (ptr && *ptr == '=') { /* Event name */ *ptr = '\0'; tmp = ptr + 1; ptr = strchr(arg, ':'); @@ -139,7 +139,7 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) arg = tmp; } - ptr = strpbrk(arg, ":+@%"); + ptr = strpbrk(arg, ";:+@%"); if (ptr) { nc = *ptr; *ptr++ = '\0'; @@ -156,7 +156,11 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) while (ptr) { arg = ptr; c = nc; - ptr = strpbrk(arg, ":+@%"); + if (c == ';') { /* Lazy pattern must be the last part */ + pp->lazy_line = strdup(arg); + break; + } + ptr = strpbrk(arg, ";:+@%"); if (ptr) { nc = *ptr; *ptr++ = '\0'; @@ -165,13 +169,13 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) case ':': /* Line number */ pp->line = strtoul(arg, &tmp, 0); if (*tmp != '\0') - semantic_error("There is non-digit charactor" - " in line number."); + semantic_error("There is non-digit char" + " in line number."); break; case '+': /* Byte offset from a symbol */ pp->offset = strtoul(arg, &tmp, 0); if (*tmp != '\0') - semantic_error("There is non-digit charactor" + semantic_error("There is non-digit character" " in offset."); break; case '@': /* File name */ @@ -179,9 +183,6 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) semantic_error("SRC@SRC is not allowed."); pp->file = strdup(arg); DIE_IF(pp->file == NULL); - if (ptr) - semantic_error("@SRC must be the last " - "option."); break; case '%': /* Probe places */ if (strcmp(arg, "return") == 0) { @@ -196,11 +197,18 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) } /* Exclusion check */ + if (pp->lazy_line && pp->line) + semantic_error("Lazy pattern can't be used with line number."); + + if (pp->lazy_line && pp->offset) + semantic_error("Lazy pattern can't be used with offset."); + if (pp->line && pp->offset) semantic_error("Offset can't be used with line number."); - if (!pp->line && pp->file && !pp->function) - semantic_error("File always requires line number."); + if (!pp->line && !pp->lazy_line && pp->file && !pp->function) + semantic_error("File always requires line number or " + "lazy pattern."); if (pp->offset && !pp->function) semantic_error("Offset requires an entry function."); @@ -208,11 +216,13 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) if (pp->retprobe && !pp->function) semantic_error("Return probe requires an entry function."); - if ((pp->offset || pp->line) && pp->retprobe) - semantic_error("Offset/Line can't be used with return probe."); + if ((pp->offset || pp->line || pp->lazy_line) && pp->retprobe) + semantic_error("Offset/Line/Lazy pattern can't be used with " + "return probe."); - pr_debug("symbol:%s file:%s line:%d offset:%d, return:%d\n", - pp->function, pp->file, pp->line, pp->offset, pp->retprobe); + pr_debug("symbol:%s file:%s line:%d offset:%d return:%d lazy:%s\n", + pp->function, pp->file, pp->line, pp->offset, pp->retprobe, + pp->lazy_line); } /* Parse perf-probe event definition */ @@ -456,6 +466,8 @@ static void clear_probe_point(struct probe_point *pp) free(pp->function); if (pp->file) free(pp->file); + if (pp->lazy_line) + free(pp->lazy_line); for (i = 0; i < pp->nr_args; i++) free(pp->args[i]); if (pp->args) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index a410356..e77dc88 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -32,6 +32,7 @@ #include <stdarg.h> #include <ctype.h> +#include "string.h" #include "event.h" #include "debug.h" #include "util.h" @@ -104,8 +105,67 @@ static int strtailcmp(const char *s1, const char *s2) return 0; } -/* Find the fileno of the target file. */ -static int cu_find_fileno(Dwarf_Die *cu_die, const char *fname) +/* Line number list operations */ + +/* Add a line to line number list */ +static void line_list__add_line(struct list_head *head, unsigned int line) +{ + struct line_node *ln; + struct list_head *p; + + /* Reverse search, because new line will be the last one */ + list_for_each_entry_reverse(ln, head, list) { + if (ln->line < line) { + p = &ln->list; + goto found; + } else if (ln->line == line) /* Already exist */ + return ; + } + /* List is empty, or the smallest entry */ + p = head; +found: + pr_debug("line list: add a line %u\n", line); + ln = zalloc(sizeof(struct line_node)); + DIE_IF(ln == NULL); + ln->line = line; + INIT_LIST_HEAD(&ln->list); + list_add(&ln->list, p); +} + +/* Check if the line in line number list */ +static int line_list__has_line(struct list_head *head, unsigned int line) +{ + struct line_node *ln; + + /* Reverse search, because new line will be the last one */ + list_for_each_entry(ln, head, list) + if (ln->line == line) + return 1; + + return 0; +} + +/* Init line number list */ +static void line_list__init(struct list_head *head) +{ + INIT_LIST_HEAD(head); +} + +/* Free line number list */ +static void line_list__free(struct list_head *head) +{ + struct line_node *ln; + while (!list_empty(head)) { + ln = list_first_entry(head, struct line_node, list); + list_del(&ln->list); + free(ln); + } +} + +/* Dwarf wrappers */ + +/* Find the realpath of the target file. */ +static const char *cu_find_realpath(Dwarf_Die *cu_die, const char *fname) { Dwarf_Files *files; size_t nfiles, i; @@ -113,21 +173,18 @@ static int cu_find_fileno(Dwarf_Die *cu_die, const char *fname) int ret; if (!fname) - return -EINVAL; + return NULL; ret = dwarf_getsrcfiles(cu_die, &files, &nfiles); - if (ret == 0) { - for (i = 0; i < nfiles; i++) { - src = dwarf_filesrc(files, i, NULL, NULL); - if (strtailcmp(src, fname) == 0) { - ret = (int)i; /*???: +1 or not?*/ - break; - } - } - if (ret) - pr_debug("found fno: %d\n", ret); + if (ret != 0) + return NULL; + + for (i = 0; i < nfiles; i++) { + src = dwarf_filesrc(files, i, NULL, NULL); + if (strtailcmp(src, fname) == 0) + break; } - return ret; + return src; } struct __addr_die_search_param { @@ -436,17 +493,109 @@ static void find_probe_point_by_line(struct probe_finder *pf) } } +/* Find lines which match lazy pattern */ +static int find_lazy_match_lines(struct list_head *head, + const char *fname, const char *pat) +{ + char *fbuf, *p1, *p2; + int fd, line, nlines = 0; + struct stat st; + + fd = open(fname, O_RDONLY); + if (fd < 0) + die("failed to open %s", fname); + DIE_IF(fstat(fd, &st) < 0); + fbuf = malloc(st.st_size + 2); + DIE_IF(fbuf == NULL); + DIE_IF(read(fd, fbuf, st.st_size) < 0); + close(fd); + fbuf[st.st_size] = '\n'; /* Dummy line */ + fbuf[st.st_size + 1] = '\0'; + p1 = fbuf; + line = 1; + while ((p2 = strchr(p1, '\n')) != NULL) { + *p2 = '\0'; + if (strlazymatch(p1, pat)) { + line_list__add_line(head, line); + nlines++; + } + line++; + p1 = p2 + 1; + } + free(fbuf); + return nlines; +} + +/* Find probe points from lazy pattern */ +static void find_probe_point_lazy(Dwarf_Die *sp_die, struct probe_finder *pf) +{ + Dwarf_Lines *lines; + Dwarf_Line *line; + size_t nlines, i; + Dwarf_Addr addr; + Dwarf_Die die_mem; + int lineno; + int ret; + + if (list_empty(&pf->lcache)) { + /* Matching lazy line pattern */ + ret = find_lazy_match_lines(&pf->lcache, pf->fname, + pf->pp->lazy_line); + if (ret <= 0) + die("No matched lines found in %s.", pf->fname); + } + + ret = dwarf_getsrclines(&pf->cu_die, &lines, &nlines); + DIE_IF(ret != 0); + for (i = 0; i < nlines; i++) { + line = dwarf_onesrcline(lines, i); + + dwarf_lineno(line, &lineno); + if (!line_list__has_line(&pf->lcache, lineno)) + continue; + + /* TODO: Get fileno from line, but how? */ + if (strtailcmp(dwarf_linesrc(line, NULL, NULL), pf->fname) != 0) + continue; + + ret = dwarf_lineaddr(line, &addr); + DIE_IF(ret != 0); + if (sp_die) { + /* Address filtering 1: does sp_die include addr? */ + if (!dwarf_haspc(sp_die, addr)) + continue; + /* Address filtering 2: No child include addr? */ + if (die_get_inlinefunc(sp_die, addr, &die_mem)) + continue; + } + + pr_debug("Probe line found: line[%d]:%d addr:0x%llx\n", + (int)i, lineno, (unsigned long long)addr); + pf->addr = addr; + + show_probe_point(sp_die, pf); + /* Continuing, because target line might be inlined. */ + } + /* TODO: deallocate lines, but how? */ +} + static int probe_point_inline_cb(Dwarf_Die *in_die, void *data) { struct probe_finder *pf = (struct probe_finder *)data; struct probe_point *pp = pf->pp; - /* Get probe address */ - pf->addr = die_get_entrypc(in_die); - pf->addr += pp->offset; - pr_debug("found inline addr: 0x%jx\n", (uintmax_t)pf->addr); + if (pp->lazy_line) + find_probe_point_lazy(in_die, pf); + else { + /* Get probe address */ + pf->addr = die_get_entrypc(in_die); + pf->addr += pp->offset; + pr_debug("found inline addr: 0x%jx\n", + (uintmax_t)pf->addr); + + show_probe_point(in_die, pf); + } - show_probe_point(in_die, pf); return DWARF_CB_OK; } @@ -461,17 +610,21 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) die_compare_name(sp_die, pp->function) != 0) return 0; + pf->fname = dwarf_decl_file(sp_die); if (pp->line) { /* Function relative line */ - pf->fname = dwarf_decl_file(sp_die); dwarf_decl_line(sp_die, &pf->lno); pf->lno += pp->line; find_probe_point_by_line(pf); } else if (!dwarf_func_inline(sp_die)) { /* Real function */ - pf->addr = die_get_entrypc(sp_die); - pf->addr += pp->offset; - /* TODO: Check the address in this function */ - show_probe_point(sp_die, pf); + if (pp->lazy_line) + find_probe_point_lazy(sp_die, pf); + else { + pf->addr = die_get_entrypc(sp_die); + pf->addr += pp->offset; + /* TODO: Check the address in this function */ + show_probe_point(sp_die, pf); + } } else /* Inlined function: search instances */ dwarf_func_inline_instances(sp_die, probe_point_inline_cb, pf); @@ -493,7 +646,6 @@ int find_probe_point(int fd, struct probe_point *pp) size_t cuhl; Dwarf_Die *diep; Dwarf *dbg; - int fno = 0; dbg = dwarf_begin(fd, DWARF_C_READ); if (!dbg) @@ -501,6 +653,7 @@ int find_probe_point(int fd, struct probe_point *pp) pp->found = 0; off = 0; + line_list__init(&pf.lcache); /* Loop on CUs (Compilation Unit) */ while (!dwarf_nextcu(dbg, off, &noff, &cuhl, NULL, NULL, NULL)) { /* Get the DIE(Debugging Information Entry) of this CU */ @@ -510,17 +663,19 @@ int find_probe_point(int fd, struct probe_point *pp) /* Check if target file is included. */ if (pp->file) - fno = cu_find_fileno(&pf.cu_die, pp->file); + pf.fname = cu_find_realpath(&pf.cu_die, pp->file); else - fno = 0; + pf.fname = NULL; - if (!pp->file || fno) { + if (!pp->file || pf.fname) { /* Save CU base address (for frame_base) */ ret = dwarf_lowpc(&pf.cu_die, &pf.cu_base); if (ret != 0) pf.cu_base = 0; if (pp->function) find_probe_point_by_func(&pf); + else if (pp->lazy_line) + find_probe_point_lazy(NULL, &pf); else { pf.lno = pp->line; find_probe_point_by_line(&pf); @@ -528,36 +683,12 @@ int find_probe_point(int fd, struct probe_point *pp) } off = noff; } + line_list__free(&pf.lcache); dwarf_end(dbg); return pp->found; } - -static void line_range_add_line(struct line_range *lr, unsigned int line) -{ - struct line_node *ln; - struct list_head *p; - - /* Reverse search, because new line will be the last one */ - list_for_each_entry_reverse(ln, &lr->line_list, list) { - if (ln->line < line) { - p = &ln->list; - goto found; - } else if (ln->line == line) /* Already exist */ - return ; - } - /* List is empty, or the smallest entry */ - p = &lr->line_list; -found: - pr_debug("Debug: add a line %u\n", line); - ln = zalloc(sizeof(struct line_node)); - DIE_IF(ln == NULL); - ln->line = line; - INIT_LIST_HEAD(&ln->list); - list_add(&ln->list, p); -} - /* Find line range from its line number */ static void find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) { @@ -570,7 +701,7 @@ static void find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) const char *src; Dwarf_Die die_mem; - INIT_LIST_HEAD(&lf->lr->line_list); + line_list__init(&lf->lr->line_list); ret = dwarf_getsrclines(&lf->cu_die, &lines, &nlines); DIE_IF(ret != 0); @@ -601,7 +732,7 @@ static void find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) /* Copy real path */ if (!lf->lr->path) lf->lr->path = strdup(src); - line_range_add_line(lf->lr, (unsigned int)lineno); + line_list__add_line(&lf->lr->line_list, (unsigned int)lineno); } /* Update status */ if (!list_empty(&lf->lr->line_list)) @@ -659,7 +790,6 @@ int find_line_range(int fd, struct line_range *lr) size_t cuhl; Dwarf_Die *diep; Dwarf *dbg; - int fno; dbg = dwarf_begin(fd, DWARF_C_READ); if (!dbg) @@ -678,15 +808,14 @@ int find_line_range(int fd, struct line_range *lr) /* Check if target file is included. */ if (lr->file) - fno = cu_find_fileno(&lf.cu_die, lr->file); + lf.fname = cu_find_realpath(&lf.cu_die, lr->file); else - fno = 0; + lf.fname = 0; - if (!lr->file || fno) { + if (!lr->file || lf.fname) { if (lr->function) find_line_range_by_func(&lf); else { - lf.fname = lr->file; lf.lno_s = lr->start; if (!lr->end) lf.lno_e = INT_MAX; diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 75a660d..d1a6517 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -21,6 +21,7 @@ struct probe_point { /* Inputs */ char *file; /* File name */ int line; /* Line number */ + char *lazy_line; /* Lazy line pattern */ char *function; /* Function name */ int offset; /* Offset bytes */ @@ -74,6 +75,7 @@ struct probe_finder { const char *var; /* Current variable name */ char *buf; /* Current output buffer */ int len; /* Length of output buffer */ + struct list_head lcache; /* Line cache for lazy match */ }; struct line_finder { diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index c397d4f..a175949 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -265,21 +265,21 @@ error: return false; } -/** - * strglobmatch - glob expression pattern matching - * @str: the target string to match - * @pat: the pattern string to match - * - * This returns true if the @str matches @pat. @pat can includes wildcards - * ('*','?') and character classes ([CHARS], complementation and ranges are - * also supported). Also, this supports escape character ('\') to use special - * characters as normal character. - * - * Note: if @pat syntax is broken, this always returns false. - */ -bool strglobmatch(const char *str, const char *pat) +/* Glob/lazy pattern matching */ +static bool __match_glob(const char *str, const char *pat, bool ignore_space) { while (*str && *pat && *pat != '*') { + if (ignore_space) { + /* Ignore spaces for lazy matching */ + if (isspace(*str)) { + str++; + continue; + } + if (isspace(*pat)) { + pat++; + continue; + } + } if (*pat == '?') { /* Matches any single character */ str++; pat++; @@ -308,3 +308,32 @@ bool strglobmatch(const char *str, const char *pat) return !*str && !*pat; } +/** + * strglobmatch - glob expression pattern matching + * @str: the target string to match + * @pat: the pattern string to match + * + * This returns true if the @str matches @pat. @pat can includes wildcards + * ('*','?') and character classes ([CHARS], complementation and ranges are + * also supported). Also, this supports escape character ('\') to use special + * characters as normal character. + * + * Note: if @pat syntax is broken, this always returns false. + */ +bool strglobmatch(const char *str, const char *pat) +{ + return __match_glob(str, pat, false); +} + +/** + * strlazymatch - matching pattern strings lazily with glob pattern + * @str: the target string to match + * @pat: the pattern string to match + * + * This is similar to strglobmatch, except this ignores spaces in + * the target string. + */ +bool strlazymatch(const char *str, const char *pat) +{ + return __match_glob(str, pat, true); +} diff --git a/tools/perf/util/string.h b/tools/perf/util/string.h index 02ede58..542e44d 100644 --- a/tools/perf/util/string.h +++ b/tools/perf/util/string.h @@ -10,6 +10,7 @@ s64 perf_atoll(const char *str); char **argv_split(const char *str, int *argcp); void argv_free(char **argv); bool strglobmatch(const char *str, const char *pat); +bool strlazymatch(const char *str, const char *pat); #define _STR(x) #x #define STR(x) _STR(x) |
|
From: tip-bot f. M. H. <mhi...@re...> - 2010-02-25 19:33:04
|
Commit-ID: 5c8d1cbbbed39dcab2ecf429d6e56ea548c0fda4 Gitweb: http://git.kernel.org/tip/5c8d1cbbbed39dcab2ecf429d6e56ea548c0fda4 Author: Masami Hiramatsu <mhi...@re...> AuthorDate: Thu, 25 Feb 2010 08:36:04 -0500 Committer: Ingo Molnar <mi...@el...> CommitDate: Thu, 25 Feb 2010 17:49:30 +0100 perf probe: Show more lines after last line Show 2 more lines after the last probe-able line. This will clearly show the last closed-brace of inline functions. Signed-off-by: Masami Hiramatsu <mhi...@re...> Cc: systemtap <sys...@so...> Cc: DLE <dle...@li...> Cc: Frederic Weisbecker <fwe...@gm...> Cc: Arnaldo Carvalho de Melo <ac...@re...> Cc: Peter Zijlstra <pe...@in...> Cc: Paul Mackerras <pa...@sa...> Cc: Mike Galbraith <ef...@gm...> Cc: K.Prasad <pr...@li...> Cc: Frederic Weisbecker <fwe...@gm...> Cc: Ananth N Mavinakayanahalli <an...@in...> LKML-Reference: <20100225133604.6725.76820.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mi...@el...> --- tools/perf/util/probe-event.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 71b0dd5..91f55f2 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -716,6 +716,7 @@ void del_trace_kprobe_events(struct strlist *dellist) } #define LINEBUF_SIZE 256 +#define NR_ADDITIONAL_LINES 2 static void show_one_line(FILE *fp, unsigned int l, bool skip, bool show_num) { @@ -776,5 +777,11 @@ void show_line_range(struct line_range *lr) show_one_line(fp, (l++) - lr->offset, false, false); show_one_line(fp, (l++) - lr->offset, false, true); } + + if (lr->end == INT_MAX) + lr->end = l + NR_ADDITIONAL_LINES; + while (l < lr->end && !feof(fp)) + show_one_line(fp, (l++) - lr->offset, false, false); + fclose(fp); } |