linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] m68k: Enable memtest kernel parameter
@ 2021-09-13  1:34 Finn Thain
  2021-09-13  3:40 ` Michael Schmitz
  0 siblings, 1 reply; 11+ messages in thread
From: Finn Thain @ 2021-09-13  1:34 UTC (permalink / raw)
  To: linux-m68k


This appears to work on Aranym, QEMU and the Quadra 630 I have here.
It is completely untested on Coldfire etc. I don't even know whether the
right memory mappings are in place for this to actually work as intended.
Would someone take a look please?

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 6e40f7f29ebc..d87e12b4855b 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -9,6 +9,7 @@ config M68K
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_PREEMPT if !COLDFIRE
+	select ARCH_USE_MEMTEST
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
 	select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 3a653f0a4188..d6301a094fc1 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -455,6 +455,8 @@ void __init paging_init(void)
 
 	flush_tlb_all();
 
+	early_memtest(min_addr, max_addr);
+
 	/*
 	 * initialize the bad page table and bad page to point
 	 * to a couple of allocated pages
-- 
2.26.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  1:34 [RFC] m68k: Enable memtest kernel parameter Finn Thain
@ 2021-09-13  3:40 ` Michael Schmitz
  2021-09-13  5:17   ` Michael Schmitz
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-09-13  3:40 UTC (permalink / raw)
  To: Finn Thain, linux-m68k; +Cc: Mike Rapoport

Hi Finn,

On 13/09/21 13:34, Finn Thain wrote:
>
> This appears to work on Aranym, QEMU and the Quadra 630 I have here.
> It is completely untested on Coldfire etc. I don't even know whether the
> right memory mappings are in place for this to actually work as intended.

The comment just above the section from paging_init() in your patch 
states that all physical memory is mapped into kernel virtual address 
space. I don't think that mapping is contiguous though.

> Would someone take a look please?
>
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index 6e40f7f29ebc..d87e12b4855b 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -9,6 +9,7 @@ config M68K
>  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
>  	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
>  	select ARCH_NO_PREEMPT if !COLDFIRE
> +	select ARCH_USE_MEMTEST
>  	select ARCH_WANT_IPC_PARSE_VERSION
>  	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
>  	select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
> diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
> index 3a653f0a4188..d6301a094fc1 100644
> --- a/arch/m68k/mm/motorola.c
> +++ b/arch/m68k/mm/motorola.c
> @@ -455,6 +455,8 @@ void __init paging_init(void)
>
>  	flush_tlb_all();
>
> +	early_memtest(min_addr, max_addr);
> +
>  	/*
>  	 * initialize the bad page table and bad page to point
>  	 * to a couple of allocated pages
>

I'd rather start that from availmem, not from min_addr ... I'm amazed 
this works - I'd expect the kernel text segment to get trashed by the 
memory test routines.

Cheers,

	Michael

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  3:40 ` Michael Schmitz
@ 2021-09-13  5:17   ` Michael Schmitz
  2021-09-13  5:17   ` Finn Thain
  2021-09-13  5:42   ` Mike Rapoport
  2 siblings, 0 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-09-13  5:17 UTC (permalink / raw)
  To: Finn Thain, linux-m68k; +Cc: Mike Rapoport

Hi Finn,

it looks as though early_memtest() does skip allocated and unmapped 
areas, so I'd say this looks fine.

Cheers,

	Michael


On 13/09/21 15:40, Michael Schmitz wrote:
> Hi Finn,
>
> On 13/09/21 13:34, Finn Thain wrote:
>>
>> This appears to work on Aranym, QEMU and the Quadra 630 I have here.
>> It is completely untested on Coldfire etc. I don't even know whether the
>> right memory mappings are in place for this to actually work as intended.
>
> The comment just above the section from paging_init() in your patch
> states that all physical memory is mapped into kernel virtual address
> space. I don't think that mapping is contiguous though.
>
>> Would someone take a look please?
>>
>> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
>> index 6e40f7f29ebc..d87e12b4855b 100644
>> --- a/arch/m68k/Kconfig
>> +++ b/arch/m68k/Kconfig
>> @@ -9,6 +9,7 @@ config M68K
>>      select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
>>      select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
>>      select ARCH_NO_PREEMPT if !COLDFIRE
>> +    select ARCH_USE_MEMTEST
>>      select ARCH_WANT_IPC_PARSE_VERSION
>>      select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
>>      select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
>> diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
>> index 3a653f0a4188..d6301a094fc1 100644
>> --- a/arch/m68k/mm/motorola.c
>> +++ b/arch/m68k/mm/motorola.c
>> @@ -455,6 +455,8 @@ void __init paging_init(void)
>>
>>      flush_tlb_all();
>>
>> +    early_memtest(min_addr, max_addr);
>> +
>>      /*
>>       * initialize the bad page table and bad page to point
>>       * to a couple of allocated pages
>>
>
> I'd rather start that from availmem, not from min_addr ... I'm amazed
> this works - I'd expect the kernel text segment to get trashed by the
> memory test routines.
>
> Cheers,
>
>     Michael

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  3:40 ` Michael Schmitz
  2021-09-13  5:17   ` Michael Schmitz
@ 2021-09-13  5:17   ` Finn Thain
  2021-09-13  5:51     ` Michael Schmitz
  2021-09-13  5:56     ` Mike Rapoport
  2021-09-13  5:42   ` Mike Rapoport
  2 siblings, 2 replies; 11+ messages in thread
From: Finn Thain @ 2021-09-13  5:17 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, Mike Rapoport

On Mon, 13 Sep 2021, Michael Schmitz wrote:

> 
> I'm amazed this works - I'd expect the kernel text segment to get 
> trashed by the memory test routines.
> 

I think the initramfs may get clobbered when the 'memtest' parameter is 
set. But that may be expected behaviour...

[    0.000000] Linux version 5.14.0-multi-debug-00001-g3e3e2b0990a2 (fthain@nippy) (m68k-linux-gnu-gcc (btc) 6.4.0, GNU ld (btc) 2.28) #20 Mon Sep 13 15:08:56 AEST 2021
[    0.000000] Saving 214 bytes of bootinfo
[    0.000000] printk: console [debug0] enabled
[    0.000000] printk: debug: ignoring loglevel setting.
Blitter tried to read byte from register ff8a00 at 00816a
[    0.000000] Atari hardware found: VIDEL STDMA-SCSI ST_MFP YM2149 PCM CODEC DSP56K SCC ANALOG_JOY BLITTER IDE TT_CLK FDC_SPEED
[    0.000000] early_memtest: # of tests: 17
[    0.000000]   0x005b2000 - 0x00e00000 pattern 7a6c7258554e494c
[    0.000000]   0x01000000 - 0x08600000 pattern 7a6c7258554e494c
[    0.000000]   0x005b2000 - 0x00e00000 pattern eeeeeeeeeeeeeeee
[    0.000000]   0x01000000 - 0x08600000 pattern eeeeeeeeeeeeeeee
[    0.000000]   0x005b2000 - 0x00e00000 pattern dddddddddddddddd
[    0.000000]   0x01000000 - 0x08600000 pattern dddddddddddddddd
[    0.000000]   0x005b2000 - 0x00e00000 pattern bbbbbbbbbbbbbbbb
[    0.000000]   0x01000000 - 0x08600000 pattern bbbbbbbbbbbbbbbb
[    0.000000]   0x005b2000 - 0x00e00000 pattern 7777777777777777
[    0.000000]   0x01000000 - 0x08600000 pattern 7777777777777777
[    0.000000]   0x005b2000 - 0x00e00000 pattern cccccccccccccccc
[    0.000000]   0x01000000 - 0x08600000 pattern cccccccccccccccc
[    0.000000]   0x005b2000 - 0x00e00000 pattern 9999999999999999
[    0.000000]   0x01000000 - 0x08600000 pattern 9999999999999999
[    0.000000]   0x005b2000 - 0x00e00000 pattern 6666666666666666
[    0.000000]   0x01000000 - 0x08600000 pattern 6666666666666666
[    0.000000]   0x005b2000 - 0x00e00000 pattern 3333333333333333
[    0.000000]   0x01000000 - 0x08600000 pattern 3333333333333333
[    0.000000]   0x005b2000 - 0x00e00000 pattern 8888888888888888
[    0.000000]   0x01000000 - 0x08600000 pattern 8888888888888888
[    0.000000]   0x005b2000 - 0x00e00000 pattern 4444444444444444
[    0.000000]   0x01000000 - 0x08600000 pattern 4444444444444444
[    0.000000]   0x005b2000 - 0x00e00000 pattern 2222222222222222
[    0.000000]   0x01000000 - 0x08600000 pattern 2222222222222222
[    0.000000]   0x005b2000 - 0x00e00000 pattern 1111111111111111
[    0.000000]   0x01000000 - 0x08600000 pattern 1111111111111111
[    0.000000]   0x005b2000 - 0x00e00000 pattern aaaaaaaaaaaaaaaa
[    0.000000]   0x01000000 - 0x08600000 pattern aaaaaaaaaaaaaaaa
[    0.000000]   0x005b2000 - 0x00e00000 pattern 5555555555555555
[    0.000000]   0x01000000 - 0x08600000 pattern 5555555555555555
[    0.000000]   0x005b2000 - 0x00e00000 pattern ffffffffffffffff
[    0.000000]   0x01000000 - 0x08600000 pattern ffffffffffffffff
[    0.000000]   0x005b2000 - 0x00e00000 pattern 0000000000000000
[    0.000000]   0x01000000 - 0x08600000 pattern 0000000000000000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x00000085ffffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000000dfffff]
[    0.000000]   node   0: [mem 0x0000000001000000-0x00000000085fffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000000085fffff]
[    0.000000] NatFeats found (ARAnyM, 1.0)
[    0.000000] initrd: 0833ea00 - 08600000
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 33490
[    0.000000] Kernel command line: debug=par console=tty0 ignore_loglevel initcall_blacklist=ide_falcon_driver_init,nfhd_init memtest=17 BOOT_IMAGE=vmlinux
[    0.000000] blacklisting initcall ide_falcon_driver_init
[    0.000000] blacklisting initcall nfhd_init
[    0.000000] Unknown command line parameters: initcall_blacklist=ide_falcon_driver_init BOOT_IMAGE=vmlinux
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 124032K/135168K available (4385K kernel code, 357K rwdata, 772K rodata, 148K init, 121K bss, 11136K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 200
[    0.000000] clocksource: mfp: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 77769386670404 ns
[    0.000000] Console: colour dummy device 80x25
[    0.010000] printk: console [tty0] enabled
[    0.010000] Calibrating delay loop... 140.69 BogoMIPS (lpj=703488)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.080000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.090000] devtmpfs: initialized
[    0.100000] random: get_random_u32 called from bucket_table_alloc+0x13e/0x180 with crng_init=0
[    0.110000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.110000] futex hash table entries: 256 (order: 0, 7168 bytes, linear)
[    0.110000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.110000] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[    0.120000] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.160000] wait_for_initramfs() called before rootfs_initcalls
[    0.170000] SCSI subsystem initialized
[    0.170000] libata version 3.00 loaded.
[    0.180000] clocksource: Switched to clocksource mfp
[    0.230000] NET: Registered PF_INET protocol family
[    0.240000] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.240000] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 6144 bytes, linear)
[    0.240000] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.240000] TCP bind hash table entries: 2048 (order: 3, 40960 bytes, linear)
[    0.250000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.250000] UDP hash table entries: 256 (order: 1, 12288 bytes, linear)
[    0.250000] UDP-Lite hash table entries: 256 (order: 1, 12288 bytes, linear)
[    0.250000] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.250000] RPC: Registered named UNIX socket transport module.
[    0.250000] RPC: Registered udp transport module.
[    0.250000] RPC: Registered tcp transport module.
[    0.250000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.260000] initcall nfhd_init blacklisted
[    0.260000] Trying to unpack rootfs image as initramfs...
[    0.960000] Freeing initrd memory: 2820K
[    0.960000] nfeth: API 5
[    0.960000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    1.150000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.150000] io scheduler mq-deadline registered
[    1.160000] atafb atafb: phys_screen_base 6e6000 screen_len 311296
[    1.160000] atafb atafb: Determined 640x480, depth 4
[    1.160000] atafb atafb:    virtual 640x972
[    1.170000] Console: switching to colour frame buffer device 80x30
[    1.180000] fb0: frame buffer device, using 304K of video memory
[    1.180000] pmac_zilog: 0.6 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)
[    1.180000] Non-volatile memory driver v1.3
[    1.210000] brd: module loaded
[    1.500000] scsi host0: Atari native SCSI, irq 15, io_port 0x0, base 0x0, can_queue 1, cmd_per_lun 2, sg_tablesize 1, this_id 7, flags { }
[    2.100000] random: fast init done
[    3.290000] atari-falcon-ide atari-falcon-ide: Atari Falcon and Q40/Q60 PATA controller
[    3.350000] scsi host1: pata_falcon
[    3.360000] ata1: PATA max PIO4 cmd 0xfff00000 ctl 0xfff00038 no IRQ, using PIO polling
[    3.410000] aoe: AoE v85 initialised.
[    3.440000] mousedev: PS/2 mouse device common for all mice
[    3.700000] input: Atari Keyboard as /devices/virtual/input/input0
[    3.710000] ata1.00: NODEV after polling detection
[    3.740000] ata1.01: ATA-2: slave, , max PIO2
[    3.760000] ata1.01: 322560 sectors, multi 0: LBA 
[    3.770000] ata1.01: configured for PIO
[    3.790000] scsi 1:0:1:0: Direct-Access     ATA      slave            n/a  PQ: 0 ANSI: 5
[    3.850000] sd 1:0:1:0: Attached scsi generic sg0 type 0
[    3.870000] sd 1:0:1:0: [sda] 322560 512-byte logical blocks: (165 MB/158 MiB)
[    3.910000] sd 1:0:1:0: [sda] Write Protect is off
[    3.920000] sd 1:0:1:0: [sda] Mode Sense: 00 3a 00 00
[    3.940000] sd 1:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    4.010000] sd 1:0:1:0: [sda] Attached SCSI disk
[    4.060000] rtc-generic rtc-generic: registered as rtc0
[    4.080000] NET: Registered PF_PACKET protocol family
[    4.100000] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    4.140000] Please append a correct "root=" boot option; here are the available partitions:
[    4.190000] 0100            8192 ram0 
[    4.190000]  (driver?)
[    4.230000] 0101            8192 ram1 
[    4.230000]  (driver?)
[    4.270000] 0102            8192 ram2 
[    4.270000]  (driver?)
[    4.310000] 0103            8192 ram3 
[    4.310000]  (driver?)
[    4.350000] 0800          161280 sda 
[    4.350000]  driver: sd
[    4.400000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    4.400000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.14.0-multi-debug-00001-g3e3e2b0990a2 #20
[    4.400000] Stack from 0102deac:
[    4.400000]         0102deac 004da4cc 004da4cc 0102df00 0102dec8 0043e88e 004da4cc 0102dee8
[    4.400000]         0043ce76 0102df28 00008001 005dc1d8 0043d0ec 01246000 00277e40 0102df48
[    4.400000]         005692ac 004cc21e 0102df28 004cc1cd 004cc19a 00000000 0102df28 fffffffa
[    4.400000]         00000000 0000000c 00002200 0004aa80 01018380 00585c98 00585c78 756e6b6e
[    4.400000]         6f776e2d 626c6f63 6b28302c 302900c0 014162d0 0102df70 005693da 0102df70
[    4.400000]         00569404 004cc282 00008001 0000007e 00000008 01018380 00585c98 00585c98
[    4.400000] Call Trace: [<0043e88e>] dump_stack+0x10/0x16
[    4.400000]  [<0043ce76>] panic+0xe6/0x2ea
[    4.400000]  [<00008001>] free_pointer_table+0x101/0x240
[    4.400000]  [<0043d0ec>] printk+0x0/0x16
[    4.400000]  [<00277e40>] strlen+0x0/0x40
[    4.400000]  [<005692ac>] mount_block_root+0x134/0x1ae
[    4.400000]  [<00002200>] do_one_initcall+0x0/0x1c0
[    4.400000]  [<0004aa80>] parse_args+0x0/0x2c0
[    4.400000]  [<005693da>] mount_root+0xb4/0xfa
[    4.400000]  [<00569404>] mount_root+0xde/0xfa
[    4.400000]  [<00008001>] free_pointer_table+0x101/0x240
[    4.400000]  [<00569562>] prepare_namespace+0x142/0x17c
[    4.400000]  [<00568f92>] kernel_init_freeable+0x1d2/0x1dc
[    4.400000]  [<0043ff80>] kernel_init+0x0/0x100
[    4.400000]  [<0043ff98>] kernel_init+0x18/0x100
[    4.400000]  [<0043ff80>] kernel_init+0x0/0x100
[    4.400000]  [<00002bf4>] ret_from_kernel_thread+0xc/0x14
[    4.400000] 
[    4.400000] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  3:40 ` Michael Schmitz
  2021-09-13  5:17   ` Michael Schmitz
  2021-09-13  5:17   ` Finn Thain
