linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 0/4] perf/urgent fixes
@ 2012-04-20 16:53 Arnaldo Carvalho de Melo
  2012-04-20 16:53 ` [PATCH 1/4] perf report: Fix crash showing warning related to kernel maps Arnaldo Carvalho de Melo
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-20 16:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Avi Kivity,
	Corey Ashford, David Ahern, Frederic Weisbecker, Gleb Natapov,
	Jiri Olsa, Namhyung Kim, Otavio Salvador, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian, arnaldo.melo,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

Regards,

- Arnaldo

The following changes since commit 7ea6411f4ceb62e5e53170d59d10996dca20c599:

  Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2012-04-15 08:02:36 +0200)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux perf/urgent

for you to fetch changes up to 33ff581eddf744ea91a50d46c2f0961b375a9595:

  perf symbols: Read plt symbols from proper symtab_type binary (2012-04-20 13:34:49 -0300)

----------------------------------------------------------------
Fixes for perf/urgent

. Read PLT symbols from the same DSO as the main symtab, fix from Jiri Olsa.

. Add back the 'g' and 'h' event modifiers, they were dropped during the
  conversion to use bison. Fix from Gleb Natapov

. Drop CROSS_COMPILE from flex and bison calls, not really needed. From
  Otavio Salvador

. A kernel map variable can be NULL, but was being used despite the earlier
  check. Fix from David Ahern

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
David Ahern (1):
      perf report: Fix crash showing warning related to kernel maps

Gleb Natapov (1):
      perf tools: Add 'G' and 'H' modifiers to event parsing

Jiri Olsa (1):
      perf symbols: Read plt symbols from proper symtab_type binary

Otavio Salvador (1):
      perf tools: Drop CROSS_COMPILE from flex and bison calls

 tools/perf/Makefile            |    4 ++--
 tools/perf/builtin-report.c    |   17 ++++++++++++-----
 tools/perf/builtin-test.c      |   30 ++++++++++++++++++++++++++++++
 tools/perf/util/parse-events.l |    2 +-
 tools/perf/util/symbol.c       |   13 ++++++-------
 5 files changed, 51 insertions(+), 15 deletions(-)

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

* [PATCH 1/4] perf report: Fix crash showing warning related to kernel maps
  2012-04-20 16:53 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2012-04-20 16:53 ` Arnaldo Carvalho de Melo
  2012-04-20 16:53 ` [PATCH 2/4] perf tools: Drop CROSS_COMPILE from flex and bison calls Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-20 16:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Ingo Molnar, Peter Zijlstra,
	Stephane Eranian, Namhyung Kim, Arnaldo Carvalho de Melo

From: David Ahern <dsahern@gmail.com>

While testing https://lkml.org/lkml/2012/4/10/123 I hit this crash:

(gdb) bt
 0  0x000000000042000f in __cmd_report (rep=0x7fff80cec580) at builtin-report.c:380
 1  cmd_report (argc=0, argv=<optimized out>, prefix=<optimized out>) at builtin-report.c:759
 2  0x0000000000414513 in run_builtin (p=0x7724a8, argc=3, argv=0x7fff80ceca70) at perf.c:273
 3  0x0000000000413d41 in handle_internal_command (argv=0x7fff80ceca70, argc=3) at perf.c:345
 4  run_argv (argv=0x7fff80cec880, argcp=0x7fff80cec88c) at perf.c:389
 5  main (argc=3, argv=0x7fff80ceca70) at perf.c:487

kernel_map can be NULL, so need to handle it while dumping a warning
to user.

v2:
- fixed RB_EMPTY_ROOT check -- desc takes the altnerative output when RB_EMPTY_ROOT is false.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Link: http://lkml.kernel.org/r/1334544855-55021-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2e31743..cdae9b2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -374,16 +374,23 @@ static int __cmd_report(struct perf_report *rep)
 	    (kernel_map->dso->hit &&
 	     (kernel_kmap->ref_reloc_sym == NULL ||
 	      kernel_kmap->ref_reloc_sym->addr == 0))) {
-		const struct dso *kdso = kernel_map->dso;
+		const char *desc =
+		    "As no suitable kallsyms nor vmlinux was found, kernel samples\n"
+		    "can't be resolved.";
+
+		if (kernel_map) {
+			const struct dso *kdso = kernel_map->dso;
+			if (!RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION])) {
+				desc = "If some relocation was applied (e.g. "
+				       "kexec) symbols may be misresolved.";
+			}
+		}
 
 		ui__warning(
 "Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n"
 "Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n"
 "Samples in kernel modules can't be resolved as well.\n\n",
-			    RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION]) ?
-"As no suitable kallsyms nor vmlinux was found, kernel samples\n"
-"can't be resolved." :
-"If some relocation was applied (e.g. kexec) symbols may be misresolved.");
+		desc);
 	}
 
 	if (dump_trace) {
-- 
1.7.9.2.358.g22243


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

* [PATCH 2/4] perf tools: Drop CROSS_COMPILE from flex and bison calls
  2012-04-20 16:53 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
  2012-04-20 16:53 ` [PATCH 1/4] perf report: Fix crash showing warning related to kernel maps Arnaldo Carvalho de Melo
