All of lore.kernel.org
 help / color / mirror / Atom feed
* perf probe -F with wildcards
@ 2016-07-15  0:16 Arnaldo Carvalho de Melo
  2016-07-15  7:15 ` Masami Hiramatsu
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15  0:16 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Daniel Bristot de Oliveira, Linux Kernel Mailing List

Hi Masami,

	I think this worked at some point?

[root@jouet acme]# perf probe -F | tail
zswap_frontswap_init
zswap_frontswap_invalidate_area
zswap_frontswap_invalidate_page
zswap_frontswap_load
zswap_frontswap_store
zswap_pool_create
zswap_pool_current
zswap_update_total_size
zswap_writeback_entry
zswap_zpool_param_set
[root@jouet acme]# perf probe -F rt_sp*
no symbols found in [kernel.kallsyms], maybe install a debug package?
Failed to load symbols in kernel
[root@jouet acme]# perf probe -F rt_sp\*
no symbols found in [kernel.kallsyms], maybe install a debug package?
Failed to load symbols in kernel
[root@jouet acme]# 


I.e. the second message is misleading :-\

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: perf probe -F with wildcards
  2016-07-15  0:16 perf probe -F with wildcards Arnaldo Carvalho de Melo
@ 2016-07-15  7:15 ` Masami Hiramatsu
  2016-07-15 13:14   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2016-07-15  7:15 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Daniel Bristot de Oliveira, Linux Kernel Mailing List

Hi Arnaldo,

On Thu, 14 Jul 2016 21:16:41 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Masami,
> 
> 	I think this worked at some point?
> 
> [root@jouet acme]# perf probe -F | tail
> zswap_frontswap_init
> zswap_frontswap_invalidate_area
> zswap_frontswap_invalidate_page
> zswap_frontswap_load
> zswap_frontswap_store
> zswap_pool_create
> zswap_pool_current
> zswap_update_total_size
> zswap_writeback_entry
> zswap_zpool_param_set
> [root@jouet acme]# perf probe -F rt_sp*
> no symbols found in [kernel.kallsyms], maybe install a debug package?
> Failed to load symbols in kernel

It seems that 2 problems we have,
- There is no function which starts with rt_sp.
- The error message is not good for that.
If you try perf probe -F acpi_*, you'll see a list of functions.

> [root@jouet acme]# perf probe -F rt_sp\*
> no symbols found in [kernel.kallsyms], maybe install a debug package?
> Failed to load symbols in kernel

So, yeah, it should check symbol loading is really failed and should be
changed as "no symbols match to given filter" etc.

Thank you,

> [root@jouet acme]# 


> 
> 
> I.e. the second message is misleading :-\
> 
> - Arnaldo
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: perf probe -F with wildcards
  2016-07-15  7:15 ` Masami Hiramatsu
@ 2016-07-15 13:14   ` Arnaldo Carvalho de Melo
  2016-07-18 16:12     ` [PATCH] [BUGFIX] perf-probe: Warn unmatched function filter correctly Masami Hiramatsu
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 13:14 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Daniel Bristot de Oliveira, Linux Kernel Mailing List

Em Fri, Jul 15, 2016 at 04:15:48PM +0900, Masami Hiramatsu escreveu:
> On Thu, 14 Jul 2016 21:16:41 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
 
> > 	I think this worked at some point?

> > [root@jouet acme]# perf probe -F | tail
> > zswap_frontswap_init
> > zswap_frontswap_invalidate_area
> > zswap_frontswap_invalidate_page
> > zswap_frontswap_load
> > zswap_frontswap_store
> > zswap_pool_create
> > zswap_pool_current
> > zswap_update_total_size
> > zswap_writeback_entry
> > zswap_zpool_param_set
> > [root@jouet acme]# perf probe -F rt_sp*
> > no symbols found in [kernel.kallsyms], maybe install a debug package?
> > Failed to load symbols in kernel
 
> It seems that 2 problems we have,
> - There is no function which starts with rt_sp.

Yeah, that is the problem at hand, I figured there weren't functions
liek that, but the error message was tottally misleading :-)

> - The error message is not good for that.
> If you try perf probe -F acpi_*, you'll see a list of functions.
> 
> > [root@jouet acme]# perf probe -F rt_sp\*
> > no symbols found in [kernel.kallsyms], maybe install a debug package?
> > Failed to load symbols in kernel
> 
> So, yeah, it should check symbol loading is really failed and should be
> changed as "no symbols match to given filter" etc.

Right,

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] [BUGFIX] perf-probe: Warn unmatched function filter correctly
  2016-07-15 13:14   ` Arnaldo Carvalho de Melo
