Re: [PATCH v5 1/7] perf unwind: Refactor get_entries to allow dynamic libdw/libunwind selection

From: Arnaldo Carvalho de Melo

Date: Fri May 15 2026 - 07:57:33 EST


On Thu, May 14, 2026 at 09:12:40PM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, May 13, 2026 at 04:31:45PM -0700, Ian Rogers wrote:

<SNIP>

> > +++ b/tools/perf/util/unwind.h

<SNIP>

> > +static inline int libdw__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)
> > +{
> > + pr_err("Error: libdw dwarf unwinding not built into perf\n");
> > + return 0;
> > +}
> > +#endif

I also addressed this local sashiko review comment:

-------------------------------------------------------------------------
Since unwinding is performed per-sample in the hot path, will using pr_err()
here cause console flooding if the user explicitly configures an unsupported
unwind style?
Should this use pr_warning_once() instead, similar to the UNWIND_STYLE_UNKNOWN
fallback behavior in unwind.c?
-------------------------------------------------------------------------

And in one other place, please ack,

- Arnaldo

diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index 28db3e3b9b513401..69ba08afda792d17 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -53,7 +53,7 @@ static inline int libdw__get_entries(unwind_entry_cb_t cb __maybe_unused, void *
int max_stack __maybe_unused,
bool best_effort __maybe_unused)
{
- pr_err("Error: libdw dwarf unwinding not built into perf\n");
+ pr_warning_once("Error: libdw dwarf unwinding not built into perf\n");
return 0;
}
#endif
@@ -81,7 +81,7 @@ static inline int libunwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
int max_stack __maybe_unused,
bool best_effort __maybe_unused)
{
- pr_err("Error: libunwind dwarf unwinding not built into perf\n");
+ pr_warning_once("Error: libunwind dwarf unwinding not built into perf\n");
return 0;
}