public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Marek Vasut <marex@denx.de>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	Hai Pham <hai.pham.ud@renesas.com>,
	Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>,
	Stephen Warren <swarren@nvidia.com>,
	Lokesh Vutla <lokeshvutla@ti.com>
Subject: Re: [PATCH] Revert "arm: bootm: Disable LMB reservation for command line and board info on arm64"
Date: Fri, 6 Aug 2021 12:43:02 -0400	[thread overview]
Message-ID: <20210806164302.GA858@bill-the-cat> (raw)
In-Reply-To: <d678b6d9-2d4c-8d1e-8e3c-71fb91756306@denx.de>

[-- Attachment #1: Type: text/plain, Size: 9210 bytes --]

On Thu, Aug 05, 2021 at 11:52:05PM +0200, Marek Vasut wrote:
> On 8/2/21 4:44 PM, Tom Rini wrote:
> > On Mon, Aug 02, 2021 at 04:34:29PM +0200, Jan Kiszka wrote:
> > > On 02.08.21 16:27, Tom Rini wrote:
> > > > On Mon, Aug 02, 2021 at 04:03:01PM +0200, Jan Kiszka wrote:
> > > > > On 02.08.21 15:04, Tom Rini wrote:
> > > > > > On Mon, Aug 02, 2021 at 01:54:57PM +0200, Jan Kiszka wrote:
> > > > > > > On 02.08.21 13:38, Marek Vasut wrote:
> > > > > > > > On 8/2/21 1:36 PM, Jan Kiszka wrote:
> > > > > > > > > On 02.08.21 12:48, Marek Vasut wrote:
> > > > > > > > > > On 8/2/21 11:37 AM, Jan Kiszka wrote:
> > > > > > > > > > > On 02.08.21 02:54, Marek Vasut wrote:
> > > > > > > > > > > > On 7/29/21 6:58 PM, Tom Rini wrote:
> > > > > > > > > > > > 
> > > > > > > > > > > > [...]
> > > > > > > > > > > > 
> > > > > > > > > > > > > > > so when did rcar3 introduce something there that shouldn't be
> > > > > > > > > > > > > > > reserved?  And you had phrased this to me on IRC as about reserving
> > > > > > > > > > > > > > > spot
> > > > > > > > > > > > > > > for ATAGS, and that not being needed of course on arm64.  But
> > > > > > > > > > > > > > > that's
> > > > > > > > > > > > > > > not
> > > > > > > > > > > > > > > what's going on.  Perhaps the answer is that rcar3 needs to
> > > > > > > > > > > > > > > introduce a
> > > > > > > > > > > > > > > board_lmb_reserve to free the normal arch one and provide whatever
> > > > > > > > > > > > > > > more
> > > > > > > > > > > > > > > narrow scope it needs.
> > > > > > > > > > > > > > 
> > > > > > > > > > > > > > Based on the commit message 2359fa7a878 ("arm: bootm: Disable LMB
> > > > > > > > > > > > > > reservation for command line and board info on arm64") , this is
> > > > > > > > > > > > > > about ATAGS
> > > > > > > > > > > > > > and we really don't need to reserve those on arm64.
> > > > > > > > > > > > > 
> > > > > > > > > > > > > Commit 2359fa7a878 disables the entire arch_lmb_reserve function on
> > > > > > > > > > > > > aarch64, yes.  I assumed when we had talked that it was a small area
> > > > > > > > > > > > > being set aside and perhaps mis-recalled that ATAGS tended to live at
> > > > > > > > > > > > > DDR_BASE + 0x800 or so.
> > > > > > > > > > > > 
> > > > > > > > > > > > That arch_lmb_reserve() is responsible for reserving architecture
> > > > > > > > > > > > specific memory. On arm32 it is ATAGS, on arm64 it is nothing as
> > > > > > > > > > > > far as
> > > > > > > > > > > > I can tell (and see below regarding the TLB).
> > > > > > > > > > > > 
> > > > > > > > > > > > > This reservation is not at that spot, and a lot
> > > > > > > > > > > > > more than that.
> > > > > > > > > > > > 
> > > > > > > > > > > > Can you please elaborate on this "lot more" part ? Because as much
> > > > > > > > > > > > as I
> > > > > > > > > > > > studied the reservation code, the "lot more" was ATAGS on arm32 and
> > > > > > > > > > > > nothing on arm64.
> > > > > > > > > > > 
> > > > > > > > > > > See my commit log.
> > > > > > > > > > 
> > > > > > > > > > This is not particularly useful answer, considering the commit log says:
> > > > > > > > > > "lot of crucial things", "Possibly more", "likely also on other boards"
> > > > > > > > > > and other opaque statements. But really, the problem so far happens on
> > > > > > > > > > one K3 board.
> > > > > > > > > 
> > > > > > > > > "Such things are the page table (tlb_addr),
> > > > > > > > > relocated U-Boot and the active stack."
> > > > > > > > 
> > > > > > > > Please read the rest of my answer, I don't believe the TLB should be
> > > > > > > > reserved at all. DTTO for the stack. If you think otherwise, please
> > > > > > > > explain why.
> > > > > > > 
> > > > > > > Marek, I've provided you with three generic examples of active memory
> > > > > > > blocks that are relevant while U-Boot is allocating from and also
> > > > > > > filling that LMB. Please follow those cases and explain to us why they
> > > > > > > aren't active - or at least prove why they are specific the k3 (for
> > > > > > > which I found no traces).
> > > > > > > 
> > > > > > > And stop following the TLB topic for now. That was only my first guess.
> > > > > > > The actual crash I'm seeing on my board come from plain code
> > > > > > > overwriting. It could have been TLB as well. It could also have been the
> > > > > > > stack. All those become unprotected via your reservation removal.
> > > > > > 
> > > > > > Jan, one thing I didn't see before is, are you also using
> > > > > > include/configs/ti_armv7_common.h in the end, like the K3 reference
> > > > > > platforms, and if not are you setting bootm_size in your environment?  I
> > > > > > have one more idea on why this fails on your board but not Marek's.
> > > > > > Thanks.
> > > > > 
> > > > > We are including that header but we didn't use DEFAULT_LINUX_BOOT_ENV,
> > > > > in fact. That left bootm_size undefined. Can you explain the impact?
> > > > 
> > > > I suspect the answer here is that Marek does not see this problem
> > > > because on R-Car bootm_size is set to 0x10000000 and so no relocation of
> > > > the device tree / kernel / initrd happens to overwrite the running
> > > > U-Boot and blow everything up.  If you don't revert this, and do set
> > > > bootm_size does everything work?  Marek, if you unset bootm_size, do you
> > > > see failure?  Thanks!
> > > > 
> > > 
> > > I currently do not see the error, even with unset bootm_size and Marek's
> > > patch back in. But fdt indeed moves down when adopting those settings.
> > > That makes sense for us anyway, I think our custom env values are rather
> > > for historic reasons, and one had an issue anyway (incorrect kernel
> > > alignment).
> > > 
> > > But at least we understand why I was able to see this, sometimes.
> > 
> > OK, thanks.  Note that I'm not sure how I want to move forward here
> > because a very frequent user/developer problem is "device tree
> > relocated, everything crashed, why? oh, I'll just disable it (and lead
> > to another problem down the line)".
> 
> In rcar with bootm_size unset it looks like this:
> 
> => bdinfo
> boot_params = 0x000000007beee240
> DRAM bank   = 0x0000000000000000
> -> start    = 0x0000000048000000
> -> size     = 0x0000000038000000
> DRAM bank   = 0x0000000000000001
> -> start    = 0x0000000500000000
> -> size     = 0x0000000040000000
> DRAM bank   = 0x0000000000000002
> -> start    = 0x0000000600000000
> -> size     = 0x0000000040000000
> DRAM bank   = 0x0000000000000003
> -> start    = 0x0000000700000000
> -> size     = 0x0000000040000000
> flashstart  = 0x0000000008000000
> flashsize   = 0x0000000004000000
> flashoffset = 0x00000000000f5890
> baudrate    = 115200 bps
> relocaddr   = 0x000000007fee8000
> reloc off   = 0x000000007fee8000
> Build       = 64-bit
> current eth = ethernet@e6800000
> ...
> fdt_blob    = 0x000000007beda0e0
> new_fdt     = 0x000000007beda0e0
> fdt_size    = 0x000000000000dcc0
> multi_dtb_fit= 0x0000000049000000
> lmb_dump_all:
>  memory.cnt  = 0x4
>  memory[0]      [0x48000000-0x7fffffff], 0x38000000 bytes flags: 0
>  memory[1]      [0x500000000-0x53fffffff], 0x40000000 bytes flags: 0
>  memory[2]      [0x600000000-0x63fffffff], 0x40000000 bytes flags: 0
>  memory[3]      [0x700000000-0x73fffffff], 0x40000000 bytes flags: 0
>  reserved.cnt  = 0x1
>  reserved[0]    [0x44100000-0x47efffff], 0x03e00000 bytes flags: 4
> arch_number = 0x0000000000000000
> TLB addr    = 0x000000007fff0000
> irq_sp      = 0x000000007beda0d0
> sp start    = 0x000000007beda0d0
> Early malloc usage: 1318 / 8000
> 
> ...
> 
> ## Loading kernel from FIT Image at 58000000 ...
>    Using 'conf-1' configuration
>    Trying 'kernel-1' kernel subimage
>      Description:  Linux kernel (Sat Jun  5 00:24:15 CEST 2021)
>      Type:         Kernel Image
>      Compression:  uncompressed
>      Data Start:   0x58000154
>      Data Size:    16662536 Bytes = 15.9 MiB
>      Architecture: AArch64
>      OS:           Linux
>      Load Address: 0x50200000
>      Entry Point:  0x50200000
>      Hash algo:    crc32
>      Hash value:   0655cd1f
>    Verifying Hash Integrity ... crc32+ OK
> ## Loading fdt from FIT Image at 58000000 ...
>    Using 'conf-1' configuration
>    Trying 'fdt-1' fdt subimage
>      Description:  Flattened Device Tree blob (Sat Jun  5 00:24:15 CEST
> 2021)
>      Type:         Flat Device Tree
>      Compression:  uncompressed
>      Data Start:   0x58fe42a4
>      Data Size:    74686 Bytes = 72.9 KiB
>      Architecture: AArch64
>      Hash algo:    crc32
>      Hash value:   287b2438
>    Verifying Hash Integrity ... crc32+ OK
>    Booting using the fdt blob at 0x58fe42a4
>    Loading Kernel Image
>    Loading Device Tree to 000000007ffea000, end 000000007ffff3bd ... OK

