mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-08 11:34:11 +08:00
fa7095c5c3
Commit Fixes:b9f6fbb3b2
("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:b9f6fbb3b2
("perf arm64: Inject missing frames when using 'perf record --call-graph=fp'") Reported-by: John Garry <john.garry@huawei.com> Signed-off-by: James Clark <james.clark@arm.com> Tested-by: John Garry <john.garry@huawei.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Truong <alexandre.truong@arm.com> Cc: German Gomez <german.gomez@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20220406145651.1392529-1-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
91 lines
2.5 KiB
C
91 lines
2.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __UNWIND_H
|
|
#define __UNWIND_H
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/types.h>
|
|
#include "util/map_symbol.h"
|
|
|
|
struct maps;
|
|
struct perf_sample;
|
|
struct thread;
|
|
|
|
struct unwind_entry {
|
|
struct map_symbol ms;
|
|
u64 ip;
|
|
};
|
|
|
|
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
|
|
|
|
struct unwind_libunwind_ops {
|
|
int (*prepare_access)(struct maps *maps);
|
|
void (*flush_access)(struct maps *maps);
|
|
void (*finish_access)(struct maps *maps);
|
|
int (*get_entries)(unwind_entry_cb_t cb, void *arg,
|
|
struct thread *thread,
|
|
struct perf_sample *data, int max_stack, bool best_effort);
|
|
};
|
|
|
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
|
/*
|
|
* When best_effort is set, don't report errors and fail silently. This could
|
|
* be expanded in the future to be more permissive about things other than
|
|
* error messages.
|
|
*/
|
|
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
|
|
struct thread *thread,
|
|
struct perf_sample *data, int max_stack,
|
|
bool best_effort);
|
|
/* libunwind specific */
|
|
#ifdef HAVE_LIBUNWIND_SUPPORT
|
|
#ifndef LIBUNWIND__ARCH_REG_ID
|
|
#define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
|
|
#endif
|
|
|
|
#ifndef LIBUNWIND__ARCH_REG_SP
|
|
#define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
|
|
#endif
|
|
|
|
#ifndef LIBUNWIND__ARCH_REG_IP
|
|
#define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
|
|
#endif
|
|
|
|
int LIBUNWIND__ARCH_REG_ID(int regnum);
|
|
int unwind__prepare_access(struct maps *maps, struct map *map, bool *initialized);
|
|
void unwind__flush_access(struct maps *maps);
|
|
void unwind__finish_access(struct maps *maps);
|
|
#else
|
|
static inline int unwind__prepare_access(struct maps *maps __maybe_unused,
|
|
struct map *map __maybe_unused,
|
|
bool *initialized __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void unwind__flush_access(struct maps *maps __maybe_unused) {}
|
|
static inline void unwind__finish_access(struct maps *maps __maybe_unused) {}
|
|
#endif
|
|
#else
|
|
static inline int
|
|
unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
|
|
void *arg __maybe_unused,
|
|
struct thread *thread __maybe_unused,
|
|
struct perf_sample *data __maybe_unused,
|
|
int max_stack __maybe_unused,
|
|
bool best_effort __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int unwind__prepare_access(struct maps *maps __maybe_unused,
|
|
struct map *map __maybe_unused,
|
|
bool *initialized __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void unwind__flush_access(struct maps *maps __maybe_unused) {}
|
|
static inline void unwind__finish_access(struct maps *maps __maybe_unused) {}
|
|
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
|
|
#endif /* __UNWIND_H */
|