2014-01-23 19:38:29

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [GIT PULL 0/2] perf/urgent fixes

From: Arnaldo Carvalho de Melo <[email protected]>

Hi Ingo,

Please consider pulling,

Regards,

- Arnaldo

The following changes since commit bb236de5d9509c1c6ea5ce0680f000002e731ee2:

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2014-01-23 17:43:35 +0100)

are available in the git repository at:


git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo

for you to fetch changes up to 4afc81cd1caa93daa50c1c29a3ab747c978abc13:

perf symbols: Load map before using map->map_ip() (2014-01-23 15:48:12 -0300)

----------------------------------------------------------------
perf/urgent fixes:

. Fix traceevent plugin path definitions (Josh Boyer)

. Load map before using map->map_ip() (Masami Hiramatsu)

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>

----------------------------------------------------------------
Josh Boyer (1):
perf tools: Fix traceevent plugin path definitions

Masami Hiramatsu (1):
perf symbols: Load map before using map->map_ip()

tools/lib/traceevent/Makefile | 2 +-
tools/perf/config/Makefile | 2 +-
tools/perf/util/map.c | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)


2014-01-23 19:38:32

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 1/2] perf tools: Fix traceevent plugin path definitions

From: Josh Boyer <[email protected]>

The plugindir_SQ definition contains $(prefix) which is not needed as
the $(libdir) definition already contains prefix in it. This leads to
the path including an extra prefix in it, e.g. /usr/usr/lib64.

The -DPLUGIN_DIR defintion includes DESTDIR. This is incorrect, as it
sets the plugin search path to include the value of DESTDIR. DESTDIR is
a mechanism to install in a non-standard location such as a chroot or an
RPM build root. In the RPM case, this leads to the search path being
incorrect after the resulting RPM is installed (or in some cases an RPM
build failure).

Remove both of these unnecessary inclusions.

Signed-off-by: Josh Boyer <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Steven Rostedt <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/lib/traceevent/Makefile | 2 +-
tools/perf/config/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 56d52a33a3df..005c9cc06935 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -63,7 +63,7 @@ endif
endif

ifeq ($(set_plugin_dir),1)
-PLUGIN_DIR = -DPLUGIN_DIR="$(DESTDIR)/$(plugin_dir)"
+PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
endif

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index d604e50fc167..c48d44958172 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -600,5 +600,5 @@ perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
# Otherwise we install plugins into the global $(libdir).
ifdef DESTDIR
plugindir=$(libdir)/traceevent/plugins
-plugindir_SQ= $(subst ','\'',$(prefix)/$(plugindir))
+plugindir_SQ= $(subst ','\'',$(plugindir))
endif
--
1.8.1.4

2014-01-23 19:38:31

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 2/2] perf symbols: Load map before using map->map_ip()

From: Masami Hiramatsu <[email protected]>

In map_groups__find_symbol() map->map_ip is used without ensuring the
map is loaded. Then the address passed to map->map_ip isn't mapped at
the first time.

E.g. below code always fails to get a symbol at the first call;

addr = /* Somewhere in the kernel text */
symbol_conf.try_vmlinux_path = true;
symbol__init();
host_machine = machine__new_host();
sym = machine__find_kernel_function(host_machine,
addr, NULL, NULL);
/* Note that machine__find_kernel_function calls
map_groups__find_symbol */

This ensures it by calling map__load before using it in
map_groups__find_symbol().

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: "David A. Long" <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Srikar Dronamraju <[email protected]>
Cc: "Steven Rostedt (Red Hat)" <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/20140123022950.7206.17357.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/map.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index ee1dd687a262..3b97513f0e77 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -386,7 +386,8 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg,
{
struct map *map = map_groups__find(mg, type, addr);

- if (map != NULL) {
+ /* Ensure map is loaded before using map->map_ip */
+ if (map != NULL && map__load(map, filter) >= 0) {
if (mapp != NULL)
*mapp = map;
return map__find_symbol(map, map->map_ip(map, addr), filter);
--
1.8.1.4

2014-01-25 07:23:44

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL 0/2] perf/urgent fixes


* Arnaldo Carvalho de Melo <[email protected]> wrote:

> From: Arnaldo Carvalho de Melo <[email protected]>
>
> Hi Ingo,
>
> Please consider pulling,
>
> Regards,
>
> - Arnaldo
>
> The following changes since commit bb236de5d9509c1c6ea5ce0680f000002e731ee2:
>
> Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2014-01-23 17:43:35 +0100)
>
> are available in the git repository at:
>
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo
>
> for you to fetch changes up to 4afc81cd1caa93daa50c1c29a3ab747c978abc13:
>
> perf symbols: Load map before using map->map_ip() (2014-01-23 15:48:12 -0300)
>
> ----------------------------------------------------------------
> perf/urgent fixes:
>
> . Fix traceevent plugin path definitions (Josh Boyer)
>
> . Load map before using map->map_ip() (Masami Hiramatsu)
>
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
>
> ----------------------------------------------------------------
> Josh Boyer (1):
> perf tools: Fix traceevent plugin path definitions
>
> Masami Hiramatsu (1):
> perf symbols: Load map before using map->map_ip()
>
> tools/lib/traceevent/Makefile | 2 +-
> tools/perf/config/Makefile | 2 +-
> tools/perf/util/map.c | 3 ++-
> 3 files changed, 4 insertions(+), 3 deletions(-)

Pulled, thanks Arnaldo!

Ingo