perf/urgent fixes
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)
----------------------------------------------------------------
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(-)
PATCH 1/3 perf kvm: Fix of 'Min time' counting in report command
From: Alexander Yarygin <[email protected]>
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% )[..]
--- tools/perf/builtin-kvm.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-kvm.c +1 -0
@@ -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; }
Signature · 1 line
1.8.3.1
PATCH 2/3 perf tools: Adjust symbols in VDSO
In reply to Jiri OlsaFrom: Vladimir Nikulichev <[email protected]>
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()--- tools/perf/util/symbol-elf.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/symbol-elf.c +2 -0
@@ -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 );
Signature · 1 line
1.8.3.1
PATCH 3/3 perf tools: Error reporting improvement
In reply to Jiri OlsaFrom: Adrien BAK <[email protected]>
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.
--- tools/perf/builtin-record.c | 2 +- tools/perf/util/data.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +1 -1
@@ -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 ; }
tools/perf/util/data.c +8 -1
@@ -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)
Signature · 1 line
1.8.3.1