All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Ford <aford173@gmail.com>
To: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Artem Lapkin <email2tema@gmail.com>,
	 Joe Hershberger <joe.hershberger@ni.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	 Peter Hoyes <Peter.Hoyes@arm.com>
Subject: Re: [PATCH v3 07/18] pxe: Move pxe_utils files
Date: Fri, 11 Feb 2022 09:50:32 -0600	[thread overview]
Message-ID: <CAHCN7x+xiEw223GZaFh21+fTvogNMvmsk0Je5uVZuO8uC1ukqA@mail.gmail.com> (raw)
In-Reply-To: <20220210145750.GH2697206@bill-the-cat>

On Thu, Feb 10, 2022 at 8:57 AM Tom Rini <trini@konsulko.com> wrote:
>
> On Thu, Feb 10, 2022 at 07:56:52AM -0600, Adam Ford wrote:
> > On Wed, Feb 9, 2022 at 11:16 AM Simon Glass <sjg@chromium.org> wrote:
> > >
> > > Hi,
> > >
> > > On Wed, 9 Feb 2022 at 05:32, Tom Rini <trini@konsulko.com> wrote:
> > > >
> > > > On Wed, Feb 09, 2022 at 05:40:03AM -0600, Adam Ford wrote:
> > > > > On Thu, Oct 14, 2021 at 1:50 PM Simon Glass <sjg@chromium.org> wrote:
> > > > > >
> > > > > > Move the header file into the main include/ directory so we can use it
> > > > > > from the bootmethod code. Move the C file into boot/ since it relates to
> > > > > > booting.
> > > > > >
> > > > > +cc lokeshvutla@ti.com
> > > > >
> > > > > Simon,
> > > > >
> > > > > I can't explain why, but with git bisect, it appears this patch breaks
> > > > > my omap3_logic board (DM3730) by making it wrongly think there is 4GB
> > > > > of RAM, when in reality there is only 256MB.  We have both 256MB and
> > > > > 512MB parts, and the automatic memory detection has always 'just
> > > > > worked' in the past.
> > > > >
> > > > > With this patch now, I see:
> > > > > U-Boot 2022.01-rc1-00185-g262cfb5b15 (Feb 09 2022 - 05:23:42 -0600)
> > > > >
> > > > > OMAP3630/3730-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 1 GHz
> > > > > Model: LogicPD Zoom DM3730 Torpedo + Wireless Development Kit
> > > > > DRAM:  4 GiB
> > > > > <hang>
> > > > >
> > > > > With the previous commit, 8018b9af57b5 ("pxe: Tidy up the is_pxe
> > > > > global"), it properly detects the RAM and fully boots.
> > > > >
> > > > > U-Boot 2022.01-rc1-00184-g8018b9af57 (Feb 09 2022 - 05:21:39 -0600)
> > > > >
> > > > > OMAP3630/3730-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 1 GHz
> > > > > Model: LogicPD Zoom DM3730 Torpedo + Wireless Development Kit
> > > > > DRAM:  256 MiB
> > > > > NAND:  512 MiB
> > > > > MMC:   OMAP SD/MMC: 0
> > > > > Loading Environment from NAND... OK
> > > > > OMAP die ID: 619e00029ff800000168300f1502501f
> > > > > Net:   eth0: ethernet@08000000
> > > > > Hit any key to stop autoboot:  0
> > > > > OMAP Logic #
> > > > >
> > > > > I have CONFIG_CMD_BOOTM,  CONFIG_CMD_PXE and CONFIG_CMD_SYSBOOT all
> > > > > defined, so I am having a hard time understanding why this would
> > > > > change behavior or stomp on the the structure that knows the memory
> > > > > size.
> > > > >
> > > > > If I jump ahead to the current 'master' 531c0089457:("Merge branch
> > > > > '2022-02-08-TI-platform-updates')  and revert this patch, my board
> > > > > boots correctly again, but I am struggling to understand why.
> > + Marek Behún
> >
> > > > >
> > > > > Do you have any suggestions for me to try?
> > > >
> > > > I would suggest objdump disassemble U-Boot before/after and see what
> > > > functions have changed.
> > >
> > > Keep an eye out for a BSS variable that is used before relocation, perhaps?
> >
> > I am still investigating, but disabling LTO appears to fix the issue
> > for me.  I'd like to keep LTO, so I'm going to attempt to focus on the
> > differences in the affected functions and how this patch makes LTO
> > behave differently.
> >
> > The disassembly of U-Boot is large, so it's going to take me a bit of
> > time to investigate.  If someone has any LTO-related suggestions that
> > I could try, I'd be open to try them too.
>
> Wait, the disassembly is large, or the differences between the
> disassembly, before/after this change alone, are large?  It's feeling

I will be the first to admit thatI am not very good with the assembly
side of things, but this is what I did:

git checkout master
make CROSS_COMPILE=arm-linux-gnueabihf- -j8
arm-linux-gnueabihf-objdump -S u-boot > broken.dump
git revert 262cfb5b15420a1aea465745a821e684b3dfa153
make CROSS_COMPILE=arm-linux-gnueabihf- -j8
arm-linux-gnueabihf-objdump -S u-boot > working.dump

diff --side-by-side --suppress-common-lines broken.dump working.dump
> broken-working.diff
cat -n broken-working.diff

The broken-working.diff file with common lines suppressed is 236256 lines long.

When I disable LTO for just pxe_utils.o and redo the same exercise,
the diff file with common-lines removed is 266573 lines long.

Maybe I am not using objdump correctly.  I am not all that familiar
with this code either, so I am not sure which variables should be in
BSS.  I did a search in both working and non-working dumps to look for
keyworks like BSS, but from what I can tell,  both have similar
functions:

gd->mon_len = (ulong)&__bss_end - (ulong)_start;
/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
* reserve memory for U-Boot code, data & bss
8011051a <clear_bss>:
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_EARLY_BSS)
CLEAR_BSS
#if !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_EARLY_BSS)
CLEAR_BSS
CLEAR_BSS

