mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH 1/3] perf tools: Allow vmlinux to fallback to kallsyms on NO_LIBELF=1
Date: Mon, 17 Nov 2014 10:55:22 +0900	[thread overview]
Message-ID: <871tp2vbed.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20141111130229.GS18464@kernel.org> (Arnaldo Carvalho de Melo's message of "Tue, 11 Nov 2014 10:02:29 -0300")

Hi Arnaldo,

Sorry for late reply.  I was offline last week.


On Tue, 11 Nov 2014 10:02:29 -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 11, 2014 at 01:24:38PM +0900, Namhyung Kim escreveu:
>> Hi Peter,
>> 
>> On Mon, Nov 10, 2014 at 9:11 PM, Peter Zijlstra <peterz@infradead.org> wrote:
>> > On Mon, Nov 10, 2014 at 03:33:11PM +0900, Namhyung Kim wrote:
>> >> Hmm.. I don't think it's specific to the minimal elf parser.  The return
>> >> value of dso__load_sym() is a number of symbols found so when it sees a
>> >> dso with 0 symbols it'll fall back to the next option IMHO (not
>> >> tested).  Did you see a problem with the current code?
>> >
>> > So your patch:
>> >
>> > +++ b/tools/perf/util/symbol-minimal.c
>> > @@ -335,6 +335,9 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
>> >         unsigned char *build_id[BUILD_ID_SIZE];
>> >         int ret;
>> >
>> > +       if (dso->kernel)
>> > +               return 0;  /* always use kallsyms */
>> > +
>> >
>> > changes the symbol-minimal.c file to add this exception. That is very
>> > much specific to the minimal elf parser, or am I just seeing things?
>> 
>> What minimal parser does here is just skip kernel dsos (vmlinux) since
>> it didn't deal with all the details of parsing vmlinux currently.
>> 
>> 
>> >
>> > What I was saying, why not have a util/symbol.c change that disregards
>> > all DSOs with 0 symbols in.
>> 
>> The util/symbol.c doesn't need this because it can handle vmlinux
>> reliably.  So after reading symbol table, it'll use the dso if it
>
> symbol.c should not be able to handle anything, since the actual ELF
> loader is in symbol-elf.c or simbol-minimal.c, no?

Ah right, I was confused with symbol.c and symbol-elf.c - so I believe
the generic logic in symbol.c already handles DSOs with 0 symbol.  The
problem was symbol-minimal.c didn't return 0 for the DSOs.


>
> I.e.:
>
> 	symbol.c::dso__load()
> 		symbol.c::dso__load_kernel_sym()
> 			symbol.c::dso__load_vmlinux()
>
> And then it heads into one of the ELF loaders, right now, without your
> patch, I see, when the minimal loader is used:
>
> 		symbol-minimal.c::dso__load_sym()
>
> reads the build-id and if it works, returns 1, which is a bug, it should
> return 0 in this case, possibly -1 if it doesn't read the build-id :-\
>
> I.e. it should return 0, because that way it signals: "I can't read it,
> thus no symbols were loaded, symbol.c: please go on looking for them
> somewhere else, kallsyms perhaps?".

Right.  It's a bug for vmlinux.  But by returning 0, it'll iterate over
the candidate binaries in dso__load().  I'm afraid that this *might*
overwrite the build-id of the DSO with different one.  So I think it
also needs to add a check for valid build-id.

I'll update this patch with above.

Thanks,
Namhyung


>
> And this is the bug, probably. Now to look at your patches to see if
> this is touched somehow...
>
>> actually contains symbols or fallback to next dso if it has 0 symbols.
>> IOW it already disregards all dsos with 0 symbols in.
>
> See above.
>  
>> -- 
>> Thanks,
>> Namhyung

  reply	other threads:[~2014-11-17  1:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07  5:20 Namhyung Kim
2014-11-07  5:20 ` [PATCH 2/3] perf symbol: Implement a very simple ELF symbol parser Namhyung Kim
2014-11-07 15:26   ` Arnaldo Carvalho de Melo
2014-11-10  6:36     ` Namhyung Kim
2014-11-10 12:09       ` Arnaldo Carvalho de Melo
2014-11-17  2:31         ` Namhyung Kim
2014-11-07  5:20 ` [PATCH 3/3] perf tools: Clean up libelf feature support code Namhyung Kim
2014-11-20  7:36   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-11-07  8:27 ` [PATCH 1/3] perf tools: Allow vmlinux to fallback to kallsyms on NO_LIBELF=1 Peter Zijlstra
2014-11-07 14:57   ` Namhyung Kim
2014-11-07 17:37     ` Peter Zijlstra
2014-11-10  6:33       ` Namhyung Kim
2014-11-10 12:11         ` Peter Zijlstra
2014-11-11  4:24           ` Namhyung Kim
2014-11-11 10:27             ` Peter Zijlstra
2014-11-11 13:03               ` Arnaldo Carvalho de Melo
2014-11-11 14:02                 ` Arnaldo Carvalho de Melo
2014-11-11 17:19                   ` Peter Zijlstra
2014-11-20  7:37                 ` [tip:perf/core] perf symbols: Fallback to kallsyms when using the minimal 'ELF' loader tip-bot for Arnaldo Carvalho de Melo
2014-11-11 13:02             ` [PATCH 1/3] perf tools: Allow vmlinux to fallback to kallsyms on NO_LIBELF=1 Arnaldo Carvalho de Melo
2014-11-17  1:55               ` Namhyung Kim [this message]
2014-11-07 15:21 ` David Ahern
2014-11-10  7:40   ` Namhyung Kim
2014-11-10 14:20     ` David Ahern
2014-11-07 15:29 ` Arnaldo Carvalho de Melo
2014-11-10  6:53   ` Namhyung Kim
2014-11-10 12:11     ` Arnaldo Carvalho de Melo
2014-11-17  2:04       ` 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=871tp2vbed.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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

Powered by JetHome