OK, I think we can say it's likely that in your case we're relocating
the start of the device tree just a bit past where U-Boot is running.  A
bit of quick math says there's around 1MiB between relocaddr for U-Boot
and startof the device tree relocation address.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2021-08-06 16:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29  7:22 [PATCH] Revert "arm: bootm: Disable LMB reservation for command line and board info on arm64" Jan Kiszka
2021-07-29 15:01 ` Marek Vasut
2021-07-29 15:23   ` Tom Rini
2021-07-29 16:47     ` Marek Vasut
2021-07-29 16:58       ` Tom Rini
2021-08-02  0:54         ` Marek Vasut
2021-08-02  9:37           ` Jan Kiszka
2021-08-02 10:48             ` Marek Vasut
2021-08-02 11:36               ` Jan Kiszka
2021-08-02 11:38                 ` Marek Vasut
2021-08-02 11:54                   ` Jan Kiszka
2021-08-02 13:04                     ` Tom Rini
2021-08-02 14:03                       ` Jan Kiszka
2021-08-02 14:27                         ` Tom Rini
2021-08-02 14:34                           ` Jan Kiszka
2021-08-02 14:44                             ` Tom Rini
2021-08-05 21:52                               ` Marek Vasut
2021-08-06 16:43                                 ` Tom Rini [this message]
2021-08-02 13:00           ` Tom Rini
2021-08-05 21:53             ` Marek Vasut
2021-08-05 23:31               ` Tom Rini
2021-08-08 13:35                 ` Marek Vasut
2021-08-02 21:27 ` Tom Rini
2021-08-03 21:51   ` Tom Rini
2021-08-05 22:22     ` Marek Vasut
2021-08-06 16:49       ` Tom Rini
2021-08-08 13:45         ` Marek Vasut
2021-08-08 14:00           ` Tom Rini
2021-08-08 14:28             ` Marek Vasut
2021-08-08 14:54               ` Tom Rini
2021-08-08 15:25                 ` Marek Vasut
2021-08-08 15:57                   ` Tom Rini
2021-08-09  7:34                   ` [EXT] " Ye Li
2021-08-09 13:16                     ` Tom Rini
2021-08-09 14:11                       ` Wolfgang Denk
2021-08-09 14:21                         ` Tom Rini
2021-08-09  6:44               ` Wolfgang Denk
2021-08-09 12:53                 ` Tom Rini
2021-08-08 18:21 ` Tom Rini

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=20210806164302.GA858@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=hai.pham.ud@renesas.com \
    --cc=jan.kiszka@siemens.com \
    --cc=lokeshvutla@ti.com \
    --cc=marex@denx.de \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=swarren@nvidia.com \
    --cc=u-boot@lists.denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox