linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Erhard Furtner <erhard_f@mailbox.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: KASAN debug kernel fails to boot at early stage when CONFIG_SMP=y is set (kernel 6.5-rc5, PowerMac G4 3,6)
Date: Mon, 14 Aug 2023 09:40:44 +0000	[thread overview]
Message-ID: <57bdfad9-cbec-1a9f-aca7-5956d22a8ada@csgroup.eu> (raw)
In-Reply-To: <20230813213855.794b3c8f@yea>



Le 13/08/2023 à 21:38, Erhard Furtner a écrit :
> On Fri, 11 Aug 2023 06:45:14 +0000
> Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> 
>> Le 11/08/2023 à 01:48, Erhard Furtner a écrit :
>>> I wanted to fire up my PowerMac G4 MDD (Dual CPU) with a KASAN debug build of kernel 6.5-rc5 for testing purposes. But the kernel fails to boot at a very early stage. I only get a white screen reading
>>> "done
>>> found display: /pci@f0000000/ATY,AlteracParent@10/ATY,Alterac_B@1, opening..."
>>
>> Can you try with CONFIG_PPC_EARLY_DEBUG and see if you get more
>> information on the screen ?
> 
> With CONFIG_PPC_EARLY_DEBUG set booting continues and I get two more lines on a white screen:
> 
> [    0.000000] printk: bootconsole [udbg0] enabled
> [    0.000000] Total memory = 2048MB; using 4096kB for hash table
> 
> Afterwards the G4 freezes.

Interesting. That means we get stuck somewhere around  MMU_init()

We know that MMU_init_hw() is called and runs at least until:

	pr_info("Total memory = %lldMB; using %ldkB for hash table\n",
		(unsigned long long)(total_memory >> 20), Hash_size >> 10);

But we never reach the print in setup_kuap() which is itself called by 
set_kup():
	pr_info("Activating Kernel Userspace Access Protection\n");


Could you try to narrow more the issue by spreading pr_info() at places 
in the code below and/or the called functions ? Either we never come 
back from MMU_init_hw(), or one of mapin_ram() btext_unmap() 
kasan_mmu_init() fails.

So the piece of code we are interested in is located in 
arch/powerpc/mm/init_32.c and is:

	/* Initialize the MMU hardware */
	if (ppc_md.progress)
		ppc_md.progress("MMU:hw init", 0x300);
==>	MMU_init_hw();

	/* Map in all of RAM starting at KERNELBASE */
	if (ppc_md.progress)
		ppc_md.progress("MMU:mapin", 0x301);
	mapin_ram();

	/* Initialize early top-down ioremap allocator */
	ioremap_bot = IOREMAP_TOP;

	if (ppc_md.progress)
		ppc_md.progress("MMU:exit", 0x211);

	/* From now on, btext is no longer BAT mapped if it was at all */
#ifdef CONFIG_BOOTX_TEXT
	btext_unmap();
#endif

	kasan_mmu_init();

==>	setup_kup();


Christophe


> 
> By chane I found out another interesting thing: This only happens on cold boots.
> 
> If I boot the G4 up with another kernel first and boot the SMP KASAN kernel afterwards it just boots up fine too! On further reboots the SMP KASAN kernel keeps booting up normally. Until I turn the machine off - and next time I turn it on the same SMP KASAN kernel fails booting again as described. Strange...
> 
> This behaviour however is reproducible. Tried that procedure 15-20 times just to be sure. Hope you can make something out of it.
> 
> Attached is a dmesg of a successful SMP KASAM kernel boot attempt when a working kernel was booted first.
> 
> Regards,
> Erhard F.

  reply	other threads:[~2023-08-14  9:42 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 23:48 KASAN debug kernel fails to boot at early stage when CONFIG_SMP=y is set (kernel 6.5-rc5, PowerMac G4 3,6) Erhard Furtner
2023-08-11  6:45 ` Christophe Leroy
2023-08-13 19:38   ` Erhard Furtner
2023-08-14  9:40     ` Christophe Leroy [this message]
2023-08-14 17:27       ` Erhard Furtner
2023-08-15 17:21         ` [PATCH] Add pr_info() traces for investigation Christophe Leroy
2023-08-15 17:25         ` KASAN debug kernel fails to boot at early stage when CONFIG_SMP=y is set (kernel 6.5-rc5, PowerMac G4 3,6) Christophe Leroy
2023-08-15 20:01           ` Erhard Furtner
2023-08-16 15:56             ` Christophe Leroy
2023-08-17 18:32               ` Erhard Furtner
2023-08-17 23:13                 ` Michael Ellerman
2023-08-18  9:16                   ` Erhard Furtner
2023-08-18 15:47                     ` Christophe Leroy
2023-08-18 16:23                       ` Erhard Furtner
2023-08-22  7:31                         ` Christophe Leroy
2023-08-24  0:00                           ` Erhard Furtner
2023-08-24 11:36                             ` Michael Ellerman
2023-08-27 23:17                               ` Erhard Furtner
2023-08-31  5:32                                 ` Christophe Leroy
2023-08-31 22:44                                   ` Erhard Furtner
2023-09-01  7:43                                     ` Christophe Leroy
2023-09-03 21:06                                       ` Erhard Furtner
2023-09-04 14:48                                         ` Christophe Leroy
2023-09-04 14:55                                           ` Christophe Leroy
2023-09-04 21:32                                             ` Erhard Furtner
2023-09-12  0:11                                             ` Erhard Furtner
2023-09-12  7:47                                               ` Christophe Leroy
2023-09-12 15:59                                                 ` Erhard Furtner
2023-09-12 17:39                                                   ` Christophe Leroy
2023-09-12 20:09                                                     ` Erhard Furtner
2023-09-13  5:28                                                       ` Christophe Leroy
2023-09-14  4:54                                                     ` Christophe Leroy
2023-09-14 12:33                                                       ` Erhard Furtner
2024-02-28 23:55                                                       ` Erhard Furtner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57bdfad9-cbec-1a9f-aca7-5956d22a8ada@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=erhard_f@mailbox.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).