linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tip/perf/core] perf probe: Fix 'function unused' warning
@ 2015-05-28  2:25 Wang Nan
  2015-05-28  5:27 ` Masami Hiramatsu
  2015-05-29 18:35 ` [tip:perf/core] " tip-bot for Wang Nan
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Nan @ 2015-05-28  2:25 UTC (permalink / raw)
  To: masami.hiramatsu.pt; +Cc: acme, linux-kernel, lizefan, mingo, pi3orama

By 'make build-test' a warning is found in probe-event.c that, after
commit 419e873828 (perf probe: Show the error reason comes from
invalid DSO) the only user of kernel_get_module_dso() is
open_debuginfo(). Which is not compiled if HAVE_DWARF_SUPPORT not set.
'make build-test' found this problem when make_minimal.

This patch moves kernel_get_module_dso() to HAVE_DWARF_SUPPORT ifdef
section.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
 tools/perf/util/probe-event.c | 65 ++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 97da984..9052e7b 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -200,38 +200,6 @@ static void put_target_map(struct map *map, bool user)
 }
 
 
-static int kernel_get_module_dso(const char *module, struct dso **pdso)
-{
-	struct dso *dso;
-	struct map *map;
-	const char *vmlinux_name;
-	int ret = 0;
-
-	if (module) {
-		list_for_each_entry(dso, &host_machine->kernel_dsos.head,
-				    node) {
-			if (strncmp(dso->short_name + 1, module,
-				    dso->short_name_len - 2) == 0)
-				goto found;
-		}
-		pr_debug("Failed to find module %s.\n", module);
-		return -ENOENT;
-	}
-
-	map = host_machine->vmlinux_maps[MAP__FUNCTION];
-	dso = map->dso;
-
-	vmlinux_name = symbol_conf.vmlinux_name;
-	dso->load_errno = 0;
-	if (vmlinux_name)
-		ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL);
-	else
-		ret = dso__load_vmlinux_path(dso, map, NULL);
-found:
-	*pdso = dso;
-	return ret;
-}
-
 static int convert_exec_to_group(const char *exec, char **result)
 {
 	char *ptr1, *ptr2, *exec_copy;
@@ -279,6 +247,39 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
 }
 
 #ifdef HAVE_DWARF_SUPPORT
