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

Ian Rogers irogers at google.com
Fri May 15 09:30:08 PDT 2026


On Fri, May 15, 2026 at 4:27 AM Arnaldo Carvalho de Melo
<acme at kernel.org> wrote:
>
> 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,

Acked-by: Ian Rogers <irogers at google.com>

I think Sashiko is heavily biased toward warning about too much
printing due to how the kernel handles printk, log spam, etc. For perf
we have a problem that there's lots of verbose logging and logging
something just once may lose the warning. This is somewhat the
opposite problem to the kernel's. Do I care about the change that
much? Not really. If someone is having a bad time, perhaps it makes it
a little harder for them to know why but the priority is to not make
people have a bad time.

Thanks,
Ian

> - 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;
>  }
>



More information about the linux-riscv mailing list