@ 2012-04-20 16:53 ` Arnaldo Carvalho de Melo
  2012-04-20 16:53 ` [PATCH 3/4] perf tools: Add 'G' and 'H' modifiers to event parsing Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-20 16:53 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Otavio Salvador, Arnaldo Carvalho de Melo

From: Otavio Salvador <otavio@ossystems.com.br>

The flex and bison tools generate arch-independent C code so its
binaries are not prefixed with the target-arch prefix. With this patch
the Linux 3.4-rc2 can be successfuly build on OE-Core.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Link: http://lkml.kernel.org/r/1334148270-13139-1-git-send-email-otavio@ossystems.com.br
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 03059e7..9bf3fc7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -234,8 +234,8 @@ endif
 
 export PERL_PATH
 
-FLEX = $(CROSS_COMPILE)flex
-BISON= $(CROSS_COMPILE)bison
+FLEX = flex
+BISON= bison
 
 $(OUTPUT)util/parse-events-flex.c: util/parse-events.l
 	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
-- 
1.7.9.2.358.g22243


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

* [PATCH 3/4] perf tools: Add 'G' and 'H' modifiers to event parsing
  2012-04-20 16:53 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
  2012-04-20 16:53 ` [PATCH 1/4] perf report: Fix crash showing warning related to kernel maps Arnaldo Carvalho de Melo
  2012-04-20 16:53 ` [PATCH 2/4] perf tools: Drop CROSS_COMPILE from flex and bison calls Arnaldo Carvalho de Melo
@ 2012-04-20 16:53 ` Arnaldo Carvalho de Melo
  2012-04-20 16:53 ` [PATCH 4/4] perf symbols: Read plt symbols from proper symtab_type binary Arnaldo Carvalho de Melo
  2012-04-25  7:08 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-20 16:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Gleb Natapov, Avi Kivity, Ingo Molnar,
	Peter Zijlstra, Jiri Olsa, Arnaldo Carvalho de Melo

From: Gleb Natapov <gleb@redhat.com>

They were dropped during conversion of event parser. Add test case to
make sure this will not happen again.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20120417111345.GK11918@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c      |   30 ++++++++++++++++++++++++++++++
 tools/perf/util/parse-events.l |    2 +-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 1c5b980..223ffdc 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -851,6 +851,28 @@ static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist)
 	return test__checkevent_symbolic_name(evlist);
 }
 
