Re: sparc32: boot fails with > 256 MB memory after switch to NO_BOOTMEM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-01-28 10:35, Mike Rapoport wrote:
On Wed, Jan 27, 2021 at 04:03:00PM +0100, Andreas Larsson wrote:


Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 makes sparc32 use
memblocks instead of the previous bootmem solution. Unfortunately, due
to this:

#define PAGE_OFFSET  0xf0000000
#define __va(x)	     ((void *)((unsigned long) (x) - phys_base +
PAGE_OFFSET))
#define phys_to_virt __va

it makes physical addresses >= 0x10000000 past phys_base wrap around the
32-bit memory space when converted to virtual addresses, e.g. in
memblock_alloc_try_nid. Physical memory exactly 0x10000000 past
phys_base is returned as an unintended NULL pointer, leading to a panic
in my boot when percpu memory allocation fails due to it.

Unfortunately I have had 256 MB memory or less in a lot of my testing,
so this old one has slipped by me.

Does anyone has any ideas or pointers on how to resolve this?

I think the simplest way to work around this is to limit early allocations
to 256M with addition of

	memblock_set_current_limit(SZ_256M);
somewhere at setup_arch().

The page allocator will anyway see the entire memory, so I cannot think of
any downside here.

That works like a charm! Thank you! I'll submit a patch.

--
Andreas Larsson
Cobham Gaisler






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux