linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Steinar H. Gunderson" <sesse@google.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	irogers@google.com, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH v5 1/3] perf report: Support LLVM for addr2line()
Date: Fri, 24 May 2024 10:09:39 +0200	[thread overview]
Message-ID: <ZlBLQ87edfIHiGRt@google.com> (raw)
In-Reply-To: <Zk-MpqzRlAecrWA6@x1>

On Thu, May 23, 2024 at 03:36:22PM -0300, Arnaldo Carvalho de Melo wrote:
> Makefile.config:982: No libllvm found, slower source file resolution, please install llvm-devel/llvm-dev
> 
> ...                                    llvm: [ OFF ]
> 
> But maybe use "libllvm"?

I think I was trying to be consistent with the previous patch using LLVM
(something with Clang and eBPF, I think?), which used llvm and not
libllvm for the name here :-) And I don't think upstream actually uses
the libllvm name much (e.g. as you can see, it's llvm-devel, not
libllvm-devel). But I can change it if you think it's a better name;
I don't mind much either way.

> So mostly the above, and:
> 
> root@x1:~# perf probe -x /usr/bin/find -L find | grep fts_read
>      44        while ( (errno=0, ent=fts_read (p)) != NULL )
>                /* fts_read returned NULL; distinguish between "finished" and "error". */
> root@x1:~#

This part went a bit over my head, I'll just assume it's good. :-)

> So the libllvm is even producing a better result, showing those inlines
> not seen in the BFD based output.

I think maybe you need to give --inlines to BFD objdump to get it to
show inlines. (It can be useful in perf annotate sometimes.)
But annoyingly enough, LLVM objdump does not understand the flag.

> 100x speedup, looks like a win! 8-)

Great, thanks for testing. :-)

> Thanks a lot, the comments I made on the patch are mostly coding style,
> please consider them, but I wouldn't get in the way for this patch to
> get merged because of that albeit would be nice to try to fit in more
> nicely with the existing source code base.

Sure, I'll make a v6 with the requested changes. Just some
questions/comments below.

>> +		*inline_frames = (llvm_a2l_frame*)malloc(
>> +			sizeof(**inline_frames) * num_frames);
> Do we really need to cast here (my C++ is super rusty), and why not
> calloc()?

Yes, C++ does not have implicit cast-from-void*. The C++ way would be
new[] or use std::vector, but, that would make it impossible for the
caller to free(). I can use calloc, it won't change much either way.

> > +			dst.funcname = strdup(src.FunctionName.c_str());
> If strdup fails, users will cope?

Yes, same as dst.filename. new_inline_sym() (which is where we give this
data to) has an explicit check for if (!funcname).

> > +		Expected<DILineInfo> res_or_err =
> > +			symbolizer->symbolizeCode(dso_name, sectioned_addr);
> same line?

That takes it way over 80 characters, is that OK?

/* Steinar */

      reply	other threads:[~2024-05-24  8:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23  9:29 [PATCH v5 1/3] perf report: Support LLVM for addr2line() Steinar H. Gunderson
2024-05-23  9:29 ` [PATCH v5 2/3] perf annotate: split out read_symbol() Steinar H. Gunderson
2024-05-23  9:29 ` [PATCH v5 3/3] perf annotate: LLVM-based disassembler Steinar H. Gunderson
2024-05-23 18:36 ` [PATCH v5 1/3] perf report: Support LLVM for addr2line() Arnaldo Carvalho de Melo
2024-05-24  8:09   ` Steinar H. Gunderson [this message]

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=ZlBLQ87edfIHiGRt@google.com \
    --to=sesse@google.com \
    --cc=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.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).