@ 2016-07-18 16:12     ` Masami Hiramatsu
  2016-07-19  6:54       ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
  0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2016-07-18 16:12 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Masami Hiramatsu, linux-kernel, Namhyung Kim, Peter Zijlstra,
	Ingo Molnar

Warn unmatched function filter correctly instead of warning
"symbol-loading error", since that can be a filter issue.

>From the technical point of view, this adds a filter chech
in map__load and if there is a filter, it returns -2 (filter-out),
instead of -1 (error), and perf-probe checks it and change
message.

E.g. without this fix:
  ----
  # perf probe -F rt_sp*
  no symbols found in [kernel.kallsyms], maybe install a debug package?
  Failed to load symbols in kernel
  ----
With this fix:
  ----
  # perf probe -F rt_sp*
  no symbols passed the given filter.
  Failed to find symbols matched to "rt_sp*"
    Error: Failed to show functions.
  ----

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 tools/perf/util/map.c         |    3 +++
 tools/perf/util/probe-event.c |   12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index b39b12a..728129a 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -312,6 +312,9 @@ int map__load(struct map *map, symbol_filter_t filter)
 			pr_warning("%.*s was updated (is prelink enabled?). "
 				"Restart the long running apps that use it!\n",
 				   (int)real_len, name);
+		} else if (filter) {
+			pr_warning("no symbols passed the given filter.\n");
+			return -2;	/* Empty but maybe by the filter */
 		} else {
 			pr_warning("no symbols found in %s, maybe install "
 				   "a debug package?\n", name);
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d4f8835..953dc1a 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -3312,8 +3312,16 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
 
 	/* Load symbols with given filter */
 	available_func_filter = _filter;
-	if (map__load(map, filter_available_functions)) {
-		pr_err("Failed to load symbols in %s\n", (target) ? : "kernel");
+	ret = map__load(map, filter_available_functions);
+	if (ret) {
+		if (ret == -2) {
+			char *str = strfilter__string(_filter);
+			pr_err("Failed to find symbols matched to \"%s\"\n",
+			       str);
+			free(str);
+		} else
+			pr_err("Failed to load symbols in %s\n",
+			       (target) ? : "kernel");
 		goto end;
 	}
 	if (!dso__sorted_by_name(map->dso, map->type))

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip:perf/core] perf probe: Warn unmatched function filter correctly
  2016-07-18 16:12     ` [PATCH] [BUGFIX] perf-probe: Warn unmatched function filter correctly Masami Hiramatsu
@ 2016-07-19  6:54       ` tip-bot for Masami Hiramatsu
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2016-07-19  6:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, tglx, peterz, mhiramat, linux-kernel, namhyung, hpa, acme

Commit-ID:  e70493429bb1acaad829caae01c61dd7056fe671
Gitweb:     http://git.kernel.org/tip/e70493429bb1acaad829caae01c61dd7056fe671
Author:     Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Tue, 19 Jul 2016 01:12:41 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 18 Jul 2016 19:46:34 -0300

perf probe: Warn unmatched function filter correctly

Warn unmatched function filter correctly instead of warning
"symbol-loading error", since that can be a filter issue.

>From the technical point of view, this adds a filter chech in map__load
and if there is a filter, it returns -2 (filter-out), instead of -1
(error), and perf-probe checks it and change message.

E.g. without this fix:

  # perf probe -F rt_sp*
  no symbols found in [kernel.kallsyms], maybe install a debug package?
  Failed to load symbols in kernel

With this fix:

  # perf probe -F rt_sp*
  no symbols passed the given filter.
  Failed to find symbols matched to "rt_sp*"
    Error: Failed to show functions.

Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146885835596.16106.2293540792775552481.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/map.c         |  3 +++
 tools/perf/util/probe-event.c | 12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index b39b12a..728129a 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -312,6 +312,9 @@ int map__load(struct map *map, symbol_filter_t filter)
 			pr_warning("%.*s was updated (is prelink enabled?). "
 				"Restart the long running apps that use it!\n",
 				   (int)real_len, name);
+		} else if (filter) {
+			pr_warning("no symbols passed the given filter.\n");
+			return -2;	/* Empty but maybe by the filter */
 		} else {
 			pr_warning("no symbols found in %s, maybe install "
 				   "a debug package?\n", name);
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d4f8835..953dc1a 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -3312,8 +3312,16 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
 
 	/* Load symbols with given filter */
 	available_func_filter = _filter;
-	if (map__load(map, filter_available_functions)) {
-		pr_err("Failed to load symbols in %s\n", (target) ? : "kernel");
+	ret = map__load(map, filter_available_functions);
+	if (ret) {
+		if (ret == -2) {
+			char *str = strfilter__string(_filter);
+			pr_err("Failed to find symbols matched to \"%s\"\n",
+			       str);
+			free(str);
+		} else
+			pr_err("Failed to load symbols in %s\n",
+			       (target) ? : "kernel");
 		goto end;
 	}
 	if (!dso__sorted_by_name(map->dso, map->type))

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-19  6:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15  0:16 perf probe -F with wildcards Arnaldo Carvalho de Melo
2016-07-15  7:15 ` Masami Hiramatsu
2016-07-15 13:14   ` Arnaldo Carvalho de Melo
2016-07-18 16:12     ` [PATCH] [BUGFIX] perf-probe: Warn unmatched function filter correctly Masami Hiramatsu
2016-07-19  6:54       ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.