linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: linux-perf-users <linux-perf-users@vger.kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: Can perf drop libunwind support
Date: Mon, 28 Oct 2024 13:03:03 -0300	[thread overview]
Message-ID: <Zx-1tx0eH19iBpjy@x1> (raw)
In-Reply-To: <CAP-5=fUXkp-d7gkzX4eF+nbjb2978dZsiHZ9abGHN=BN1qAcbg@mail.gmail.com>

On Wed, Oct 23, 2024 at 02:57:05PM -0700, Ian Rogers wrote:
> Hi,
> 
> perf wants to build with BPF support these days. libbpf has a
> dependency on libelf, part of elfutils. libdw is also part of elfutils
> and amongst other things provides unwinding support. My understanding
> is libdw unwinding is used by perf in preference to libunwind when
> present. My suspicion is that libunwind is being feature tested,
> linked against but then seldom or never used. Given this could perf
> drop libunwind support in order to simplify the code base?

Probably Jiri remembers the reasons for us to have support for both,
IIRC libunwind was a bit more mature at the time and so we decided to
have both and when some broken behaviour appears we try the other one,
in the process trying to fix the one wioth a problem?

Adding Frederic as well, this is when we started to use libunwind:

commit 6a40cd90f5deb6dec322eeb54587ae55a934db2c
Author: Jiri Olsa <jolsa@redhat.com>
Date:   Tue Aug 7 15:20:44 2012 +0200

    perf tools: Add libunwind dependency for DWARF CFI unwinding
    
    Adding libunwind to be linked with perf if available. It's required
    for the to get dwarf cfi unwinding support.
    
    Also building perf with the dwarf call frame informations by default,
    so that we can unwind callchains in perf itself.
    
    Adding LIBUNWIND_DIR Makefile variable allowing user to specify
    the directory with libunwind to be linked. This is used for
    debug purposes.
    
    Signed-off-by: Jiri Olsa <jolsa@redhat.com>
    Original-patch-by: Frederic Weisbecker <fweisbec@gmail.com>


There is a long discussion on tests, etc on the cover letter for that
series:

https://lore.kernel.org/all/1344345647-11536-11-git-send-email-jolsa@redhat.com/T/#m0121f16278e049a2fe510c4c37884832e3c1f41d


And then later Jiri added support for libdw's unwinder:

commit 5ea8415407a76c4a85ac971ec82d110161cd77f1
Author: Jiri Olsa <jolsa@redhat.com>
Date:   Wed Feb 19 16:52:57 2014 +0100

    perf tools: Add libdw DWARF post unwind support
    
    Adding libdw DWARF post unwind support, which is part of
    elfutils-devel/libdw-dev package from version 0.158.
    
    The new code is contained in unwin-libdw.c object, and implements
    unwind__get_entries unwind interface function.
    
    New Makefile variable NO_LIBDW_DWARF_UNWIND was added to control its
    compilation, and is marked as disabled now.  It's factored with the rest
    of the Makefile unwind build code in the next patch.
    
    Arch specific code was added for x86.
    
    Signed-off-by: Jiri Olsa <jolsa@redhat.com>
    Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jean Pihet <jean.pihet@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1392825179-5228-5-git-send-email-jolsa@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

But I couldn't find a discussion about why we decided to keep both, some
more investigation would be interesting to see if there are systems that
are better supported using libunwind than with libdw.

- Arnaldo
 
> Possible savings:
>  - remove libunwind's 8 feature tests
>  - removal of 10 arch or not libunwind C files in perf
>  - removal of libunwind #ifdef-ed code throughout common files.
> 
> Thanks,
> Ian

  parent reply	other threads:[~2024-10-28 16:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 21:57 Can perf drop libunwind support Ian Rogers
2024-10-28  3:13 ` Masami Hiramatsu
2024-10-28 16:03 ` Arnaldo Carvalho de Melo [this message]
2024-10-28 17:01   ` Frederic Weisbecker
2024-10-28 19:10     ` Ian Rogers
2024-10-29 23:50 ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zx-1tx0eH19iBpjy@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=frederic@kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).