From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbbE1F1b (ORCPT ); Thu, 28 May 2015 01:27:31 -0400 Received: from mail7.hitachi.co.jp ([133.145.228.42]:48734 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751747AbbE1F1V (ORCPT ); Thu, 28 May 2015 01:27:21 -0400 Message-ID: <5566A731.9090707@hitachi.com> Date: Thu, 28 May 2015 14:27:13 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Wang Nan CC: acme@kernel.org, linux-kernel@vger.kernel.org, lizefan@huawei.com, mingo@redhat.com Subject: Re: [PATCH tip/perf/core] perf probe: Fix 'function unused' warning References: <1432779905-206143-1-git-send-email-wangnan0@huawei.com> In-Reply-To: <1432779905-206143-1-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Masami Hiramatsu 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