+
+static int kernel_get_module_dso(const char *module, struct dso **pdso)
+{
+	struct dso *dso;
+	struct map *map;
+	const char *vmlinux_name;
+	int ret = 0;
+
+	if (module) {
+		list_for_each_entry(dso, &host_machine->kernel_dsos.head,
+				    node) {
+			if (strncmp(dso->short_name + 1, module,
+				    dso->short_name_len - 2) == 0)
+				goto found;
+		}
+		pr_debug("Failed to find module %s.\n", module);
+		return -ENOENT;
+	}
+
+	map = host_machine->vmlinux_maps[MAP__FUNCTION];
+	dso = map->dso;
+
+	vmlinux_name = symbol_conf.vmlinux_name;
+	dso->load_errno = 0;
+	if (vmlinux_name)
+		ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL);
+	else
+		ret = dso__load_vmlinux_path(dso, map, NULL);
+found:
+	*pdso = dso;
+	return ret;
+}
+
 /*
  * Some binaries like glibc have special symbols which are on the symbol
  * table, but not in the debuginfo. If we can find the address of the
-- 
1.8.3.4


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

* Re: [PATCH tip/perf/core] perf probe: Fix 'function unused' warning
  2015-05-28  2:25 [PATCH tip/perf/core] perf probe: Fix 'function unused' warning Wang Nan
@ 2015-05-28  5:27 ` Masami Hiramatsu
  2015-05-29 13:29   ` Arnaldo Carvalho de Melo
  2015-05-29 18:35 ` [tip:perf/core] " tip-bot for Wang Nan
  1 sibling, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2015-05-28  5:27 UTC (permalink / raw)
  To: Wang Nan; +Cc: acme, linux-kernel, lizefan, mingo

On 2015/05/28 11:25, Wang Nan wrote:
> By 'make build-test' a warning is found in probe-event.c that, after
> commit 419e873828 (perf probe: Show the error reason comes from
> invalid DSO) the only user of kernel_get_module_dso() is
> open_debuginfo(). Which is not compiled if HAVE_DWARF_SUPPORT not set.
> 'make build-test' found this problem when make_minimal.

Ah, right!

> 
> This patch moves kernel_get_module_dso() to HAVE_DWARF_SUPPORT ifdef
> section.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thanks!

> ---
>  tools/perf/util/probe-event.c | 65 ++++++++++++++++++++++---------------------
>  1 file changed, 33 insertions(+), 32 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 97da984..9052e7b 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -200,38 +200,6 @@ static void put_target_map(struct map *map, bool user)
>  }
>  
>  
> -static int kernel_get_module_dso(const char *module, struct dso **pdso)
> -{
> -	struct dso *dso;
> -	struct map *map;
> -	const char *vmlinux_name;
> -	int ret = 0;
> -
> -	if (module) {
> -		list_for_each_entry(dso, &host_machine->kernel_dsos.head,
> -				    node) {
> -			if (strncmp(dso->short_name + 1, module,
> -				    dso->short_name_len - 2) == 0)
> -				goto found;
> -		}
> -		pr_debug("Failed to find module %s.\n", module);
> -		return -ENOENT;
> -	}
> -
> -	map = host_machine->vmlinux_maps[MAP__FUNCTION];
> -	dso = map->dso;
> -
> -	vmlinux_name = symbol_conf.vmlinux_name;
> -	dso->load_errno = 0;
> -	if (vmlinux_name)
> -		ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL);
> -	else
> -		ret = dso__load_vmlinux_path(dso, map, NULL);
> -found:
> -	*pdso = dso;
> -	return ret;
> -}
> -
>  static int convert_exec_to_group(const char *exec, char **result)
>  {
>  	char *ptr1, *ptr2, *exec_copy;
> @@ -279,6 +247,39 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
>  }
>  
>  #ifdef HAVE_DWARF_SUPPORT
> +
> +static int kernel_get_module_dso(const char *module, struct dso **pdso)
> +{
> +	struct dso *dso;
> +	struct map *map;
> +	const char *vmlinux_name;
> +	int ret = 0;
> +
> +	if (module) {
> +		list_for_each_entry(dso, &host_machine->kernel_dsos.head,
> +				    node) {
> +			if (strncmp(dso->short_name + 1, module,
> +				    dso->short_name_len - 2) == 0)
> +				goto found;
> +		}
> +		pr_debug("Failed to find module %s.\n", module);
> +		return -ENOENT;
> +	}
> +
> +	map = host_machine->vmlinux_maps[MAP__FUNCTION];
> +	dso = map->dso;
> +
> +	vmlinux_name = symbol_conf.vmlinux_name;
> +	dso->load_errno = 0;
> +	if (vmlinux_name)
> +		ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL);
> +	else
> +		ret = dso__load_vmlinux_path(dso, map, NULL);
> +found:
> +	*pdso = dso;
> +	return ret;
> +}
> +
>  /*
>   * Some binaries like glibc have special symbols which are on the symbol
>   * table, but not in the debuginfo. If we can find the address of the
> 


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com

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

* Re: [PATCH tip/perf/core] perf probe: Fix 'function unused' warning
  2015-05-28  5:27 ` Masami Hiramatsu
@ 2015-05-29 13:29   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-29 13:29 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Wang Nan, linux-kernel, lizefan, mingo

Em Thu, May 28, 2015 at 02:27:13PM +0900, Masami Hiramatsu escreveu:
> On 2015/05/28 11:25, Wang Nan wrote:
> > By 'make build-test' a warning is found in probe-event.c that, after
> > commit 419e873828 (perf probe: Show the error reason comes from
> > invalid DSO) the only user of kernel_get_module_dso() is
> > open_debuginfo(). Which is not compiled if HAVE_DWARF_SUPPORT not set.
> > 'make build-test' found this problem when make_minimal.
> 
> Ah, right!
> 
> > 
> > This patch moves kernel_get_module_dso() to HAVE_DWARF_SUPPORT ifdef
> > section.
> > 
> > Signed-off-by: Wang Nan <wangnan0@huawei.com>
> 
> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thanks, applied!

- Arnaldo

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

* [tip:perf/core] perf probe: Fix 'function unused' warning
  2015-05-28  2:25 [PATCH tip/perf/core] perf probe: Fix 'function unused' warning Wang Nan
  2015-05-28  5:27 ` Masami Hiramatsu
@ 2015-05-29 18:35 ` tip-bot for Wang Nan
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Wang Nan @ 2015-05-29 18:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, wangnan0, hpa, linux-kernel, lizefan, acme,
	masami.hiramatsu.pt, tglx

Commit-ID:  60fb7742928dab3c6a0fec7f2d2cce26d9366a3c
Gitweb:     http://git.kernel.org/tip/60fb7742928dab3c6a0fec7f2d2cce26d9366a3c
Author:     Wang Nan <wangnan0@huawei.com>
AuthorDate: Thu, 28 May 2015 02:25:05 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 29 May 2015 12:43:39 -0300

perf probe: Fix 'function unused' warning

By 'make build-test' a warning is found in probe-event.c that, after
commit 419e873828 (perf probe: Show the error reason comes from
invalid DSO) the only user of kernel_get_module_dso() is
open_debuginfo(). Which is not compiled if HAVE_DWARF_SUPPORT not set.

'make build-test' found this problem when make_minimal.

This patch moves kernel_get_module_dso() to HAVE_DWARF_SUPPORT ifdef
section.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1432779905-206143-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 65 ++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index b0b8a80..e6a02b1 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -200,38 +200,6 @@ static void put_target_map(struct map *map, bool user)
 }
 
 
-static int kernel_get_module_dso(const char *module, struct dso **pdso)
-{
-	struct dso *dso;
-	struct map *map;
-	const char *vmlinux_name;
-	int ret = 0;
-
-	if (module) {
-		list_for_each_entry(dso, &host_machine->kernel_dsos.head,
-				    node) {
-			if (strncmp(dso->short_name + 1, module,
-				    dso->short_name_len - 2) == 0)
-				goto found;
-		}
-		pr_debug("Failed to find module %s.\n", module);
-		return -ENOENT;
-	}
-
-	map = host_machine->vmlinux_maps[MAP__FUNCTION];
-	dso = map->dso;
-
-	vmlinux_name = symbol_conf.vmlinux_name;
-	dso->load_errno = 0;
-	if (vmlinux_name)
-		ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL);
-	else
-		ret = dso__load_vmlinux_path(dso, map, NULL);
-found:
-	*pdso = dso;
-	return ret;
-}
-
 static int convert_exec_to_group(const char *exec, char **result)
 {
 	char *ptr1, *ptr2, *exec_copy;
@@ -279,6 +247,39 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
 }
 
 #ifdef HAVE_DWARF_SUPPORT
+
+static int kernel_get_module_dso(const char *module, struct dso **pdso)
+{
+	struct dso *dso;
+	struct map *map;
+	const char *vmlinux_name;
+	int ret = 0;
+
+	if (module) {
+		list_for_each_entry(dso, &host_machine->kernel_dsos.head,
+				    node) {
+			if (strncmp(dso->short_name + 1, module,
+				    dso->short_name_len - 2) == 0)
+				goto found;
+		}
+		pr_debug("Failed to find module %s.\n", module);
+		return -ENOENT;
+	}
+
+	map = host_machine->vmlinux_maps[MAP__FUNCTION];
+	dso = map->dso;
+
+	vmlinux_name = symbol_conf.vmlinux_name;
+	dso->load_errno = 0;
+	if (vmlinux_name)
+		ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL);
+	else
+		ret = dso__load_vmlinux_path(dso, map, NULL);
+found:
+	*pdso = dso;
+	return ret;
+}
+
 /*
  * Some binaries like glibc have special symbols which are on the symbol
  * table, but not in the debuginfo. If we can find the address of the

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

end of thread, other threads:[~2015-05-29 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28  2:25 [PATCH tip/perf/core] perf probe: Fix 'function unused' warning Wang Nan
2015-05-28  5:27 ` Masami Hiramatsu
2015-05-29 13:29   ` Arnaldo Carvalho de Melo
2015-05-29 18:35 ` [tip:perf/core] " tip-bot for Wang Nan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).