Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Geert Uytterhoeven
Hi Adrian,

On Tue, Feb 21, 2023 at 4:53 PM John Paul Adrian Glaubitz
 wrote:
> On Tue, 2023-02-21 at 15:55 +0100, Geert Uytterhoeven wrote:
> > Looks surprisingly similar to the issue reported by Stan.
> > Do the mitigations given in
> > https://lore.kernel.org/all/camuhmdutkr2zvzijflxvs9d_injbktsnqqqfo1oxnjhzeoy...@mail.gmail.com
> > help?
>
> The kernel actually crashes with a backtrace:
>
> ABCDGHIJK
> [0.00] Linux version 6.0.0-6-m68k (debian-ker...@lists.debian.org) 
> (gcc-12 (Debian 12.2.0-9) 12.2.0, GNU ld (GNU Binutils for
> Debian) 2.39) #1 Debian 6.0.12-1 (2022-12-09)
> [0.00] Enabling workaround for errata I14
> [0.00] printk: bootconsole [debug0] enabled
> [0.00] Amiga hardware found: [A4000] VIDEO BLITTER AUDIO FLOPPY 
> A4000_IDE KEYBOARD MOUSE SERIAL PARALLEL A3000_CLK CHIP_RAM PAULA
> LISA ALICE_PAL ZORRO3
> [0.00] initrd: 0ef0602c - 0f80
> [0.00] Zone ranges:
> [0.00]   DMA  [mem 0x0800-0x00f7]
> [0.00]   Normal   empty
> [0.00] Movable zone start for each node
> [0.00] Early memory node ranges
> [0.00]   node   0: [mem 0x0800-0x0f7f]
> [0.00] Initmem setup node 0 [mem 
> 0x0800-0x0f7f]
> [0.00] Unable to handle kernel access at virtual address (ptrval)

I see the same issue on my A4000, bisecting...

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

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



Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Stephen Walsh
Hi Michael,

> that's apparently been corrected in later versions. Commit 
> ca831f29f8f25c97182e726429b38c0802200c8f (in from 5.17).
> 
> I doubt this would lead to different code generated.
> 
> Which was the first broken version you tried? That would narrow down
> the search range considerably...

Version 5.16-02-m68k is the last working version for me on my A3000
(Reported back in Sept last year... Only now have I been able to get
back to it)..

I downloaded the kernel image deb's from snapshot.debian.org.

Version's 5.16-3 through to 5.16-6 boot but fail back to the initramfs
saying they can't find the root file system. The hd is listed during
the boot process though. 

It's not the size of the initram, but a kernel issue. I changed the
initramfs settings from "most" to "dep", shrinking it in size, and
still had kernel boot issues.

Kernel's above 5.17/5.19/6.x fail and don't even start the heart beat.

Searching for SAVEKMSG magic...
Found 2674 bytes at 0x001e0010

[0.00] Linux version 5.17.0-1-m68k (debian-ker...@lists.debian.org) 
(gcc-11 (Debian 11.2.0-20) 11.2.0, GNU ld (GNU Binutils for Debian) 2.38) #1 
Debian 5.17.3-1 (2022-04-18)
[0.00] printk: console [debug0] enabled
[0.00] Amiga hardware found: [A3000] VIDEO BLITTER AMBER_FF AUDIO 
FLOPPY A3000_SCSI KEYBOARD MOUSE SERIAL PARALLEL A3000_CLK CHIP_RAM PAULA 
DENISE_HR AGNUS_HR_PAL MAGIC_REKICK ZORRO3 
[0.00] initrd: 0f7f395d - 1000
[0.00] Ignoring memory chunk at 0x780:0x80 before the first 
chunk
[0.00] Fix your bootloader or use a memfile to make use of this area!
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x0800-0x00ff]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x0800-0x0fff]
[0.00] Initmem setup node 0 [mem 0x0800-0x0fff]
[0.00] Unable to handle kernel access at virtual address (ptrval)
[0.00] Oops: 
[0.00] Modules linked in:
[0.00] PC: [<001edcac>] memcmp+0x2c/0x5c
[0.00] SR: 2700  SP: (ptrval)  a2: 0047d530
[0.00] d0: 00408ab1d1: 0ff8d2: 001edc80d3: 019e
[0.00] d4: 0804c588d5: 0080c6a3a0: 000ca1: 0ff4
[0.00] Process swapper (pid: 0, task=(ptrval))
[0.00] Frame format=7 eff addr=0047bfb8 ssw=0505 faddr=0ff4
[0.00] wb 1 stat/addr/data: 0005 0804c588 0080c6a3
[0.00] wb 2 stat/addr/data: 0005 0053c000 019e
[0.00] wb 3 stat/addr/data: 0005 0047bfb0 001edc80
[0.00] push data: 0080c6a3 00353a8a 08001000 08056094
[0.00] Stack from 0047bfb0:
[0.00] 001edc80 019e 00353a8a 00514b0e 0ff4 00408aad 
000c 0053c000
[0.00] 019e 0804c588 0080c6a3 08050258  08062278 
08001000 08056094
[0.00] 0ff0 005333b8  00513872
[0.00] Call Trace: [<001edc80>] memcmp+0x0/0x5c
[0.00]  [<00353a8a>] _printk+0x0/0x18
[0.00]  [<00514b0e>] start_kernel+0x86/0x5ca
[0.00]  [<>] sz_long+0x5/0x6
[0.00]  [<00513872>] _sinittext+0x872/0x11f8
[0.00] 
[0.00] Code: 4280 6036 2209 200b 2640 2241 5881 5880 <2411> b493 66e4 
2241 2640 5988 7403 b488 65e6 60d6 4283 1631 1800 4282 1433 1800
[0.00] Disabling lock debugging due to kernel taint
[0.00] Kernel panic - not syncing: Attempted to kill the idle task!
[0.00] ---[ end Kernel panic - not syncing: Attempted to kill the idle 
task! ]---





Searching for SAVEKMSG magic...
Found 2632 bytes at 0x001e0010

[0.00] Linux version 5.18.0-3-m68k (debian-ker...@lists.debian.org) 
(gcc-11 (Debian 11.3.0-4) 11.3.0, GNU ld (GNU Binutils for Debian) 
2.38.90.20220713) #1 Debian 5.18.14-1 (2022-07-23)
[0.00] printk: console [debug0] enabled
[0.00] Amiga hardware found: [A3000] VIDEO BLITTER AMBER_FF AUDIO 
FLOPPY A3000_SCSI KEYBOARD MOUSE SERIAL PARALLEL A3000_CLK CHIP_RAM PAULA 
DENISE_HR AGNUS_HR_PAL MAGIC_REKICK ZORRO3 
[0.00] initrd: 0facd79f - 1000
[0.00] Ignoring memory chunk at 0x780:0x80 before the first 
chunk
[0.00] Fix your bootloader or use a memfile to make use of this area!
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x0800-0x00ff]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x0800-0x0fff]
[0.00] Initmem setup node 0 [mem 0x0800-0x0fff]
[0.00] Unable to handle kernel access at virtual address (ptrval)
[0.00] Oops: 
[0.00] Modules linked in:
[0.00] PC: [<001ed3a8>] memcmp+0x2c/0x5c
[  

Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Geert Uytterhoeven
On Sun, Feb 26, 2023 at 12:02 PM Geert Uytterhoeven
 wrote:
> On Tue, Feb 21, 2023 at 4:53 PM John Paul Adrian Glaubitz
>  wrote:
> > On Tue, 2023-02-21 at 15:55 +0100, Geert Uytterhoeven wrote:
> > > Looks surprisingly similar to the issue reported by Stan.
> > > Do the mitigations given in
> > > https://lore.kernel.org/all/camuhmdutkr2zvzijflxvs9d_injbktsnqqqfo1oxnjhzeoy...@mail.gmail.com
> > > help?
> >
> > The kernel actually crashes with a backtrace:
> >
> > ABCDGHIJK
> > [0.00] Linux version 6.0.0-6-m68k (debian-ker...@lists.debian.org) 
> > (gcc-12 (Debian 12.2.0-9) 12.2.0, GNU ld (GNU Binutils for
> > Debian) 2.39) #1 Debian 6.0.12-1 (2022-12-09)
> > [0.00] Enabling workaround for errata I14
> > [0.00] printk: bootconsole [debug0] enabled
> > [0.00] Amiga hardware found: [A4000] VIDEO BLITTER AUDIO FLOPPY 
> > A4000_IDE KEYBOARD MOUSE SERIAL PARALLEL A3000_CLK CHIP_RAM PAULA
> > LISA ALICE_PAL ZORRO3
> > [0.00] initrd: 0ef0602c - 0f80
> > [0.00] Zone ranges:
> > [0.00]   DMA  [mem 0x0800-0x00f7]
> > [0.00]   Normal   empty
> > [0.00] Movable zone start for each node
> > [0.00] Early memory node ranges
> > [0.00]   node   0: [mem 0x0800-0x0f7f]
> > [0.00] Initmem setup node 0 [mem 
> > 0x0800-0x0f7f]
> > [0.00] Unable to handle kernel access at virtual address (ptrval)
>
> I see the same issue on my A4000, bisecting...

Bisected to commit 376e3fdecb0dcae2 ("m68k: Enable memtest
functionality") in v5.17-rc1.  Reverting that on top of latest fixes the
issue.

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

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



Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Michael Schmitz

Hi Geert, Stephen,

Am 27.02.2023 um 01:52 schrieb Geert Uytterhoeven:

On Sun, Feb 26, 2023 at 12:02 PM Geert Uytterhoeven
 wrote:

On Tue, Feb 21, 2023 at 4:53 PM John Paul Adrian Glaubitz
 wrote:

On Tue, 2023-02-21 at 15:55 +0100, Geert Uytterhoeven wrote:

Looks surprisingly similar to the issue reported by Stan.
Do the mitigations given in
https://lore.kernel.org/all/camuhmdutkr2zvzijflxvs9d_injbktsnqqqfo1oxnjhzeoy...@mail.gmail.com
help?


The kernel actually crashes with a backtrace:

ABCDGHIJK
[0.00] Linux version 6.0.0-6-m68k (debian-ker...@lists.debian.org) 
(gcc-12 (Debian 12.2.0-9) 12.2.0, GNU ld (GNU Binutils for
Debian) 2.39) #1 Debian 6.0.12-1 (2022-12-09)
[0.00] Enabling workaround for errata I14
[0.00] printk: bootconsole [debug0] enabled
[0.00] Amiga hardware found: [A4000] VIDEO BLITTER AUDIO FLOPPY 
A4000_IDE KEYBOARD MOUSE SERIAL PARALLEL A3000_CLK CHIP_RAM PAULA
LISA ALICE_PAL ZORRO3
[0.00] initrd: 0ef0602c - 0f80
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x0800-0x00f7]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x0800-0x0f7f]
[0.00] Initmem setup node 0 [mem 0x0800-0x0f7f]
[0.00] Unable to handle kernel access at virtual address (ptrval)


I see the same issue on my A4000, bisecting...


Bisected to commit 376e3fdecb0dcae2 ("m68k: Enable memtest
functionality") in v5.17-rc1.  Reverting that on top of latest fixes the
issue.


Yes, I'm sorry to say that was the only likely candidate. Can't see why 
though - are Macs all configured to have RAM start at address zero, and 
possibly contiguous, Finn?


Cheers,

Michael




Gr{oetje,eeting}s,

Geert





Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Michael Schmitz

Hi Geert,

Am 27.02.2023 um 01:52 schrieb Geert Uytterhoeven:

On Sun, Feb 26, 2023 at 12:02 PM Geert Uytterhoeven
 wrote:

On Tue, Feb 21, 2023 at 4:53 PM John Paul Adrian Glaubitz
 wrote:

On Tue, 2023-02-21 at 15:55 +0100, Geert Uytterhoeven wrote:

Looks surprisingly similar to the issue reported by Stan.
Do the mitigations given in
https://lore.kernel.org/all/camuhmdutkr2zvzijflxvs9d_injbktsnqqqfo1oxnjhzeoy...@mail.gmail.com
help?


The kernel actually crashes with a backtrace:

ABCDGHIJK
[0.00] Linux version 6.0.0-6-m68k (debian-ker...@lists.debian.org) 
(gcc-12 (Debian 12.2.0-9) 12.2.0, GNU ld (GNU Binutils for
Debian) 2.39) #1 Debian 6.0.12-1 (2022-12-09)
[0.00] Enabling workaround for errata I14
[0.00] printk: bootconsole [debug0] enabled
[0.00] Amiga hardware found: [A4000] VIDEO BLITTER AUDIO FLOPPY 
A4000_IDE KEYBOARD MOUSE SERIAL PARALLEL A3000_CLK CHIP_RAM PAULA
LISA ALICE_PAL ZORRO3
[0.00] initrd: 0ef0602c - 0f80
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x0800-0x00f7]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x0800-0x0f7f]
[0.00] Initmem setup node 0 [mem 0x0800-0x0f7f]
[0.00] Unable to handle kernel access at virtual address (ptrval)


I see the same issue on my A4000, bisecting...


Bisected to commit 376e3fdecb0dcae2 ("m68k: Enable memtest
functionality") in v5.17-rc1.  Reverting that on top of latest fixes the


What about instead changing the piece of code that you identified as 
problematic in Kars' case to claim/map the last few bits as well 
(memblock_cap_size() to be precise)?


I wonder whether Finn's memtest patch merely exposed another MM bug that 
we don't hit as easily (not without putting memory under a lot of pressure)?


Cheers,

Michael



issue.

Gr{oetje,eeting}s,

Geert





Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Finn Thain
On Mon, 27 Feb 2023, Michael Schmitz wrote:

> >
> > Bisected to commit 376e3fdecb0dcae2 ("m68k: Enable memtest 
> > functionality") in v5.17-rc1.  Reverting that on top of latest fixes 
> > the issue.
> 
> Yes, I'm sorry to say that was the only likely candidate. Can't see why 
> though - are Macs all configured to have RAM start at address zero, and 
> possibly contiguous, Finn?
> 

I don't really understand your question. This was not a Mac patch. The 
issue seems to be about the locations initrd_start and initrd_end in 
relation to the various memory segments (?)

This seems to be the same bug that was raised about 6 months ago... I had 
thought it was a bootloader bug but I'm out of my depth here.

https://lists.debian.org/debian-68k/2022/09/msg00047.html 
https://lists.debian.org/debian-68k/2022/09/msg00051.html 
https://lists.debian.org/debian-68k/2022/09/msg00055.html



Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Finn Thain
On Mon, 27 Feb 2023, Michael Schmitz wrote:

> 
> I wonder whether Finn's memtest patch merely exposed another MM bug 
> 

A kernel patch may be easier than a bootloader patch (even if this is a 
bootloader bug) particularly if it affects multiple platforms.

A partial revert of my patch (below) will probably avoid the issue, but 
with the side effect that use of memtest will clobber the initrd.

The initrd and memtest features aren't usually needed together. At the 
time when I needed the memtest feature I did not have confidence in the 
hardeare. An initrd wasn't very useful at that point.

diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 3a2bb2e8fdad..92f1b9268dff 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -326,6 +326,8 @@ void __init setup_arch(char **cmdline_p)
panic("No configuration setup");
}
 
+   paging_init();
+
 #ifdef CONFIG_BLK_DEV_INITRD
if (m68k_ramdisk.size) {
memblock_reserve(m68k_ramdisk.addr, m68k_ramdisk.size);
@@ -335,8 +337,6 @@ void __init setup_arch(char **cmdline_p)
}
 #endif
 
-   paging_init();
-
 #ifdef CONFIG_NATFEAT
nf_init();
 #endif
 



Re: Kernel versions 6.x don't boot on Amiga 4000

2023-02-26 Thread Michael Schmitz

Hi Finn,

Am 27.02.2023 um 18:55 schrieb Finn Thain:

On Mon, 27 Feb 2023, Michael Schmitz wrote:



Bisected to commit 376e3fdecb0dcae2 ("m68k: Enable memtest
functionality") in v5.17-rc1.  Reverting that on top of latest fixes
the issue.


Yes, I'm sorry to say that was the only likely candidate. Can't see why
though - are Macs all configured to have RAM start at address zero, and
possibly contiguous, Finn?



I don't really understand your question. This was not a Mac patch. The
issue seems to be about the locations initrd_start and initrd_end in
relation to the various memory segments (?)


I didn't realize that - thanks for pointing this out.



This seems to be the same bug that was raised about 6 months ago... I had
thought it was a bootloader bug but I'm out of my depth here.

https://lists.debian.org/debian-68k/2022/09/msg00047.html
https://lists.debian.org/debian-68k/2022/09/msg00051.html
https://lists.debian.org/debian-68k/2022/09/msg00055.html


I had forgotten all about that one... Thanks for jogging my memory!

In this case though, the bug happens when the ramdisk is loaded in the 
lowest address memory chunk, at least at a lower address than the one 
the kernel runs from.


The crashes in the above thread were all from boots where the initrd got 
loaded at the end of the memory chunk the kernel runs from.


Time to try using copy_from_kernel_nofault() to copy the ramdisk into 
its final location? (just kidding)


Cheers,

Michael