All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlos Llamas <cmllamas@google.com>
To: Will Deacon <will@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	linux-kernel@vger.kernel.org, kernel-team@android.com,
	Brian Johannesmeyer <bjohannesmeyer@gmail.com>,
	John Stultz <jstultz@google.com>
Subject: Re: [PATCH] Revert "scripts/faddr2line: Check only two symbols when calculating symbol size"
Date: Thu, 17 Oct 2024 00:12:16 +0000	[thread overview]
Message-ID: <ZxBWYJpAnYVrjHx3@google.com> (raw)
In-Reply-To: <20240816125046.GA24389@willie-the-truck>

On Fri, Aug 16, 2024 at 01:50:46PM +0100, Will Deacon wrote:
> On Mon, Aug 12, 2024 at 11:01:20PM +0000, Carlos Llamas wrote:
> > This reverts commit c02904f05ff805d6c0631634d5751ebd338f75ec.
> > 
> > Such commit assumed that only two symbols are relevant for the symbol
> > size calculation. However, this can lead to an incorrect symbol size
> > calculation when there are mapping symbols emitted by readelf.
> > 
> > For instance, when feeding 'update_irq_load_avg+0x1c/0x1c4', faddr2line
> > might need to processes the following readelf lines:
> > 
> >  784284: ffffffc0081cca30   428 FUNC    GLOBAL DEFAULT     2 update_irq_load_avg
> >   87319: ffffffc0081ccb0c     0 NOTYPE  LOCAL  DEFAULT     2 $x.62522
> >   87321: ffffffc0081ccbdc     0 NOTYPE  LOCAL  DEFAULT     2 $x.62524
> >   87323: ffffffc0081ccbe0     0 NOTYPE  LOCAL  DEFAULT     2 $x.62526
> >   87325: ffffffc0081ccbe4     0 NOTYPE  LOCAL  DEFAULT     2 $x.62528
> >   87327: ffffffc0081ccbe8     0 NOTYPE  LOCAL  DEFAULT     2 $x.62530
> >   87329: ffffffc0081ccbec     0 NOTYPE  LOCAL  DEFAULT     2 $x.62532
> >   87331: ffffffc0081ccbf0     0 NOTYPE  LOCAL  DEFAULT     2 $x.62534
> >   87332: ffffffc0081ccbf4     0 NOTYPE  LOCAL  DEFAULT     2 $x.62535
> >  783403: ffffffc0081ccbf4   424 FUNC    GLOBAL DEFAULT     2 sched_pelt_multiplier
> > 
> > The symbol size of 'update_irq_load_avg' should be calculated with the
> > address of 'sched_pelt_multiplier', after skipping the mapping symbols
> > seen in between. However, the offending commit cuts the list short and
> > faddr2line incorrectly assumes 'update_irq_load_avg' is the last symbol
> > in the section, resulting in:
> > 
> >   $ scripts/faddr2line vmlinux update_irq_load_avg+0x1c/0x1c4
> >   skipping update_irq_load_avg address at 0xffffffc0081cca4c due to size mismatch (0x1c4 != 0x3ff9a59988)
> >   no match for update_irq_load_avg+0x1c/0x1c4
> > 
> > After reverting the commit the issue is resolved:
> > 
> >   $ scripts/faddr2line vmlinux update_irq_load_avg+0x1c/0x1c4
> >   update_irq_load_avg+0x1c/0x1c4:
> >   cpu_of at kernel/sched/sched.h:1109
> >   (inlined by) update_irq_load_avg at kernel/sched/pelt.c:481
> > 
> > Cc: Brian Johannesmeyer <bjohannesmeyer@gmail.com>
> > Cc: John Stultz <jstultz@google.com>
> > Cc: Will Deacon <will@kernel.org>
> > Signed-off-by: Carlos Llamas <cmllamas@google.com>
> > ---
> >  scripts/faddr2line | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Acked-by: Will Deacon <will@kernel.org>
> 
> I'm assuming that Josh will pick this up.

I don't think this was picked up yet, at least I don't see it in tip. Or
maybe I looked in the wrong place?

Cheers,
Carlos Llamas

  parent reply	other threads:[~2024-10-17  0:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 23:01 [PATCH] Revert "scripts/faddr2line: Check only two symbols when calculating symbol size" Carlos Llamas
2024-08-16 12:50 ` Will Deacon
2024-08-20 16:38   ` Brian Johannesmeyer
2024-08-20 18:51     ` Carlos Llamas
2024-10-17  0:12   ` Carlos Llamas [this message]
2024-10-17 22:27     ` Josh Poimboeuf

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=ZxBWYJpAnYVrjHx3@google.com \
    --to=cmllamas@google.com \
    --cc=bjohannesmeyer@gmail.com \
    --cc=jpoimboe@kernel.org \
    --cc=jstultz@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.