+static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
+	TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
+
+	return test__checkevent_symbolic_name(evlist);
+}
+
+static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = list_entry(evlist->entries.next,
+					      struct perf_evsel, node);
+
+	TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
+	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
+
+	return test__checkevent_symbolic_name(evlist);
+}
+
 static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist)
 {
 	struct perf_evsel *evsel = list_entry(evlist->entries.next,
@@ -1091,6 +1113,14 @@ static struct test__event_st {
 		.name  = "r1,syscalls:sys_enter_open:k,1:1:hp",
 		.check = test__checkevent_list,
 	},
+	{
+		.name  = "instructions:G",
+		.check = test__checkevent_exclude_host_modifier,
+	},
+	{
+		.name  = "instructions:H",
+		.check = test__checkevent_exclude_guest_modifier,
+	},
 };
 
 #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st))
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 05d766e..1fcf1bb 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -54,7 +54,7 @@ num_dec		[0-9]+
 num_hex		0x[a-fA-F0-9]+
 num_raw_hex	[a-fA-F0-9]+
 name		[a-zA-Z_*?][a-zA-Z0-9_*?]*
-modifier_event	[ukhp]{1,5}
+modifier_event	[ukhpGH]{1,8}
 modifier_bp	[rwx]
 
 %%
-- 
1.7.9.2.358.g22243


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

* [PATCH 4/4] perf symbols: Read plt symbols from proper symtab_type binary
  2012-04-20 16:53 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2012-04-20 16:53 ` [PATCH 3/4] perf tools: Add 'G' and 'H' modifiers to event parsing Arnaldo Carvalho de Melo
@ 2012-04-20 16:53 ` Arnaldo Carvalho de Melo
  2012-04-25  7:08 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-04-20 16:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, Frederic Weisbecker,
	Ingo Molnar, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

When loading symbols from DSO we check multiple paths of DSO binary
until we succeed to load symbols ('.symtab' section). Once symbols are
read we try to load also plt symbols.

During the reading of plt symbols, the dso file is reopened from
location given by dso->long_name. This could be wrong in case we want
process buildid binaries.

The change is to make the plt symbols being read from the DSO path, that
normal symbols were read from.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1334756818-6631-1-git-send-email-jolsa@redhat.com
[ committer note: moved dso to be the first parameter of that function ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c0a028c..ab9867b 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -977,8 +977,9 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
  * And always look at the original dso, not at debuginfo packages, that
  * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
  */
-static int dso__synthesize_plt_symbols(struct  dso *dso, struct map *map,
-				       symbol_filter_t filter)
+static int
+dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map,
+			    symbol_filter_t filter)
 {
 	uint32_t nr_rel_entries, idx;
 	GElf_Sym sym;
@@ -993,10 +994,7 @@ static int dso__synthesize_plt_symbols(struct  dso *dso, struct map *map,
 	char sympltname[1024];
 	Elf *elf;
 	int nr = 0, symidx, fd, err = 0;
-	char name[PATH_MAX];
 
-	snprintf(name, sizeof(name), "%s%s",
-		 symbol_conf.symfs, dso->long_name);
 	fd = open(name, O_RDONLY);
 	if (fd < 0)
 		goto out;
@@ -1703,8 +1701,9 @@ restart:
 			continue;
 
 		if (ret > 0) {
-			int nr_plt = dso__synthesize_plt_symbols(dso, map,
-								 filter);
+			int nr_plt;
+
+			nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter);
 			if (nr_plt > 0)
 				ret += nr_plt;
 			break;
-- 
1.7.9.2.358.g22243


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

* Re: [GIT PULL 0/4] perf/urgent fixes
  2012-04-20 16:53 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2012-04-20 16:53 ` [PATCH 4/4] perf symbols: Read plt symbols from proper symtab_type binary Arnaldo Carvalho de Melo
@ 2012-04-25  7:08 ` Ingo Molnar
  4 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2012-04-25  7:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Avi Kivity, Corey Ashford, David Ahern,
	Frederic Weisbecker, Gleb Natapov, Jiri Olsa, Namhyung Kim,
	Otavio Salvador, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian, arnaldo.melo, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> Regards,
> 
> - Arnaldo
> 
> The following changes since commit 7ea6411f4ceb62e5e53170d59d10996dca20c599:
> 
>   Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2012-04-15 08:02:36 +0200)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux perf/urgent
> 
> for you to fetch changes up to 33ff581eddf744ea91a50d46c2f0961b375a9595:
> 
>   perf symbols: Read plt symbols from proper symtab_type binary (2012-04-20 13:34:49 -0300)
> 
> ----------------------------------------------------------------
> Fixes for perf/urgent
> 
> . Read PLT symbols from the same DSO as the main symtab, fix from Jiri Olsa.
> 
> . Add back the 'g' and 'h' event modifiers, they were dropped during the
>   conversion to use bison. Fix from Gleb Natapov
> 
> . Drop CROSS_COMPILE from flex and bison calls, not really needed. From
>   Otavio Salvador
> 
> . A kernel map variable can be NULL, but was being used despite the earlier
>   check. Fix from David Ahern
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> David Ahern (1):
>       perf report: Fix crash showing warning related to kernel maps
> 
> Gleb Natapov (1):
>       perf tools: Add 'G' and 'H' modifiers to event parsing
> 
> Jiri Olsa (1):
>       perf symbols: Read plt symbols from proper symtab_type binary
> 
> Otavio Salvador (1):
>       perf tools: Drop CROSS_COMPILE from flex and bison calls
> 
>  tools/perf/Makefile            |    4 ++--
>  tools/perf/builtin-report.c    |   17 ++++++++++++-----
>  tools/perf/builtin-test.c      |   30 ++++++++++++++++++++++++++++++
>  tools/perf/util/parse-events.l |    2 +-
>  tools/perf/util/symbol.c       |   13 ++++++-------
>  5 files changed, 51 insertions(+), 15 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

end of thread, other threads:[~2012-04-25  7:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-20 16:53 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
2012-04-20 16:53 ` [PATCH 1/4] perf report: Fix crash showing warning related to kernel maps Arnaldo Carvalho de Melo
2012-04-20 16:53 ` [PATCH 2/4] perf tools: Drop CROSS_COMPILE from flex and bison calls Arnaldo Carvalho de Melo
2012-04-20 16:53 ` [PATCH 3/4] perf tools: Add 'G' and 'H' modifiers to event parsing Arnaldo Carvalho de Melo
2012-04-20 16:53 ` [PATCH 4/4] perf symbols: Read plt symbols from proper symtab_type binary Arnaldo Carvalho de Melo
2012-04-25  7:08 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar

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).