On Mon, Aug 09, 2021 at 04:11:36PM +0200, Wolfgang Denk wrote: > Dear Tom, > > In message <20210809131640.GN858@bill-the-cat> you wrote: > > > > Thanks for explaining. It sounds like > > arch/arm/mach-imx/imx8m/soc.c::the=A0ft_system_setup() needs a comment > > that it uses a lot of stack, due to how complex it is, and that > > I think this is the wrong approach. It sounds as if we were > discouragin the use of the stack for dynamic buffers etc. We should > not do that. Instead, we should make sure that the stack starts > below any reserved memory locations, and is free to grow downward as > long as there is still memory available. > > If U-Boot was an OS, we would probably think about implementing a > more complex memory management utilizing the MMU, but in a boot > loader this is clearly overkill. But please, just let the stack > grow as it wants. > > There may be completely legal use cases with unpredictable stack > requirements. Think about recursive shell scripts, for example... This is a problem of the specific flow of the code. Generally, you're right, and that's what we do. Here specifically, I'm not sure we could rework the flow to have a place where we call ft_system_setup prior to lmb. The alternative, which would cover most cases at least, is to make sure everyone sets bootm_size and we stop with "all of DRAM, with a few exceptions, is where to relocate kernel/dtb/initrd to" being the default case. -- Tom