All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/3] perf/urgent fixes
@ 2014-04-18 10:20 Jiri Olsa
  2014-04-18 10:20 ` [PATCH 1/3] perf kvm: Fix of 'Min time' counting in report command Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Olsa @ 2014-04-18 10:20 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Adrien BAK, Alexander Yarygin,
	Arnaldo Carvalho de Melo, Christian Borntraeger, Corey Ashford,
	David Ahern, Frederic Weisbecker, Jiri Olsa, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Vladimir Nikulichev, Will Deacon

hi Ingo,
please consider pulling

thanks,
jirka


The following changes since commit 6381c24cd6d5d6373620426ab0a96c80ed953e20:

  kprobes/x86: Fix page-fault handling logic (2014-04-17 10:57:02 +0200)

are available in the git repository at:

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

for you to fetch changes up to 5fef49f71bd0f2f11f55b316ab7473b7f12fd8e0:

  perf tools: Error reporting improvement (2014-04-18 11:40:01 +0200)

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

User visible:

. Adjust symbols in VDSO to properly resolve its function names (Vladimir Nikulichev)

. Improve error reporting for record session failure (Adrien BAK)

. Fix of 'Min time' counting in report command (Alexander Yarygin)

Signed-off-by: Jiri Olsa <jolsa@redhat.com>

----------------------------------------------------------------
Adrien BAK (1):
      perf tools: Error reporting improvement

Alexander Yarygin (1):
      perf kvm: Fix of 'Min time' counting in report command

Vladimir Nikulichev (1):
      perf tools: Adjust symbols in VDSO

 tools/perf/builtin-kvm.c     | 1 +
 tools/perf/builtin-record.c  | 2 +-
 tools/perf/util/data.c       | 9 ++++++++-
 tools/perf/util/symbol-elf.c | 2 ++
 4 files changed, 12 insertions(+), 2 deletions(-)

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

* [PATCH 1/3] perf kvm: Fix of 'Min time' counting in report command
  2014-04-18 10:20 [GIT PULL 0/3] perf/urgent fixes Jiri Olsa
@ 2014-04-18 10:20 ` Jiri Olsa
  2014-04-18 10:20 ` [PATCH 2/3] perf tools: Adjust symbols in VDSO Jiri Olsa
  2014-04-18 10:20 ` [PATCH 3/3] perf tools: Error reporting improvement Jiri Olsa
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2014-04-18 10:20 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Alexander Yarygin, Christian Borntraeger, Jiri Olsa

From: Alexander Yarygin <yarygin@linux.vnet.ibm.com>

Every event in the perf-kvm has a 'stats' structure, which contains
max/min/average/etc times of handling this event.
The problem is that the 'perf-kvm stat report' command always shows
that 'min time' is 0us for every event. Example:

 # perf kvm stat report
Analyze events for all VCPUs:

    VM-EXIT    Samples  Samples%     Time%   Min Time   Max Time
    Avg time
[..]
0xB2 MSCH         12     0.07%     0.00%        0us        8us
    7.31us ( +-   2.11% )
0xB2 CHSC         12     0.07%     0.00%        0us       18us
    9.39us ( +-   9.49% )
0xB2 STPX          8     0.05%     0.00%        0us        2us
    1.88us ( +-   7.18% )
0xB2 STSI          7     0.04%     0.00%        0us       44us
    16.49us ( +-  38.20% )
[..]

This happens because 'stats' structure is not initialized and
stats->min equals to 0. Lets initialize the structure for every
event after it's allocation using init_stats() function. This initialize
stats->min to -1 and makes 'Min time' statistics counting work:

 # perf kvm stat report

Analyze events for all VCPUs:

    VM-EXIT    Samples  Samples%     Time%   Min Time   Max Time
    Avg time
[..]
0xB2 MSCH         12     0.07%     0.00%        6us        8us
    7.31us ( +-   2.11% )
0xB2 CHSC         12     0.07%     0.00%        7us       18us
    9.39us ( +-   9.49% )
0xB2 STPX          8     0.05%     0.00%        1us        2us
    1.88us ( +-   7.18% )
0xB2 STSI          7     0.04%     0.00%        1us       44us
    16.49us ( +-  38.20% )
[..]

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/1397053319-2130-3-git-send-email-borntraeger@de.ibm.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-kvm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 21c164b..0f1e5a2 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -404,6 +404,7 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key)
 	}
 
 	event->key = *key;
+	init_stats(&event->total.stats);
 	return event;
 }
 
-- 
1.8.3.1


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

