Subject: Re: [Bisected] PowerMac G5 fails booting kernel 6.6-rc3 (BUG: Unable to handle kernel data access at 0xfeffbb62ffec65fe)

From: Erhard Furtner <[email-masked]>
Date: Wed, 18 Oct 2023 12:34:18 +0200

On Wed, 18 Oct 2023 16:45:04 +1100
Michael Ellerman <[email-masked]> wrote:

> Thanks. Yeah text is generally better, it archives better and can be
> grepped etc. but in this case I was going a bit mad trying to make sense
> of the oops :)
> 
> In hindsight the bug is an obvious boot time ordering problem, can you
> confirm this fixes it. That should apply on top of Linus' current
> master.
> 
> cheers
> 
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 2f1026fba00d..71f16fb32ceb 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -948,6 +948,7 @@ void __init setup_arch(char **cmdline_p)
>  
>  	/* Parse memory topology */
>  	mem_topology_setup();
> +	set_max_mapnr(max_pfn);
>  
>  	/*
>  	 * Release secondary cpus out of their spinloops at 0x60 now that
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index 8b121df7b08f..07e8f4f1e07f 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -288,7 +288,6 @@ void __init mem_init(void)
>  #endif
>  
>  	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
> -	set_max_mapnr(max_pfn);
>  
>  	kasan_late_init();
>  

Yes, this fix actually does the trick. v6.6-rc6 booting up fine now (dmesg attached) on the G5. Patch also applies on 6.5.7 with seemingly no side effects . Many thanks to all involved!

I'll check whether this also helps on a older memory related bug I bisected recently. And post the bug if not. ;)

Regards,
Erhard