Bugzilla: https://bugzilla.redhat.com/2069073
upstream
========
commit fa7095c5c3240bb2ecbc77f8b69be9b1d9e2cf60
Author: James Clark <james.clark@arm.com>
Date: Wed Apr 6 15:56:51 2022 +0100
description
===========
Commit Fixes: b9f6fbb3b2c29736 ("perf arm64: Inject missing frames when
using 'perf record --call-graph=fp'") intended to add a 'best effort'
DWARF unwind that improved the frame pointer stack in most scenarios.
It's expected that the unwind will fail sometimes, but this shouldn't be
reported as an error. It only works when the return address can be
determined from the contents of the link register alone.
Fix the error shown when the unwinder requires extra registers by adding
a new flag that suppresses error messages. This flag is not set in the
normal --call-graph=dwarf unwind mode so that behavior is not changed.
Fixes: b9f6fbb3b2c29736 ("perf arm64: Inject missing frames when using 'perf record --call-graph=fp'")
Link: https://lore.kernel.org/r/20220406145651.1392529-1-james.clark@arm.com
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2069073
upstream
========
commit 46f57d2410150985f81da7cbbb5fdcda01d02ac2
Author: Ian Rogers <irogers@google.com>
Date: Thu Jan 13 22:48:22 2022 -0800
description
===========
Relative path include works in the regular build due to -I paths but may
fail in other situations.
Fixes: 83869019c74cc2d0 ("perf arch: Support register names from all archs")
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2069073
upstream
========
commit b9f6fbb3b2c29736970ae9fcc0e82b0bd459442b
Author: Alexandre Truong <alexandre.truong@arm.com>
Date: Fri Dec 17 15:45:20 2021 +0000
description
===========
When unwinding using frame pointers on ARM64, the return address of the
current function may not have been pushed into the stack when a function
was interrupted, which makes perf show an incorrect call graph to the
user.
Consider the following example program:
void leaf() {
/* long computation */
}
void parent() {
// (1)
leaf();
// (2)
}
... could be compiled into (using gcc -fno-inline -fno-omit-frame-pointer):
leaf:
/* long computation */
nop
ret
parent:
// (1)
stp x29, x30, [sp, -16]!
mov x29, sp
bl parent
nop
ldp x29, x30, [sp], 16
// (2)
ret
If the program is interrupted at (1), (2), or any point in "leaf:", the
call graph will skip the callers of the current function. We can unwind
using the dwarf info and check if the return addr is the same as the LR
register, and inject the missing frame into the call graph.
Before this patch, the above example shows the following call-graph when
recording using "--call-graph fp" mode in ARM64:
# Children Self Command Shared Object Symbol
# ........ ........ ........ ................ ......................
#
99.86% 99.86% program3 program3 [.] leaf
|
---_start
__libc_start_main
main
leaf
As can be seen, the "parent" function is missing. This is specially
problematic in "leaf" because for leaf functions the compiler may always
omit pushing the return addr into the stack. After this patch, it shows
the correct graph:
# Children Self Command Shared Object Symbol
# ........ ........ ........ ................ ......................
#
99.86% 99.86% program3 program3 [.] leaf
|
---_start
__libc_start_main
main
parent
leaf
[ Rename machine__normalize_is() to machine__normalized_is(), as suggested by James Clark ]
Signed-off-by: Michael Petlan <mpetlan@redhat.com>