* [PATCH 2/3] perf tools: Adjust symbols in VDSO
  2014-04-18 10:20 [GIT PULL 0/3] perf/urgent fixes Jiri Olsa
  2014-04-18 10:20 ` [PATCH 1/3] perf kvm: Fix of 'Min time' counting in report command Jiri Olsa
@ 2014-04-18 10:20 ` Jiri Olsa
  2014-04-18 10:20 ` [PATCH 3/3] perf tools: Error reporting improvement Jiri Olsa
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2014-04-18 10:20 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Vladimir Nikulichev, Jiri Olsa

From: Vladimir Nikulichev <nvs@tbricks.com>

pert-report doesn't resolve function names in VDSO:

$ perf report --stdio -g flat,0.0,15,callee --sort pid
...
            8.76%
               0x7fff6b1fe861
               __gettimeofday
               ACE_OS::gettimeofday()
...

In this case symbol values should be adjusted the same way as for executables,
relocatable objects and prelinked libraries.

After fix:

$ perf report --stdio -g flat,0.0,15,callee --sort pid
...
            8.76%
               __vdso_gettimeofday
               __gettimeofday
               ACE_OS::gettimeofday()

Signed-off-by: Vladimir Nikulichev <nvs@tbricks.com>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Link: http://lkml.kernel.org/r/969812.163009436-sendEmail@nvs
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/util/symbol-elf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 3b7dbf5..6864661 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -6,6 +6,7 @@
 #include <inttypes.h>
 
 #include "symbol.h"
+#include "vdso.h"
 #include <symbol/kallsyms.h>
 #include "debug.h"
 
@@ -618,6 +619,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
 		GElf_Shdr shdr;
 		ss->adjust_symbols = (ehdr.e_type == ET_EXEC ||
 				ehdr.e_type == ET_REL ||
+				is_vdso_map(dso->short_name) ||
 				elf_section_by_name(elf, &ehdr, &shdr,
 						     ".gnu.prelink_undo",
 						     NULL) != NULL);
-- 
1.8.3.1


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

* [PATCH 3/3] perf tools: Error reporting improvement
  2014-04-18 10:20 [GIT PULL 0/3] perf/urgent fixes Jiri Olsa
  2014-04-18 10:20 ` [PATCH 1/3] perf kvm: Fix of 'Min time' counting in report command Jiri Olsa
  2014-04-18 10:20 ` [PATCH 2/3] perf tools: Adjust symbols in VDSO Jiri Olsa
@ 2014-04-18 10:20 ` Jiri Olsa
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2014-04-18 10:20 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Adrien BAK, Jiri Olsa

From: Adrien BAK <adrien.bak@metascale.org>

In the current version, when using perf record, if something goes
wrong in tools/perf/builtin-record.c:375
  session = perf_session__new(file, false, NULL);

The error message:
"Not enough memory for reading per file header"

is issued. This error message seems to be outdated and is not very
helpful.  This patch propose to replace this error message by
"Perf session creation failed"

I believe this issue has been brought to lkml:
https://lkml.org/lkml/2014/2/24/458
although this patch only tackle a (small) part of the issue.

Additionnaly, this patch improves error reporting in
tools/perf/util/data.c open_file_write.

Currently, if the call to open fails, the user is unaware of it.
This patch logs the error, before returning the error code to
the caller.

Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Adrien BAK <adrien.bak@metascale.org>
Link: http://lkml.kernel.org/r/1397786443.3093.4.camel@beast
[ Reorganize the changelog into paragraphs ]
[ Added empty line after fd declaration in open_file_write ]
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-record.c | 2 +-
 tools/perf/util/data.c      | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index eb524f9..8ce62ef 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 
 	session = perf_session__new(file, false, NULL);
 	if (session == NULL) {
-		pr_err("Not enough memory for reading perf file header\n");
+		pr_err("Perf session creation failed.\n");
 		return -1;
 	}
 
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 1fbcd8b..55de44e 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -86,10 +86,17 @@ static int open_file_read(struct perf_data_file *file)
 
 static int open_file_write(struct perf_data_file *file)
 {
+	int fd;
+
 	if (check_backup(file))
 		return -1;
 
-	return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+	fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
+
+	if (fd < 0)
+		pr_err("failed to open %s : %s\n", file->path, strerror(errno));
+
+	return fd;
 }
 
 static int open_file(struct perf_data_file *file)
-- 
1.8.3.1


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

end of thread, other threads:[~2014-04-18 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18 10:20 [GIT PULL 0/3] perf/urgent fixes Jiri Olsa
2014-04-18 10:20 ` [PATCH 1/3] perf kvm: Fix of 'Min time' counting in report command Jiri Olsa
2014-04-18 10:20 ` [PATCH 2/3] perf tools: Adjust symbols in VDSO Jiri Olsa
2014-04-18 10:20 ` [PATCH 3/3] perf tools: Error reporting improvement Jiri Olsa

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.