@ 2021-09-13  5:42   ` Mike Rapoport
  2021-09-13  5:49     ` Michael Schmitz
  2 siblings, 1 reply; 11+ messages in thread
From: Mike Rapoport @ 2021-09-13  5:42 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Finn Thain, linux-m68k

Hi Michael,

On Mon, Sep 13, 2021 at 03:40:12PM +1200, Michael Schmitz wrote:
> Hi Finn,
> 
> On 13/09/21 13:34, Finn Thain wrote:
> > 
> > This appears to work on Aranym, QEMU and the Quadra 630 I have here.
> > It is completely untested on Coldfire etc. I don't even know whether the
> > right memory mappings are in place for this to actually work as intended.
> 
> The comment just above the section from paging_init() in your patch states
> that all physical memory is mapped into kernel virtual address space. I
> don't think that mapping is contiguous though.

early_memtest() operates on physical ranges, so it does not matter what is
the virtual mapping.
 
> > Would someone take a look please?
> > 
> > diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> > index 6e40f7f29ebc..d87e12b4855b 100644
> > --- a/arch/m68k/Kconfig
> > +++ b/arch/m68k/Kconfig
> > @@ -9,6 +9,7 @@ config M68K
> >  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
> >  	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
> >  	select ARCH_NO_PREEMPT if !COLDFIRE
> > +	select ARCH_USE_MEMTEST
> >  	select ARCH_WANT_IPC_PARSE_VERSION
> >  	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
> >  	select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
> > diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
> > index 3a653f0a4188..d6301a094fc1 100644
> > --- a/arch/m68k/mm/motorola.c
> > +++ b/arch/m68k/mm/motorola.c
> > @@ -455,6 +455,8 @@ void __init paging_init(void)
> > 
> >  	flush_tlb_all();
> > 
> > +	early_memtest(min_addr, max_addr);
> > +
> >  	/*
> >  	 * initialize the bad page table and bad page to point
> >  	 * to a couple of allocated pages
> > 
> 
> I'd rather start that from availmem, not from min_addr ... I'm amazed this
> works - I'd expect the kernel text segment to get trashed by the memory test
> routines.

early_memtest() checks only free memory ranges, i.e. those that were not
memblock_reserve()d, so as long as we reserve the range [min_addr,
availmem] the memtest will skip it.

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  5:42   ` Mike Rapoport
@ 2021-09-13  5:49     ` Michael Schmitz
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-09-13  5:49 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Finn Thain, linux-m68k

Hi Mike,

thanks - from what I can see, the easiest way to fix the problem we see 
with memtest clobbering the ramdisk data then is to either move the 
memblock_reserve() for the ramdisk image into paging_init(), or else 
move early_memtest() into setup_mm.c:setup_arch().

(Tried excepting the ramdisk range in when calling early_memtest() from 
paging_init() but that requires exporting m68k_ramdisk, Geert might not 
be overly keen on that).

Cheers,

	Michael


On 13/09/21 17:42, Mike Rapoport wrote:
> Hi Michael,
>
> On Mon, Sep 13, 2021 at 03:40:12PM +1200, Michael Schmitz wrote:
>> Hi Finn,
>>
>> On 13/09/21 13:34, Finn Thain wrote:
>>>
>>> This appears to work on Aranym, QEMU and the Quadra 630 I have here.
>>> It is completely untested on Coldfire etc. I don't even know whether the
>>> right memory mappings are in place for this to actually work as intended.
>>
>> The comment just above the section from paging_init() in your patch states
>> that all physical memory is mapped into kernel virtual address space. I
>> don't think that mapping is contiguous though.
>
> early_memtest() operates on physical ranges, so it does not matter what is
> the virtual mapping.
>
>>> Would someone take a look please?
>>>
>>> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
>>> index 6e40f7f29ebc..d87e12b4855b 100644
>>> --- a/arch/m68k/Kconfig
>>> +++ b/arch/m68k/Kconfig
>>> @@ -9,6 +9,7 @@ config M68K
>>>  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
>>>  	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
>>>  	select ARCH_NO_PREEMPT if !COLDFIRE
>>> +	select ARCH_USE_MEMTEST
>>>  	select ARCH_WANT_IPC_PARSE_VERSION
>>>  	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
>>>  	select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
>>> diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
>>> index 3a653f0a4188..d6301a094fc1 100644
>>> --- a/arch/m68k/mm/motorola.c
>>> +++ b/arch/m68k/mm/motorola.c
>>> @@ -455,6 +455,8 @@ void __init paging_init(void)
>>>
>>>  	flush_tlb_all();
>>>
>>> +	early_memtest(min_addr, max_addr);
>>> +
>>>  	/*
>>>  	 * initialize the bad page table and bad page to point
>>>  	 * to a couple of allocated pages
>>>
>>
>> I'd rather start that from availmem, not from min_addr ... I'm amazed this
>> works - I'd expect the kernel text segment to get trashed by the memory test
>> routines.
>
> early_memtest() checks only free memory ranges, i.e. those that were not
> memblock_reserve()d, so as long as we reserve the range [min_addr,
> availmem] the memtest will skip it.
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  5:17   ` Finn Thain
@ 2021-09-13  5:51     ` Michael Schmitz
  2021-09-13  5:56     ` Mike Rapoport
  1 sibling, 0 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-09-13  5:51 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, Mike Rapoport

Hi Finn,

On 13/09/21 17:17, Finn Thain wrote:
> On Mon, 13 Sep 2021, Michael Schmitz wrote:
>
>>
>> I'm amazed this works - I'd expect the kernel text segment to get
>> trashed by the memory test routines.
>>
>
> I think the initramfs may get clobbered when the 'memtest' parameter is
> set. But that may be expected behaviour...

Looks like it got clobbered, but I don't think that is expected behaviour.

>
> [    0.000000] Linux version 5.14.0-multi-debug-00001-g3e3e2b0990a2 (fthain@nippy) (m68k-linux-gnu-gcc (btc) 6.4.0, GNU ld (btc) 2.28) #20 Mon Sep 13 15:08:56 AEST 2021
> [    0.000000] Saving 214 bytes of bootinfo
> [    0.000000] printk: console [debug0] enabled
> [    0.000000] printk: debug: ignoring loglevel setting.
> Blitter tried to read byte from register ff8a00 at 00816a
> [    0.000000] Atari hardware found: VIDEL STDMA-SCSI ST_MFP YM2149 PCM CODEC DSP56K SCC ANALOG_JOY BLITTER IDE TT_CLK FDC_SPEED
> [    0.000000] early_memtest: # of tests: 17
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 7a6c7258554e494c
> [    0.000000]   0x01000000 - 0x08600000 pattern 7a6c7258554e494c
> [    0.000000]   0x005b2000 - 0x00e00000 pattern eeeeeeeeeeeeeeee
> [    0.000000]   0x01000000 - 0x08600000 pattern eeeeeeeeeeeeeeee
> [    0.000000]   0x005b2000 - 0x00e00000 pattern dddddddddddddddd
> [    0.000000]   0x01000000 - 0x08600000 pattern dddddddddddddddd
> [    0.000000]   0x005b2000 - 0x00e00000 pattern bbbbbbbbbbbbbbbb
> [    0.000000]   0x01000000 - 0x08600000 pattern bbbbbbbbbbbbbbbb
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 7777777777777777
> [    0.000000]   0x01000000 - 0x08600000 pattern 7777777777777777
> [    0.000000]   0x005b2000 - 0x00e00000 pattern cccccccccccccccc
> [    0.000000]   0x01000000 - 0x08600000 pattern cccccccccccccccc
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 9999999999999999
> [    0.000000]   0x01000000 - 0x08600000 pattern 9999999999999999
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 6666666666666666
> [    0.000000]   0x01000000 - 0x08600000 pattern 6666666666666666
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 3333333333333333
> [    0.000000]   0x01000000 - 0x08600000 pattern 3333333333333333
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 8888888888888888
> [    0.000000]   0x01000000 - 0x08600000 pattern 8888888888888888
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 4444444444444444
> [    0.000000]   0x01000000 - 0x08600000 pattern 4444444444444444
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 2222222222222222
> [    0.000000]   0x01000000 - 0x08600000 pattern 2222222222222222
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 1111111111111111
> [    0.000000]   0x01000000 - 0x08600000 pattern 1111111111111111
> [    0.000000]   0x005b2000 - 0x00e00000 pattern aaaaaaaaaaaaaaaa
> [    0.000000]   0x01000000 - 0x08600000 pattern aaaaaaaaaaaaaaaa
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 5555555555555555
> [    0.000000]   0x01000000 - 0x08600000 pattern 5555555555555555
> [    0.000000]   0x005b2000 - 0x00e00000 pattern ffffffffffffffff
> [    0.000000]   0x01000000 - 0x08600000 pattern ffffffffffffffff
> [    0.000000]   0x005b2000 - 0x00e00000 pattern 0000000000000000
> [    0.000000]   0x01000000 - 0x08600000 pattern 0000000000000000
> [    0.000000] Zone ranges:
> [    0.000000]   DMA      [mem 0x0000000000000000-0x00000085ffffffff]
> [    0.000000]   Normal   empty
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x0000000000000000-0x0000000000dfffff]
> [    0.000000]   node   0: [mem 0x0000000001000000-0x00000000085fffff]
> [    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x00000000085fffff]
> [    0.000000] NatFeats found (ARAnyM, 1.0)
> [    0.000000] initrd: 0833ea00 - 08600000

The initrd got loaded at the end of the FastRAM chunk - we'd need that 
excluded from the memtest range.

Trouble is - I don't know whether that holds true for other m68k platforms.

But what Mike just explained (memtest skipping reserved areas of memory) 
provides a clean way to exclude the ramdisk area - move early_memtest() 
to setup_arch(), after the ramdisk area has been reserved.

Cheers,

	Michael


> [    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
> [    0.000000] pcpu-alloc: [0] 0
> [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 33490
> [    0.000000] Kernel command line: debug=par console=tty0 ignore_loglevel initcall_blacklist=ide_falcon_driver_init,nfhd_init memtest=17 BOOT_IMAGE=vmlinux
> [    0.000000] blacklisting initcall ide_falcon_driver_init
> [    0.000000] blacklisting initcall nfhd_init
> [    0.000000] Unknown command line parameters: initcall_blacklist=ide_falcon_driver_init BOOT_IMAGE=vmlinux
> [    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
> [    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
> [    0.000000] Sorting __ex_table...
> [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> [    0.000000] Memory: 124032K/135168K available (4385K kernel code, 357K rwdata, 772K rodata, 148K init, 121K bss, 11136K reserved, 0K cma-reserved)
> [    0.000000] SLUB: HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> [    0.000000] NR_IRQS: 200
> [    0.000000] clocksource: mfp: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 77769386670404 ns
> [    0.000000] Console: colour dummy device 80x25
> [    0.010000] printk: console [tty0] enabled
> [    0.010000] Calibrating delay loop... 140.69 BogoMIPS (lpj=703488)
> [    0.080000] pid_max: default: 32768 minimum: 301
> [    0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
> [    0.080000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
> [    0.090000] devtmpfs: initialized
> [    0.100000] random: get_random_u32 called from bucket_table_alloc+0x13e/0x180 with crng_init=0
> [    0.110000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
> [    0.110000] futex hash table entries: 256 (order: 0, 7168 bytes, linear)
> [    0.110000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
> [    0.110000] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
> [    0.120000] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
> [    0.160000] wait_for_initramfs() called before rootfs_initcalls
> [    0.170000] SCSI subsystem initialized
> [    0.170000] libata version 3.00 loaded.
> [    0.180000] clocksource: Switched to clocksource mfp
> [    0.230000] NET: Registered PF_INET protocol family
> [    0.240000] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
> [    0.240000] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 6144 bytes, linear)
> [    0.240000] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
> [    0.240000] TCP bind hash table entries: 2048 (order: 3, 40960 bytes, linear)
> [    0.250000] TCP: Hash tables configured (established 2048 bind 2048)
> [    0.250000] UDP hash table entries: 256 (order: 1, 12288 bytes, linear)
> [    0.250000] UDP-Lite hash table entries: 256 (order: 1, 12288 bytes, linear)
> [    0.250000] NET: Registered PF_UNIX/PF_LOCAL protocol family
> [    0.250000] RPC: Registered named UNIX socket transport module.
> [    0.250000] RPC: Registered udp transport module.
> [    0.250000] RPC: Registered tcp transport module.
> [    0.250000] RPC: Registered tcp NFSv4.1 backchannel transport module.
> [    0.260000] initcall nfhd_init blacklisted
> [    0.260000] Trying to unpack rootfs image as initramfs...
> [    0.960000] Freeing initrd memory: 2820K
> [    0.960000] nfeth: API 5
> [    0.960000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
> [    1.150000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
> [    1.150000] io scheduler mq-deadline registered
> [    1.160000] atafb atafb: phys_screen_base 6e6000 screen_len 311296
> [    1.160000] atafb atafb: Determined 640x480, depth 4
> [    1.160000] atafb atafb:    virtual 640x972
> [    1.170000] Console: switching to colour frame buffer device 80x30
> [    1.180000] fb0: frame buffer device, using 304K of video memory
> [    1.180000] pmac_zilog: 0.6 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)
> [    1.180000] Non-volatile memory driver v1.3
> [    1.210000] brd: module loaded
> [    1.500000] scsi host0: Atari native SCSI, irq 15, io_port 0x0, base 0x0, can_queue 1, cmd_per_lun 2, sg_tablesize 1, this_id 7, flags { }
> [    2.100000] random: fast init done
> [    3.290000] atari-falcon-ide atari-falcon-ide: Atari Falcon and Q40/Q60 PATA controller
> [    3.350000] scsi host1: pata_falcon
> [    3.360000] ata1: PATA max PIO4 cmd 0xfff00000 ctl 0xfff00038 no IRQ, using PIO polling
> [    3.410000] aoe: AoE v85 initialised.
> [    3.440000] mousedev: PS/2 mouse device common for all mice
> [    3.700000] input: Atari Keyboard as /devices/virtual/input/input0
> [    3.710000] ata1.00: NODEV after polling detection
> [    3.740000] ata1.01: ATA-2: slave, , max PIO2
> [    3.760000] ata1.01: 322560 sectors, multi 0: LBA
> [    3.770000] ata1.01: configured for PIO
> [    3.790000] scsi 1:0:1:0: Direct-Access     ATA      slave            n/a  PQ: 0 ANSI: 5
> [    3.850000] sd 1:0:1:0: Attached scsi generic sg0 type 0
> [    3.870000] sd 1:0:1:0: [sda] 322560 512-byte logical blocks: (165 MB/158 MiB)
> [    3.910000] sd 1:0:1:0: [sda] Write Protect is off
> [    3.920000] sd 1:0:1:0: [sda] Mode Sense: 00 3a 00 00
> [    3.940000] sd 1:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
> [    4.010000] sd 1:0:1:0: [sda] Attached SCSI disk
> [    4.060000] rtc-generic rtc-generic: registered as rtc0
> [    4.080000] NET: Registered PF_PACKET protocol family
> [    4.100000] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
> [    4.140000] Please append a correct "root=" boot option; here are the available partitions:
> [    4.190000] 0100            8192 ram0
> [    4.190000]  (driver?)
> [    4.230000] 0101            8192 ram1
> [    4.230000]  (driver?)
> [    4.270000] 0102            8192 ram2
> [    4.270000]  (driver?)
> [    4.310000] 0103            8192 ram3
> [    4.310000]  (driver?)
> [    4.350000] 0800          161280 sda
> [    4.350000]  driver: sd
> [    4.400000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
> [    4.400000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.14.0-multi-debug-00001-g3e3e2b0990a2 #20
> [    4.400000] Stack from 0102deac:
> [    4.400000]         0102deac 004da4cc 004da4cc 0102df00 0102dec8 0043e88e 004da4cc 0102dee8
> [    4.400000]         0043ce76 0102df28 00008001 005dc1d8 0043d0ec 01246000 00277e40 0102df48
> [    4.400000]         005692ac 004cc21e 0102df28 004cc1cd 004cc19a 00000000 0102df28 fffffffa
> [    4.400000]         00000000 0000000c 00002200 0004aa80 01018380 00585c98 00585c78 756e6b6e
> [    4.400000]         6f776e2d 626c6f63 6b28302c 302900c0 014162d0 0102df70 005693da 0102df70
> [    4.400000]         00569404 004cc282 00008001 0000007e 00000008 01018380 00585c98 00585c98
> [    4.400000] Call Trace: [<0043e88e>] dump_stack+0x10/0x16
> [    4.400000]  [<0043ce76>] panic+0xe6/0x2ea
> [    4.400000]  [<00008001>] free_pointer_table+0x101/0x240
> [    4.400000]  [<0043d0ec>] printk+0x0/0x16
> [    4.400000]  [<00277e40>] strlen+0x0/0x40
> [    4.400000]  [<005692ac>] mount_block_root+0x134/0x1ae
> [    4.400000]  [<00002200>] do_one_initcall+0x0/0x1c0
> [    4.400000]  [<0004aa80>] parse_args+0x0/0x2c0
> [    4.400000]  [<005693da>] mount_root+0xb4/0xfa
> [    4.400000]  [<00569404>] mount_root+0xde/0xfa
> [    4.400000]  [<00008001>] free_pointer_table+0x101/0x240
> [    4.400000]  [<00569562>] prepare_namespace+0x142/0x17c
> [    4.400000]  [<00568f92>] kernel_init_freeable+0x1d2/0x1dc
> [    4.400000]  [<0043ff80>] kernel_init+0x0/0x100
> [    4.400000]  [<0043ff98>] kernel_init+0x18/0x100
> [    4.400000]  [<0043ff80>] kernel_init+0x0/0x100
> [    4.400000]  [<00002bf4>] ret_from_kernel_thread+0xc/0x14
> [    4.400000]
> [    4.400000] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  5:17   ` Finn Thain
  2021-09-13  5:51     ` Michael Schmitz
@ 2021-09-13  5:56     ` Mike Rapoport
  2021-09-13  6:42       ` Mike Rapoport
                         ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Mike Rapoport @ 2021-09-13  5:56 UTC (permalink / raw)
  To: Finn Thain; +Cc: Michael Schmitz, linux-m68k

Hi Finn,

On Mon, Sep 13, 2021 at 03:17:33PM +1000, Finn Thain wrote:
> On Mon, 13 Sep 2021, Michael Schmitz wrote:
> 
> > 
> > I'm amazed this works - I'd expect the kernel text segment to get 
> > trashed by the memory test routines.
> 
> I think the initramfs may get clobbered when the 'memtest' parameter is 
> set. But that may be expected behaviour...

It's not the expected behaviour. The initramfs is clobbered because memtest
runs before initramfs memory is reserved. The patch below (not even compile
tested) should help. Now, for some reason the reservation of initrd does
not happen on SUN3, which is probably wrong, so maybe we can drop that 
#ifndef CONFIG_SUN3 before #ifdef CONFIG_BLK_DEV_INITRD.

diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 4b51bfd38e5f..4ca8f1120abc 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -338,12 +338,6 @@ void __init setup_arch(char **cmdline_p)
 		panic("No configuration setup");
 	}
 
-	paging_init();
-
-#ifdef CONFIG_NATFEAT
-	nf_init();
-#endif
-
 #ifndef CONFIG_SUN3
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (m68k_ramdisk.size) {
@@ -352,8 +346,16 @@ void __init setup_arch(char **cmdline_p)
 		initrd_end = initrd_start + m68k_ramdisk.size;
 		pr_info("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
 	}
+#endif
 #endif
 
+	paging_init();
+
+#ifdef CONFIG_NATFEAT
+	nf_init();
+#endif
+
+#ifndef CONFIG_SUN3
 #ifdef CONFIG_ATARI
 	if (MACH_IS_ATARI)
 		atari_stram_reserve_pages((void *)availmem);
 
-- 
Sincerely yours,
Mike.

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  5:56     ` Mike Rapoport
@ 2021-09-13  6:42       ` Mike Rapoport
  2021-09-13  6:53       ` Michael Schmitz
  2021-09-13  7:59       ` Finn Thain
  2 siblings, 0 replies; 11+ messages in thread
From: Mike Rapoport @ 2021-09-13  6:42 UTC (permalink / raw)
  To: Finn Thain; +Cc: Michael Schmitz, linux-m68k

On Mon, Sep 13, 2021 at 08:56:35AM +0300, Mike Rapoport wrote:
> Hi Finn,
> 
> On Mon, Sep 13, 2021 at 03:17:33PM +1000, Finn Thain wrote:
> > On Mon, 13 Sep 2021, Michael Schmitz wrote:
> > 
> > > 
> > > I'm amazed this works - I'd expect the kernel text segment to get 
> > > trashed by the memory test routines.
> > 
> > I think the initramfs may get clobbered when the 'memtest' parameter is 
> > set. But that may be expected behaviour...
> 
> It's not the expected behaviour. The initramfs is clobbered because memtest
> runs before initramfs memory is reserved. The patch below (not even compile
> tested) should help. Now, for some reason the reservation of initrd does
> not happen on SUN3, which is probably wrong, so maybe we can drop that 
> #ifndef CONFIG_SUN3 before #ifdef CONFIG_BLK_DEV_INITRD.

BTW, for the short time I've been a bit involved in m68k I've spotted quite
a few things that seem broken on SUN3. Does anybody still run recent
kernels on it? I really doubt they boot on SUN3...

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  5:56     ` Mike Rapoport
  2021-09-13  6:42       ` Mike Rapoport
@ 2021-09-13  6:53       ` Michael Schmitz
  2021-09-13  7:59       ` Finn Thain
  2 siblings, 0 replies; 11+ messages in thread
From: Michael Schmitz @ 2021-09-13  6:53 UTC (permalink / raw)
  To: Mike Rapoport, Finn Thain; +Cc: linux-m68k

Hi Mike,

tested and found to work as intended.

Cheers,

	Michael

On 13/09/21 17:56, Mike Rapoport wrote:
> Hi Finn,
>
> On Mon, Sep 13, 2021 at 03:17:33PM +1000, Finn Thain wrote:
>> On Mon, 13 Sep 2021, Michael Schmitz wrote:
>>
>>>
>>> I'm amazed this works - I'd expect the kernel text segment to get
>>> trashed by the memory test routines.
>>
>> I think the initramfs may get clobbered when the 'memtest' parameter is
>> set. But that may be expected behaviour...
>
> It's not the expected behaviour. The initramfs is clobbered because memtest
> runs before initramfs memory is reserved. The patch below (not even compile
> tested) should help. Now, for some reason the reservation of initrd does
> not happen on SUN3, which is probably wrong, so maybe we can drop that
> #ifndef CONFIG_SUN3 before #ifdef CONFIG_BLK_DEV_INITRD.
>
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index 4b51bfd38e5f..4ca8f1120abc 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -338,12 +338,6 @@ void __init setup_arch(char **cmdline_p)
>  		panic("No configuration setup");
>  	}
>
> -	paging_init();
> -
> -#ifdef CONFIG_NATFEAT
> -	nf_init();
> -#endif
> -
>  #ifndef CONFIG_SUN3
>  #ifdef CONFIG_BLK_DEV_INITRD
>  	if (m68k_ramdisk.size) {
> @@ -352,8 +346,16 @@ void __init setup_arch(char **cmdline_p)
>  		initrd_end = initrd_start + m68k_ramdisk.size;
>  		pr_info("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
>  	}
> +#endif
>  #endif
>
> +	paging_init();
> +
> +#ifdef CONFIG_NATFEAT
> +	nf_init();
> +#endif
> +
> +#ifndef CONFIG_SUN3
>  #ifdef CONFIG_ATARI
>  	if (MACH_IS_ATARI)
>  		atari_stram_reserve_pages((void *)availmem);
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] m68k: Enable memtest kernel parameter
  2021-09-13  5:56     ` Mike Rapoport
  2021-09-13  6:42       ` Mike Rapoport
  2021-09-13  6:53       ` Michael Schmitz
@ 2021-09-13  7:59       ` Finn Thain
  2 siblings, 0 replies; 11+ messages in thread
From: Finn Thain @ 2021-09-13  7:59 UTC (permalink / raw)
  To: Mike Rapoport, Sam Creasey; +Cc: Michael Schmitz, linux-m68k

On Mon, 13 Sep 2021, Mike Rapoport wrote:

> On Mon, Sep 13, 2021 at 03:17:33PM +1000, Finn Thain wrote:
> > On Mon, 13 Sep 2021, Michael Schmitz wrote:
> > 
> > > 
> > > I'm amazed this works - I'd expect the kernel text segment to get 
> > > trashed by the memory test routines.
> > 
> > I think the initramfs may get clobbered when the 'memtest' parameter 
> > is set. But that may be expected behaviour...
> 
> It's not the expected behaviour. The initramfs is clobbered because 
> memtest runs before initramfs memory is reserved. The patch below (not 
> even compile tested) should help.

Thanks, Mike.

> Now, for some reason the reservation of initrd does not happen on SUN3, 
> which is probably wrong, so maybe we can drop that #ifndef CONFIG_SUN3 
> before #ifdef CONFIG_BLK_DEV_INITRD.
> 
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index 4b51bfd38e5f..4ca8f1120abc 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -338,12 +338,6 @@ void __init setup_arch(char **cmdline_p)
>  		panic("No configuration setup");
>  	}
>  
> -	paging_init();
> -
> -#ifdef CONFIG_NATFEAT
> -	nf_init();
> -#endif
> -
>  #ifndef CONFIG_SUN3
>  #ifdef CONFIG_BLK_DEV_INITRD
>  	if (m68k_ramdisk.size) {

The only reason I can think of for eliding this code (already conditional 
on m68k_ramdisk.size and CONFIG_BLK_DEV_INITRD) would be to work around a 
bootloader or firmware bug on Sun 3. 

Sam?

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-09-13  8:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  1:34 [RFC] m68k: Enable memtest kernel parameter Finn Thain
2021-09-13  3:40 ` Michael Schmitz
2021-09-13  5:17   ` Michael Schmitz
2021-09-13  5:17   ` Finn Thain
2021-09-13  5:51     ` Michael Schmitz
2021-09-13  5:56     ` Mike Rapoport
2021-09-13  6:42       ` Mike Rapoport
2021-09-13  6:53       ` Michael Schmitz
2021-09-13  7:59       ` Finn Thain
2021-09-13  5:42   ` Mike Rapoport
2021-09-13  5:49     ` Michael Schmitz

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).