Re: Fail to boot 5.15 on mpc8347 with either debug_pagealloc or nobats
From: Christophe Leroy <hidden>
Date: 2021-12-05 18:12:55
Le 05/12/2021 à 17:42, Maxime Bizon a écrit :
On Saturday 04 Dec 2021 à 17:42:44 (+0000), Christophe Leroy wrote:quoted
I guess all the guard is in the comment ... /* * Set up one of the I/D BAT (block address translation) register pairs. * The parameters are not checked; in particular size must be a power * of 2 between 128k and 256M. */It's missing the aligment rule you just taught me, but it's arguably not the right place to teach ppc 101.
Indeed
quoted
Not sure it is that simple. I'm cooking a patch reusing the block_size() function in mm/book3s32/mmu.cIndeed it will handle cases that need more than 2 BATs.
Yes, that's the idea.
Also when mem=2G, I have physical memory mapped twice: CONFIG_PAGE_OFFSET=0x80000000 CONFIG_LOWMEM_SIZE=0x60000000 0: 0x80000000-0x8fffffff 0x00000000 256M Kernel rw m 1: 0x90000000-0x9fffffff 0x10000000 256M Kernel rw m 2: 0xa0000000-0xafffffff 0x20000000 256M Kernel rw m 3: 0xb0000000-0xbfffffff 0x30000000 256M Kernel rw m 4: 0xc0000000-0xcfffffff 0x40000000 256M Kernel rw m 5: 0xd0000000-0xdfffffff 0x50000000 256M Kernel rw m 6: 0xf0000000-0xf7ffffff 0x50000000 128M Kernel rw m BAT5 comes from __mmu_mapin_ram(), BAT6 from kasan init Is BAT5 needed here ?
Sure it is, because that's were kernel expects lowmem to be mapped. Allthough the kernel will unlikely access the 128M reserved for KASAN directly, the other 128M are still needed.
Last one, with KASAN and the following layout, I have an non working kernel with VMALLOC_START > VMALLOC_END: mem=2G CONFIG_PAGE_OFFSET=0x80000000 CONFIG_LOWMEM_SIZE=0x70000000 [ 0.000000] * 0xf0000000..0xfe000000 : kasan shadow mem [ 0.000000] * 0xef7ff000..0xeffff000 : fixmap [ 0.000000] * 0xf1000000..0xef7ff000 : vmalloc & ioremap IIUC the safeguard is here: arch/powerpc/mm/init_32.c: /* The amount of lowmem must be within 0xF0000000 - KERNELBASE. */ #if (CONFIG_LOWMEM_SIZE > (0xF0000000 - PAGE_OFFSET)) #error "You must adjust CONFIG_LOWMEM_SIZE or CONFIG_KERNEL_START" but the definition needs to be adapted for KASAN=y and require 256 more MB.
Hum.. Good point. Christophe