On 05/23/2019 10:16 AM, Mathieu Malaterre wrote:
On Thu, May 23, 2019 at 11:45 AM Christophe Leroy
<christophe.le...@c-s.fr> wrote:



Le 23/05/2019 à 10:53, Mathieu Malaterre a écrit :

I confirm powerpc/merge does not boot for me (same config). Commit id:

a27eaa62326d (powerpc/merge) Automatic merge of branches 'master',
'next' and 'fixes' into merge

I see in the config you sent me that you have selected CONFIG_KASAN,
which is a big new stuff.

Can you try without it ?

With same config but CONFIG_KASAN=n (on top of a27eaa62326d), I can
reproduce the boot failure (no change).

Time for bisect ?


I found the issue. In order to be able to support KASAN, the setup of segments have moved earlier in the boot. Your problem is a side effect of this change.
Function setup_disp_bat() is supposed to setup BAT3 for btext data.
But setup_disp_bat() rely on someone setting in disp_BAT the values to be loaded into BATs. This is done by btext_prepare_BAT() which is called by bootx_init(). The problem is that bootx_init() is never called, so setup_disp_bat() does nothing and the access to btext data is possible because the bootloader has set an entry for it in the hash table.

But by setting up the segment earlier, we break the bootloader hash table, which shouldn't be an issue if the BATs had been set properly as expected.

The problematic commit is 215b823707ce ("powerpc/32s: set up an early static hash table for KASAN)"

Here is a dirty fix that works for me when CONFIG_KASAN is NOT set.
Of course, the real fix has to be to setup the BATs properly, but I won't have time to look at that before June. Maybe you can ?

diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 755fab9641d6..fba16970c028 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -162,7 +162,6 @@ __after_mmu_off:
        bl      flush_tlbs

        bl      initial_bats
-       bl      load_segment_registers
 #ifdef CONFIG_KASAN
        bl      early_hash_table
 #endif
@@ -920,6 +919,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE)
        RFI
 /* Load up the kernel context */
 2:     bl      load_up_mmu
+       bl      load_segment_registers

 #ifdef CONFIG_BDI_SWITCH
        /* Add helper information for the Abatron bdiGDB debugger.

Christophe

Reply via email to