When I grepped for mon_len, both sets of dumps looked nearly identical:

aford@aford-OptiPlex-7050:~/src/u-boot$ grep mon_len working.dump
lmb_reserve(lmb, (phys_addr_t)(uintptr_t)_start, gd->mon_len);
80112724 <setup_mon_len>:
static int setup_mon_len(void)
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
80112726: 4903      ldr r1, [pc, #12] ; (80112734 <setup_mon_len+0x10>)
80112728: 4b03      ldr r3, [pc, #12] ; (80112738 <setup_mon_len+0x14>)
gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
gd->ram_top = board_get_usable_ram_top(gd->mon_len);
gd->relocaddr -= gd->mon_len;
      gd->mon_len >> 10, gd->relocaddr);
    ip = mon_lengths[yleap];


aford@aford-OptiPlex-7050:~/src/u-boot$ grep mon_len broken.dump
lmb_reserve(lmb, (phys_addr_t)(uintptr_t)_start, gd->mon_len);
80110398 <setup_mon_len>:
static int setup_mon_len(void)
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
8011039a: 4903      ldr r1, [pc, #12] ; (801103a8 <setup_mon_len+0x10>)
8011039c: 4b03      ldr r3, [pc, #12] ; (801103ac <setup_mon_len+0x14>)
gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
gd->ram_top = board_get_usable_ram_top(gd->mon_len);
gd->relocaddr -= gd->mon_len;
      gd->mon_len >> 10, gd->relocaddr);
    ip = mon_lengths[yleap];
aford@aford-OptiPlex-7050:~/src/u-boot$

Since I think I narrowed it down to the pxe_utils.o file, I thought
I'd do an objdump of both the working and non-working versions of
pxe_utils.o and this is where it got interesting.

With LTO building pxe_utils.o, the dump looks empty:

arm-linux-gnueabihf-objdump -S boot/pxe_utils.o > pxe-notworking.dump
cat pxe-notworking.dump

boot/pxe_utils.o:     file format elf32-littlearm

^--  no actual code dump
If I take the working version of this same file without LTO enabled
and do a dump, and it's 2291 lines long and full of functions.

I tried adding some __used to the non-static function names, but that
didn't appear to make any difference to the objdump of pxe_utils.o

adam








> like just how we remove the LTO flags from
> arch/arm/mach-omap2/omap3/board.o something else might also need that,
> OR digging more to find out issue LTO is exposing in terms of variables
> being in the data and not BSS section and needing initialization or
> similar.
>
> --
> Tom

  reply	other threads:[~2022-02-11 15:50 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 18:47 [PATCH v3 00/18] pxe: Refactoring to tidy up and prepare for bootflow Simon Glass
2021-10-14 18:47 ` [PATCH v3 01/18] Create a new boot/ directory Simon Glass
2021-10-16  5:31   ` Art Nikpal
2021-10-18  8:41   ` art
2021-11-12 15:38   ` Tom Rini
2021-10-14 18:47 ` [PATCH v3 02/18] pxe: Move API comments to the header files Simon Glass
2021-10-18  8:42   ` art
2021-11-09  8:07   ` Ramon Fried
2021-11-09  8:52   ` Heinrich Schuchardt
2021-11-12 15:38   ` Tom Rini
2021-10-14 18:47 ` [PATCH v3 03/18] pxe: Use a context pointer Simon Glass
2021-10-18  8:45   ` art
2021-11-09  8:08   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:47 ` [PATCH v3 04/18] pxe: Move do_getfile() into the context Simon Glass
2021-10-18  8:46   ` art
2021-11-09  8:11   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:47 ` [PATCH v3 05/18] pxe: Add a userdata field to " Simon Glass
2021-10-18  8:46   ` art
2021-11-09  8:10   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:47 ` [PATCH v3 06/18] pxe: Tidy up the is_pxe global Simon Glass
2021-10-18  8:47   ` art
2021-11-09  8:10   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 07/18] pxe: Move pxe_utils files Simon Glass
2021-10-18  8:47   ` art
2021-11-09  8:10   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2022-02-09 11:40   ` Adam Ford
2022-02-09 12:32     ` Tom Rini
2022-02-09 17:16       ` Simon Glass
2022-02-10 13:56         ` Adam Ford
2022-02-10 13:57           ` Adam Ford
2022-02-10 14:32             ` Simon Glass
2022-02-10 14:41               ` Adam Ford
2022-02-10 14:57           ` Tom Rini
2022-02-11 15:50             ` Adam Ford [this message]
2022-02-11 16:12               ` Tom Rini
2022-02-11 16:39                 ` Adam Ford
2022-02-11 16:44                   ` Tom Rini
2022-02-11 17:10                     ` Adam Ford
2022-02-11 17:13                       ` Tom Rini
2022-02-12  1:09                         ` Adam Ford
2022-02-12  1:43                           ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 08/18] pxe: Tidy up some comments in pxe_utils Simon Glass
2021-10-18  8:48   ` art
2021-11-09  8:10   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 09/18] pxe: Tidy up code style a little " Simon Glass
2021-10-18  8:48   ` art
2021-11-09  8:10   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 10/18] pxe: Move common parsing coding into pxe_util Simon Glass
2021-10-18  8:49   ` art
2021-11-09  8:09   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 11/18] pxe: Clean up the use of bootfile Simon Glass
2021-10-18  8:51   ` art
2021-11-09  8:09   ` Ramon Fried
2021-11-12 15:39   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 12/18] pxe: Drop get_bootfile_path() Simon Glass
2021-10-18  8:51   ` art
2021-11-09  8:09   ` Ramon Fried
2021-11-12 15:40   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 13/18] lib: Add tests for simple_itoa() Simon Glass
2021-10-18  8:30   ` art
2021-11-12 15:40   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 14/18] lib: Add a function to convert a string to a hex value Simon Glass
2021-10-18  8:52   ` art
2021-11-12 15:40   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 15/18] pxe: Return the file size from the getfile() function Simon Glass
2021-10-18  8:53   ` art
2021-11-09  8:09   ` Ramon Fried
2021-11-12 15:40   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 16/18] pxe: Refactor sysboot to have one helper Simon Glass
2021-10-18  8:54   ` art
2021-11-09  8:09   ` Ramon Fried
2021-11-12 15:40   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 17/18] doc: Move distro boot doc to rST Simon Glass
2021-10-18  8:55   ` art
2021-11-09  8:08   ` Ramon Fried
2021-11-12 15:40   ` Tom Rini
2021-10-14 18:48 ` [PATCH v3 18/18] pxe: Allow calling the pxe_get logic directly Simon Glass
2021-10-18  8:56   ` art
2021-11-09  8:07   ` Ramon Fried
2021-11-12 15:40   ` Tom Rini
2021-10-15 10:27 ` [PATCH v3 00/18] pxe: Refactoring to tidy up and prepare for bootflow Art Nikpal
2021-10-26  1:28 ` Simon Glass

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=CAHCN7x+xiEw223GZaFh21+fTvogNMvmsk0Je5uVZuO8uC1ukqA@mail.gmail.com \
    --to=aford173@gmail.com \
    --cc=Peter.Hoyes@arm.com \
    --cc=email2tema@gmail.com \
    --cc=joe.hershberger@ni.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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.