Re: [PATCH v3] m68k: Fix memblock-related crashes

From: Geert Uytterhoeven
Date: Sat Dec 08 2018 - 05:52:19 EST


Hi Mike,

On Fri, Dec 7, 2018 at 10:02 PM Mike Rapoport <rppt@xxxxxxxxxxxxx> wrote:
> On Fri, Dec 07, 2018 at 05:50:11PM +0100, Geert Uytterhoeven wrote:
> > Sun-3 must be broken before this fix, as it fills in m68k_memory[0] in
> > config_sun3(), i.e. after m68k_parse_bootinfo().
> > Sun-3 is not fixed by this fix, as it uses its own paging_init(), not
> > the one in motorola.c.
> > Fixing Sun-3 requires adding memblock_add()/memblock_reserve() calls to
> > the Sun-3 memory management code.
>
> I think that adding memblock_add() to config_sun3 would be sufficient,
> something like the diff below. This will make memblock aware of the
> available physical memory and it seems there no allocations in sun3 before
> paging_init().
>
> diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
> index 542c440..9a5b9dd 100644
> --- a/arch/m68k/sun3/config.c
> +++ b/arch/m68k/sun3/config.c
> @@ -150,6 +150,7 @@ void __init config_sun3(void)
>
> m68k_num_memory=1;
> m68k_memory[0].size=*(romvec->pv_sun3mem);
> + memblock_add(memory_start, memory_end - memory_start);
>
> sun3_bootmem_alloc(memory_start, memory_end);
> }

Thanks!

It doesn't need a memblock_reserve() for the kernel, as memory_start is
already adjusted for that, right?

Anyone who can test this is on Sun-3? Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds