vivier / qemu-m68k

Other
41 stars 7 forks source link

Linux kernel boot fails when trying to use more than 1000MB of memory (i.e. 1024MB) #42

Closed baryluk closed 4 years ago

baryluk commented 5 years ago

-m 1000M works. -m 1024M doesn't.

-m 1015M works. -m 1016M doesn't.

I guess it is either not supported completly due to architecture limitations, or some memory is mapped incorrectly.

One option is to fix it, another (if it is arch issue), to refuse to start if the memory requrested is too big, or something.

-m 1281M refuses to start:

qemu-system-m68k: /home/user/qemu-m68k/exec.c:1496: phys_section_add:
   Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed.
Aborted

-m 1280M does start but crashes.

However, with -m 1200M, it does work:

[    0.000000] Memory: 1201636K/1228800K available (3026K kernel code, 396K rwdata,
  856K rodata, 160K init, 203K bss, 27164K reserved, 0K cma-reserved)

and no crashes.

Tested with Linux 5.3.0-1 and Linux 4.19.0

Here are runs with -m 1024M, which are similar to runs with -m 1280M.

Linux 5.3.0-1:

user@debian:~/qemu-m68k/system$ /usr/local/bin/qemu-system-m68k -M q800 -serial mon:stdio -m 1024M -drive file=m68k-system.img,format=qcow2 -drive file=m68k-swap.img,format=qcow2 -net nic,model=dp83932,addr=08:00:07:12:34:89 -net user -nographic -append "root=/dev/sda2 rw console=ttyS0" -cdrom debian-10.0-m68k-NETINST-1.iso -kernel vmlinux-5.3.0-1-m68k -initrd initrd.img-5.3.0-1-m68k 
89 -net user -nographic -append "root=/dev/sda2 rw console=ttyS0" -cdrom debian-10.0-m68k-NETINST-1.iso -kernel
ABCFGHIJK
[    0.000000] Linux version 5.3.0-1-m68k (debian-kernel@lists.debian.org) (gcc version 9.2.1 20191016 (Debian 9.2.1-11)) #1 Debian 5.3.7-1 (2019-10-19)
[    0.000000] Detected Macintosh model: 35
[    0.000000] Apple Macintosh Quadra 800
[    0.000000] initrd: 3f854000 - 3ffff891
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 259584
[    0.000000] Kernel command line: root=/dev/sda2 rw console=ttyS0
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 1024088K/1048576K available (3026K kernel code, 396K rwdata, 856K rodata, 160K init, 203K bss, 24488K reserved, 0K cma-reserved)
[    0.000000] random: get_random_u32 called from __kmem_cache_create+0x2c/0x45a with crng_init=0
[    0.000000] SLUB: HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=8
[    0.000000] NR_IRQS: 200
[    0.000000] clocksource: via1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 2439823894983 ns
[    0.010000] Console: colour dummy device 80x25
[    0.010000] printk: console [ttyS0] enabled
[    0.010000] Calibrating delay loop... 858.52 BogoMIPS (lpj=4292608)
[    0.470000] pid_max: default: 32768 minimum: 301
[    0.470000] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.470000] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.490000] devtmpfs: initialized
[    0.500000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.500000] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.500000] NET: Registered protocol family 16
[    0.530000] NuBus: Scanning NuBus slots.
[    0.530000] Slot 9: Board resource not found!
[    0.530000] SCSI subsystem initialized
[    0.540000] clocksource: Switched to clocksource via1
[    0.540000] VFS: Disk quotas dquot_6.6.0
[    0.540000] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.550000] NET: Registered protocol family 2
[    0.560000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.560000] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.560000] TCP bind hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.560000] TCP: Hash tables configured (established 8192 bind 8192)
[    0.560000] UDP hash table entries: 512 (order: 1, 8192 bytes, linear)
[    0.560000] UDP-Lite hash table entries: 512 (order: 1, 8192 bytes, linear)
[    0.560000] NET: Registered protocol family 1
[    0.560000] NET: Registered protocol family 44
[    0.570000] Trying to unpack rootfs image as initramfs...
[    1.050000] Freeing initrd memory: 7852K
[    1.060000] Key type blacklist registered
[    1.060000] workingset: timestamp_bits=11 max_order=18 bucket_order=7
[    1.070000] zbud: loaded
[    1.070000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.070000] io scheduler mq-deadline registered
[    1.080000] macfb: framebuffer at 0xf9001000, mapped to 0x(ptrval), size 468k
[    1.080000] macfb: mode is 800x600x8, linelength=800
[    1.080000] Console: switching to colour frame buffer device 100x37
[    1.090000] fb0: DAFB frame buffer device
[    1.090000] pmac_zilog: 0.6 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)
[    1.090000] scc.0: ttyS0 at MMIO 0x5000c022 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
[    1.090000] scc.1: ttyS1 at MMIO 0x5000c020 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
[    1.090000] Non-volatile memory driver v1.3
[    1.090000] adb: Mac II ADB Driver v1.0 for Unified ADB
[    1.090000] mousedev: PS/2 mouse device common for all mice
[    1.100000] Detected ADB keyboard, type <unknown>.
[    1.100000] input: ADB keyboard as /devices/virtual/input/input0
[    1.110000] random: fast init done
[    1.110000] input: ADB mouse as /devices/virtual/input/input1
[    1.110000] rtc-generic rtc-generic: registered as rtc0
[    1.110000] ledtrig-cpu: registered to indicate activity on CPUs
[    1.110000] NET: Registered protocol family 17
[    1.110000] mpls_gso: MPLS GSO support
[    1.110000] registered taskstats version 1
[    1.110000] zswap: loaded using pool lzo/zbud
[    1.110000] rtc-generic rtc-generic: setting system clock to 2019-10-25T14:13:05 UTC (1572012785)
[    1.120000] ------------[ cut here ]------------
[    1.120000] WARNING: CPU: 0 PID: 1 at mm/vmalloc.c:153 vmap_page_range_noflush+0xea/0x19a
[    1.120000] Modules linked in:
[    1.120000] CPU: 0 PID: 1 Comm: swapper Not tainted 5.3.0-1-m68k #1 Debian 5.3.7-1
[    1.120000] Stack from 3f45fc1c:
[    1.120000]         3f45fc1c 0037ead8 0002ce06 40800000 40803000 003feb30 40803000 00000000
[    1.120000]         00001680 00001084 0002ce2e 003823d9 00000099 000c5474 00000009 00000000
[    1.120000]         00000000 003769c6 000c5474 003823d9 00000099 3e3b0920 00000dc0 00002dc2
[    1.120000]         ffffffff 00000400 00000003 40800000 000ca51c 002f1cd6 00000000 40802fff
[    1.120000]         000c5544 40800000 40803000 00000039 3e3b0920 000c5590 40800000 40803000
[    1.120000]         00000039 3e3b0920 3e257a20 000c6ef8 3e257a20 00000039 3e3b0920 3e3dd000
[    1.120000] Call Trace: [<0002ce06>] __warn+0xc0/0xc2
[    1.120000]  [<00001680>] kernel_pg_dir+0x680/0x1000
[    1.120000]  [<00001084>] kernel_pg_dir+0x84/0x1000
[    1.120000]  [<0002ce2e>] warn_slowpath_null+0x26/0x2c
[    1.120000]  [<000c5474>] vmap_page_range_noflush+0xea/0x19a
[    1.120000]  [<000c5474>] vmap_page_range_noflush+0xea/0x19a
[    1.120000]  [<00002dc2>] module_finalize+0x16/0x1c
[    1.120000]  [<000ca51c>] __alloc_pages_nodemask+0x0/0x862
[    1.120000]  [<002f1cd6>] _cond_resched+0x0/0x2a
[    1.120000]  [<000c5544>] vmap_page_range+0x14/0x34
[    1.120000]  [<000c5590>] map_vm_area+0x2c/0x3a
[    1.120000]  [<000c6ef8>] __vmalloc_node_range+0xfe/0x1ca
[    1.120000]  [<002f1b48>] schedule+0x0/0x86
[    1.120000]  [<001c9b3c>] tty_free_file+0x0/0x16
[    1.120000]  [<001c9aec>] tty_add_file+0x0/0x50
[    1.120000]  [<001cedc6>] tty_ldisc_open.isra.0+0x0/0x50
[    1.120000]  [<000c70d6>] __vmalloc_node.constprop.0+0x3a/0x42
[    1.120000]  [<0000226e>] try_to_run_init_process+0x14/0x36
[    1.120000]  [<001cc2ea>] n_tty_open+0x12/0x7e
[    1.120000]  [<000c71aa>] vzalloc+0x1c/0x24
[    1.120000]  [<0000226e>] try_to_run_init_process+0x14/0x36
[    1.120000]  [<001cc2ea>] n_tty_open+0x12/0x7e
[    1.120000]  [<001cc2ea>] n_tty_open+0x12/0x7e
[    1.120000]  [<0000226e>] try_to_run_init_process+0x14/0x36
[    1.120000]  [<001cedc6>] tty_ldisc_open.isra.0+0x0/0x50
[    1.120000]  [<001cee02>] tty_ldisc_open.isra.0+0x3c/0x50
[    1.120000]  [<001cf3a4>] tty_ldisc_setup+0x18/0x44
[    1.120000]  [<002f2cb4>] mutex_unlock+0x0/0x2a
[    1.120000]  [<001cb08c>] tty_init_dev+0xfa/0x17a
[    1.120000]  [<001cb3c2>] tty_open+0x2b6/0x2c8
[    1.120000]  [<000e840a>] cdev_put+0x0/0x28
[    1.120000]  [<000e8546>] chrdev_open+0x114/0x120
[    1.120000]  [<000e8432>] chrdev_open+0x0/0x120
[    1.120000]  [<000e1f70>] do_dentry_open+0x270/0x2b6
[    1.130000]  [<000e2bc4>] vfs_open+0x26/0x2c
[    1.130000]  [<000f0dd6>] path_openat+0xa2a/0xb34
[    1.130000]  [<00002096>] do_one_initcall+0x0/0x184
[    1.130000]  [<000f03ac>] path_openat+0x0/0xb34
[    1.130000]  [<001ea7ce>] dev_printk_emit+0x1a/0x22
[    1.130000]  [<000f0f12>] do_filp_open+0x32/0x76
[    1.130000]  [<000fa188>] __alloc_fd+0xdc/0x23a
[    1.130000]  [<00002096>] do_one_initcall+0x0/0x184
[    1.130000]  [<000fa300>] get_unused_fd_flags+0x1a/0x20
[    1.130000]  [<000e2e8e>] do_sys_open+0x11c/0x1a4
[    1.130000]  [<0003fde8>] parse_args+0x0/0x2c8
[    1.130000]  [<00002096>] do_one_initcall+0x0/0x184
[    1.130000]  [<00020000>] _FP_CALL_TOP+0x8f66/0xd512
[    1.130000]  [<002eade2>] strcpy+0x0/0x1c
[    1.130000]  [<004340c6>] kernel_init_freeable+0x10e/0x18c
[    1.130000]  [<002f0c8a>] kernel_init+0x0/0xd2
[    1.130000]  [<002f0c92>] kernel_init+0x8/0xd2
[    1.130000]  [<002f0c8a>] kernel_init+0x0/0xd2
[    1.130000]  [<00002934>] ret_from_kernel_thread+0xc/0x14
[    1.130000] ---[ end trace a29e3786ea8b1630 ]---
[    1.130000] swapper: vmalloc: allocation failure, allocated 12288 of 16384 bytes, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), nodemask=(null)
[    1.130000] CPU: 0 PID: 1 Comm: swapper Tainted: G        W         5.3.0-1-m68k #1 Debian 5.3.7-1
[    1.130000] Stack from 3f45fc90:
[    1.130000]         3f45fc90 0037ead8 000ca430 0000000c 00000dc0 00002dc2 3e257a20 000ca51c
[    1.130000]         3f45fcd0 00382511 3f45fcb0 00000000 000c6f82 00000dc0 00000000 00382511
[    1.130000]         00003000 00004000 3e3dd000 00000000 002f1b48 00000002 001c9b3c 001c9aec
[    1.130000]         3e3dd11a 3e3dd000 001cedc6 000c70d6 0000226e 00000001 40800000 d0000000
[    1.130000]         00000dc0 00000039 00000000 ffffffff 001cc2ea 000c71aa 0000226e 00000dc0
[    1.130000]         00000039 ffffffff 001cc2ea 001cc2ea 0000226e 3e3dd11a 00000000 001cedc6
[    1.130000] Call Trace: [<000ca430>] warn_alloc+0x88/0x10e
[    1.130000]  [<00002dc2>] module_finalize+0x16/0x1c
[    1.130000]  [<000ca51c>] __alloc_pages_nodemask+0x0/0x862
[    1.130000]  [<000c6f82>] __vmalloc_node_range+0x188/0x1ca
[    1.130000]  [<00003000>] copy_thread+0x8c/0xee
[    1.130000]  [<00004000>] setup_rt_frame+0x402/0x4f2
[    1.130000]  [<002f1b48>] schedule+0x0/0x86
[    1.130000]  [<001c9b3c>] tty_free_file+0x0/0x16
[    1.130000]  [<001c9aec>] tty_add_file+0x0/0x50
[    1.130000]  [<001cedc6>] tty_ldisc_open.isra.0+0x0/0x50
[    1.130000]  [<000c70d6>] __vmalloc_node.constprop.0+0x3a/0x42
[    1.130000]  [<0000226e>] try_to_run_init_process+0x14/0x36
[    1.130000]  [<001cc2ea>] n_tty_open+0x12/0x7e
[    1.130000]  [<000c71aa>] vzalloc+0x1c/0x24
[    1.130000]  [<0000226e>] try_to_run_init_process+0x14/0x36
[    1.130000]  [<001cc2ea>] n_tty_open+0x12/0x7e
[    1.130000]  [<001cc2ea>] n_tty_open+0x12/0x7e
[    1.130000]  [<0000226e>] try_to_run_init_process+0x14/0x36
[    1.130000]  [<001cedc6>] tty_ldisc_open.isra.0+0x0/0x50
[    1.130000]  [<001cee02>] tty_ldisc_open.isra.0+0x3c/0x50
[    1.130000]  [<001cf3a4>] tty_ldisc_setup+0x18/0x44
[    1.130000]  [<002f2cb4>] mutex_unlock+0x0/0x2a
[    1.130000]  [<001cb08c>] tty_init_dev+0xfa/0x17a
[    1.130000]  [<001cb3c2>] tty_open+0x2b6/0x2c8
[    1.130000]  [<000e840a>] cdev_put+0x0/0x28
[    1.130000]  [<000e8546>] chrdev_open+0x114/0x120
[    1.140000]  [<000e8432>] chrdev_open+0x0/0x120
[    1.140000]  [<000e1f70>] do_dentry_open+0x270/0x2b6
[    1.140000]  [<000e2bc4>] vfs_open+0x26/0x2c
[    1.140000]  [<000f0dd6>] path_openat+0xa2a/0xb34
[    1.140000]  [<00002096>] do_one_initcall+0x0/0x184
[    1.140000]  [<000f03ac>] path_openat+0x0/0xb34
[    1.140000]  [<001ea7ce>] dev_printk_emit+0x1a/0x22
[    1.140000]  [<000f0f12>] do_filp_open+0x32/0x76
[    1.140000]  [<000fa188>] __alloc_fd+0xdc/0x23a
[    1.140000]  [<00002096>] do_one_initcall+0x0/0x184
[    1.140000]  [<000fa300>] get_unused_fd_flags+0x1a/0x20
[    1.140000]  [<000e2e8e>] do_sys_open+0x11c/0x1a4
[    1.140000]  [<0003fde8>] parse_args+0x0/0x2c8
[    1.140000]  [<00002096>] do_one_initcall+0x0/0x184
[    1.140000]  [<00020000>] _FP_CALL_TOP+0x8f66/0xd512
[    1.140000]  [<002eade2>] strcpy+0x0/0x1c
[    1.140000]  [<004340c6>] kernel_init_freeable+0x10e/0x18c
[    1.140000]  [<002f0c8a>] kernel_init+0x0/0xd2
[    1.140000]  [<002f0c92>] kernel_init+0x8/0xd2
[    1.140000]  [<002f0c8a>] kernel_init+0x0/0xd2
[    1.140000]  [<00002934>] ret_from_kernel_thread+0xc/0x14
[    1.140000] Mem-Info:
[    1.140000] active_anon:0 inactive_anon:0 isolated_anon:0
[    1.140000]  active_file:0 inactive_file:0 isolated_file:0
[    1.140000]  unevictable:4725 dirty:0 writeback:0 unstable:0
[    1.140000]  slab_reclaimable:106 slab_unreclaimable:295
[    1.140000]  mapped:0 shmem:0 pagetables:0 bounce:0
[    1.140000]  free:252275 free_pcp:465 free_cma:0
[    1.140000] Node 0 active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:18900kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
[    1.140000] DMA free:1009100kB min:4044kB low:5068kB high:6092kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:18900kB writepending:0kB present:1048576kB managed:1031940kB mlocked:0kB kernel_stack:184kB pagetables:0kB bounce:0kB free_pcp:1860kB local_pcp:1860kB free_cma:0kB
[    1.140000] lowmem_reserve[]: 0 0 0
[    1.140000] DMA: 3*4kB (UM) 4*8kB (UME) 2*16kB (ME) 2*32kB (UE) 1*64kB (E) 0*128kB 3*256kB (UME) 3*512kB (UM) 3*1024kB (UME) 4*2048kB (UME) 243*4096kB (M) = 1009100kB
[    1.140000] 4736 total pagecache pages
[    1.140000] 0 pages in swap cache
[    1.140000] Swap cache stats: add 0, delete 0, find 0/0
[    1.140000] Free swap  = 0kB
[    1.140000] Total swap = 0kB
[    1.140000] 262144 pages RAM
[    1.140000] 0 pages HighMem/MovableOnly
[    1.140000] 4159 pages reserved
[    1.140000] ttyS ttyS0: ldisc open failed (-12), clearing slot 0
[    1.140000] Warning: unable to open an initial console.
[    1.140000] Freeing unused kernel memory: 160K
[    1.140000] This architecture does not have kernel memory protection.
[    1.140000] Run /init as init process
[    1.410000] systemd-udevd[71]: Starting version 242
[    1.420000] systemd-udevd[71]: Assertion 'close_nointr(fd) != -EBADF' failed at ../src/basic/fd-util.c:71, function safe_close(). Aborting.
[    1.450000] systemd-udevd[72]: Failed to start device monitor: Operation not permitted
[    1.450000] systemd-udevd[72]: Assertion 'close_nointr(fd) != -EBADF' failed at ../src/basic/fd-util.c:71, function safe_close(). Aborting.
...
(after few seconds kernel starts outputing trillions of faults)
....

Linux 4.19.0:

user@debian:~/qemu-m68k/system$ /usr/local/bin/qemu-system-m68k -M q800 -serial none -serial mon:stdio -m 1024M -drive file=m68k-system.img,format=qcow2 -drive file=m68k-swap.img,format=qcow2 -net nic,model=dp83932,addr=08:00:07:12:34:89 -net user -nographic -append "root=/dev/ram rw console=ttyS0" -cdrom debian-10.0-m68k-NETINST-1.iso -kernel vmlinux-4.19.0-5-m68k -initrd initrd.gz

ABCFGHIJK
[    0.000000] Linux version 4.19.0-5-m68k (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-7)) #1 Debian 4.19.37-5 (2019-06-19)
[    0.000000] Detected Macintosh model: 35
[    0.000000] Apple Macintosh Quadra 800
[    0.000000] initrd: 3f74f000 - 3ffff5b3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 259584
[    0.000000] Kernel command line: root=/dev/ram rw console=ttyS0
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 1023056K/1048576K available (2870K kernel code, 399K rwdata, 1004K rodata, 156K init, 202K bss, 25520K reserved, 0K cma-reserved)
[    0.000000] random: get_random_u32 called from __kmem_cache_create+0x2c/0x498 with crng_init=0
[    0.000000] SLUB: HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=8
[    0.000000] NR_IRQS: 200
[    0.000000] Console: colour dummy device 80x25
[    0.000000] console [ttyS0] enabled
[    0.140000] Calibrating delay loop... 858.52 BogoMIPS (lpj=4292608)
[    0.150000] pid_max: default: 32768 minimum: 301
[    0.150000] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.150000] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.170000] devtmpfs: initialized
[    0.180000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.180000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.180000] NET: Registered protocol family 16
[    0.190000] NuBus: Scanning NuBus slots.
[    0.190000] Slot 9: Board resource not found!
[    0.200000] SCSI subsystem initialized
[    0.200000] VFS: Disk quotas dquot_6.6.0
[    0.200000] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.220000] NET: Registered protocol family 2
[    0.220000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.220000] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.220000] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[    0.220000] TCP: Hash tables configured (established 8192 bind 8192)
[    0.220000] UDP hash table entries: 512 (order: 1, 8192 bytes)
[    0.220000] UDP-Lite hash table entries: 512 (order: 1, 8192 bytes)
[    0.220000] NET: Registered protocol family 1
[    0.220000] NET: Registered protocol family 44
[    0.230000] Unpacking initramfs...
[    0.710000] Freeing initrd memory: 8896K
[    0.710000] Key type blacklist registered
[    0.710000] workingset: timestamp_bits=11 max_order=18 bucket_order=7
[    0.720000] zbud: loaded
[    1.600000] ------------[ cut here ]------------
[    1.600000] WARNING: CPU: 0 PID: 29 at mm/vmalloc.c:150 vmap_page_range_noflush+0xea/0x19c
[    1.600000] Modules linked in:
[    1.600000] CPU: 0 PID: 29 Comm: cryptomgr_test Not tainted 4.19.0-5-m68k #1 Debian 4.19.37-5
[    1.600000] Stack from 3d53dc7c:
[    1.600000]         3d53dc7c 003a387a 0002c46e 40800000 40820000 003fdb24 40820000 00000000
[    1.600000]         00001680 00001084 0002c496 003766de 00000096 000be2ce 00000009 00000000
[    1.600000]         00000000 0036bb5a 000be2ce 003766de 00000096 3f0b8880 006000c0 00000020
[    1.600000]         006002c2 00000000 00200000 40800000 0009a832 002caf86 0004b650 4081ffff
[    1.600000]         000be3a0 40800000 40820000 00000039 3f0b8880 000be3ec 40800000 40820000
[    1.600000]         00000039 3f0b8880 3e9bdf80 000bf1fe 3e9bdf80 00000039 3f0b8880 3d516800
[    1.600000] Call Trace: [<0002c46e>] __warn+0xc0/0xc2
[    1.600000]  [<00001680>] kernel_pg_dir+0x680/0x1000
[    1.600000]  [<00001084>] kernel_pg_dir+0x84/0x1000
[    1.600000]  [<0002c496>] warn_slowpath_null+0x26/0x2c
[    1.600000]  [<000be2ce>] vmap_page_range_noflush+0xea/0x19c
[    1.600000]  [<000be2ce>] vmap_page_range_noflush+0xea/0x19c
[    1.600000]  [<00200000>] input_default_getkeycode+0x6/0x70
[    1.600000]  [<0009a832>] __alloc_pages_nodemask+0x0/0x7ea
[    1.600000]  [<002caf86>] _cond_resched+0x0/0x2a
[    1.600000]  [<0004b650>] complete+0x0/0x34
[    1.600000]  [<000be3a0>] vmap_page_range+0x14/0x34
[    1.600000]  [<000be3ec>] map_vm_area+0x2c/0x3a
[    1.600000]  [<000bf1fe>] __vmalloc_node_range+0xf8/0x1c0
[    1.600000]  [<000bf300>] __vmalloc_node+0x3a/0x42
[    1.600000]  [<00020000>] _FP_CALL_TOP+0x954a/0xd512
[    1.600000]  [<0014d63e>] crypto_scomp_alloc_scratches+0x26/0x42
[    1.610000]  [<000bf410>] vmalloc_node+0x22/0x2a
[    1.610000]  [<00020000>] _FP_CALL_TOP+0x954a/0xd512
[    1.610000]  [<0014d63e>] crypto_scomp_alloc_scratches+0x26/0x42
[    1.610000]  [<0014d63e>] crypto_scomp_alloc_scratches+0x26/0x42
[    1.610000]  [<00020000>] _FP_CALL_TOP+0x954a/0xd512
[    1.610000]  [<0014d618>] crypto_scomp_alloc_scratches+0x0/0x42
[    1.610000]  [<0014d69e>] crypto_scomp_init_tfm+0x44/0x6c
[    1.610000]  [<00146aa4>] crypto_create_tfm+0x3e/0x8e
[    1.610000]  [<0014d6ee>] crypto_init_scomp_ops_async+0x28/0x76
[    1.610000]  [<00146aa4>] crypto_create_tfm+0x3e/0x8e
[    1.610000]  [<00147000>] crypto_find_alg+0x0/0x3a
[    1.610000]  [<00146a66>] crypto_create_tfm+0x0/0x8e
[    1.610000]  [<001468e0>] crypto_mod_put+0x0/0x2e
[    1.610000]  [<001470a0>] crypto_alloc_tfm+0x66/0x78
[    1.610000]  [<0014db80>] alg_find_test+0x0/0x50
[    1.610000]  [<0002daba>] do_exit+0x0/0x808
[    1.610000]  [<0014d140>] crypto_alloc_acomp+0x18/0x20
[    1.610000]  [<0015063a>] alg_test_comp+0x30/0x700
[    1.610000]  [<0014db80>] alg_find_test+0x0/0x50
[    1.610000]  [<0002daba>] do_exit+0x0/0x808
[    1.610000]  [<0004b650>] complete+0x0/0x34
[    1.610000]  [<00047a00>] enqueue_entity+0x0/0x370
[    1.610000]  [<00046762>] __enqueue_entity+0x3c/0x6a
[    1.610000]  [<00047c3c>] enqueue_entity+0x23c/0x370
[    1.610000]  [<00002704>] calibrate_delay+0xbe/0x18a
[    1.610000]  [<00002704>] calibrate_delay+0xbe/0x18a
[    1.610000]  [<002c04c6>] rb_erase_cached+0x28/0x2e6
[    1.610000]  [<001504a6>] alg_test.part.1+0x1de/0x206
[    1.610000]  [<0004ab6c>] __init_waitqueue_head+0x0/0xc
[    1.610000]  [<0014db34>] cryptomgr_test+0x0/0x48
[    1.610000]  [<0002daba>] do_exit+0x0/0x808
[    1.610000]  [<0004b650>] complete+0x0/0x34
[    1.610000]  [<000479c8>] pick_next_task_fair+0xf8/0x130
[    1.610000]  [<0004ab6c>] __init_waitqueue_head+0x0/0xc
[    1.610000]  [<0014db34>] cryptomgr_test+0x0/0x48
[    1.610000]  [<002cac2a>] __schedule+0x272/0x464
[    1.610000]  [<0004ab6c>] __init_waitqueue_head+0x0/0xc
[    1.610000]  [<0014db34>] cryptomgr_test+0x0/0x48
[    1.610000]  [<002ca9b8>] __schedule+0x0/0x464
[    1.610000]  [<0002daba>] do_exit+0x0/0x808
[    1.610000]  [<002cae68>] schedule+0x4c/0x68
[    1.610000]  [<0014db56>] cryptomgr_test+0x22/0x48
[    1.610000]  [<0003f446>] kthread+0xdc/0xe6
[    1.610000]  [<0003f36a>] kthread+0x0/0xe6
[    1.610000]  [<000028a0>] ret_from_kernel_thread+0xc/0x14
[    1.610000] ---[ end trace 1c2fe94225ffa29c ]---
[    1.610000] cryptomgr_test: vmalloc: allocation failure, allocated 131072 of 135168 bytes, mode:0x6000c0(GFP_KERNEL), nodemask=(null)
[    1.610000] CPU: 0 PID: 29 Comm: cryptomgr_test Tainted: G        W         4.19.0-5-m68k #1 Debian 4.19.37-5
[    1.610000] Stack from 3d53dcd8:
[    1.610000]         3d53dcd8 003a387a 0009a74c 003741b8 3f063194 3d53dd14 006000c0 3d53dd24
[    1.610000]         00000000 00000000 3f0b8880 006000c0 00000020 3e9bdf80 3d53dd30 00376816
[    1.610000]         3d53dd10 0004b650 000bf282 006000c0 00000000 00376816 00020000 00021000
[    1.610000]         3d516800 3f0b5740 002ddfe8 00000400 ffffffff 00000081 00f75a8c 003e90d0
[    1.610000]         002de014 000bf300 00020000 00000001 40800000 d0000000 006000c0 00000039
[    1.610000]         00000000 00000000 0014d63e 000bf410 00020000 00000001 006000c0 00000039
[    1.610000] Call Trace: [<0009a74c>] warn_alloc+0x7a/0xfa
[    1.610000]  [<0004b650>] complete+0x0/0x34
[    1.610000]  [<000bf282>] __vmalloc_node_range+0x17c/0x1c0
[    1.610000]  [<00020000>] _FP_CALL_TOP+0x954a/0xd512
[    1.610000]  [<00021000>] _FP_CALL_TOP+0xa54a/0xd512
[    1.610000]  [<000bf300>] __vmalloc_node+0x3a/0x42
[    1.610000]  [<00020000>] _FP_CALL_TOP+0x954a/0xd512
[    1.610000]  [<0014d63e>] crypto_scomp_alloc_scratches+0x26/0x42
[    1.610000]  [<000bf410>] vmalloc_node+0x22/0x2a
[    1.610000]  [<00020000>] _FP_CALL_TOP+0x954a/0xd512
[    1.620000]  [<0014d63e>] crypto_scomp_alloc_scratches+0x26/0x42
[    1.620000]  [<0014d63e>] crypto_scomp_alloc_scratches+0x26/0x42
[    1.620000]  [<00020000>] _FP_CALL_TOP+0x954a/0xd512
[    1.620000]  [<0014d618>] crypto_scomp_alloc_scratches+0x0/0x42
[    1.620000]  [<0014d69e>] crypto_scomp_init_tfm+0x44/0x6c
[    1.620000]  [<00146aa4>] crypto_create_tfm+0x3e/0x8e
[    1.620000]  [<0014d6ee>] crypto_init_scomp_ops_async+0x28/0x76
[    1.620000]  [<00146aa4>] crypto_create_tfm+0x3e/0x8e
[    1.620000]  [<00147000>] crypto_find_alg+0x0/0x3a
[    1.620000]  [<00146a66>] crypto_create_tfm+0x0/0x8e
[    1.620000]  [<001468e0>] crypto_mod_put+0x0/0x2e
[    1.620000]  [<001470a0>] crypto_alloc_tfm+0x66/0x78
[    1.620000]  [<0014db80>] alg_find_test+0x0/0x50
[    1.620000]  [<0002daba>] do_exit+0x0/0x808
[    1.620000]  [<0014d140>] crypto_alloc_acomp+0x18/0x20
[    1.620000]  [<0015063a>] alg_test_comp+0x30/0x700
[    1.620000]  [<0014db80>] alg_find_test+0x0/0x50
[    1.620000]  [<0002daba>] do_exit+0x0/0x808
[    1.620000]  [<0004b650>] complete+0x0/0x34
[    1.620000]  [<00047a00>] enqueue_entity+0x0/0x370
[    1.620000]  [<00046762>] __enqueue_entity+0x3c/0x6a
[    1.620000]  [<00047c3c>] enqueue_entity+0x23c/0x370
[    1.620000]  [<00002704>] calibrate_delay+0xbe/0x18a
[    1.620000]  [<00002704>] calibrate_delay+0xbe/0x18a
[    1.620000]  [<002c04c6>] rb_erase_cached+0x28/0x2e6
[    1.620000]  [<001504a6>] alg_test.part.1+0x1de/0x206
[    1.620000]  [<0004ab6c>] __init_waitqueue_head+0x0/0xc
[    1.620000]  [<0014db34>] cryptomgr_test+0x0/0x48
[    1.620000]  [<0002daba>] do_exit+0x0/0x808
[    1.620000]  [<0004b650>] complete+0x0/0x34
[    1.620000]  [<000479c8>] pick_next_task_fair+0xf8/0x130
[    1.620000]  [<0004ab6c>] __init_waitqueue_head+0x0/0xc
[    1.620000]  [<0014db34>] cryptomgr_test+0x0/0x48
[    1.620000]  [<002cac2a>] __schedule+0x272/0x464
[    1.620000]  [<0004ab6c>] __init_waitqueue_head+0x0/0xc
[    1.620000]  [<0014db34>] cryptomgr_test+0x0/0x48
[    1.620000]  [<002ca9b8>] __schedule+0x0/0x464
[    1.620000]  [<0002daba>] do_exit+0x0/0x808
[    1.620000]  [<002cae68>] schedule+0x4c/0x68
[    1.620000]  [<0014db56>] cryptomgr_test+0x22/0x48
[    1.620000]  [<0003f446>] kthread+0xdc/0xe6
[    1.620000]  [<0003f36a>] kthread+0x0/0xe6
[    1.620000]  [<000028a0>] ret_from_kernel_thread+0xc/0x14
[    1.620000] Mem-Info:
[    1.620000] active_anon:0 inactive_anon:0 isolated_anon:0
[    1.620000]  active_file:0 inactive_file:0 isolated_file:0
[    1.620000]  unevictable:6090 dirty:0 writeback:0 unstable:0
[    1.620000]  slab_reclaimable:189 slab_unreclaimable:238
[    1.620000]  mapped:0 shmem:0 pagetables:0 bounce:0
[    1.620000]  free:251002 free_pcp:340 free_cma:0
[    1.620000] Node 0 active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:24360kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
[    1.620000] DMA free:1004008kB min:4044kB low:5064kB high:6084kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:24360kB writepending:0kB present:1048576kB managed:1031952kB mlocked:0kB kernel_stack:144kB pagetables:0kB bounce:0kB free_pcp:1360kB local_pcp:1360kB free_cma:0kB
[    1.620000] lowmem_reserve[]: 0 0 0
[    1.620000] DMA: 2*4kB (UM) 2*8kB (UE) 3*16kB (ME) 1*32kB (E) 2*64kB (ME) 0*128kB 3*256kB (UM) 3*512kB (UM) 2*1024kB (ME) 4*2048kB (UME) 242*4096kB (M) = 1004008kB
[    1.620000] 6104 total pagecache pages
[    1.620000] 0 pages in swap cache
[    1.630000] Swap cache stats: add 0, delete 0, find 0/0
[    1.630000] Free swap  = 0kB
[    1.630000] Total swap = 0kB
[    1.630000] 262144 pages RAM
[    1.630000] 0 pages HighMem/MovableOnly
[    1.630000] 4156 pages reserved
[    1.630000] alg: acomp: Failed to load transform for lzo-scomp: -12
[    1.630000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.630000] io scheduler noop registered
[    1.630000] io scheduler cfq registered (default)
[    1.630000] io scheduler mq-deadline registered
[    1.630000] atafb_init: start
[    1.630000] macfb: framebuffer at 0xf9001000, mapped to 0x(ptrval), size 468k
[    1.630000] macfb: mode is 800x600x8, linelength=800
[    1.640000] Console: switching to colour frame buffer device 100x37
[    1.640000] fb0: DAFB frame buffer device
[    1.640000] pmac_zilog: 0.6 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)
[    1.640000] scc.0: ttyS0 at MMIO 0x5000c022 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
[    1.640000] scc.1: ttyS1 at MMIO 0x5000c020 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
[    1.640000] adb: Mac II ADB Driver v1.0 for Unified ADB
[    1.650000] random: fast init done
[    1.650000] ADB keyboard at 2, handler 1
[    1.650000] Detected ADB keyboard, type <unknown>.
[    1.650000] input: ADB keyboard as /devices/virtual/input/input0
[    1.650000] ADB mouse at 3, handler 1
[    1.650000] input: ADB mouse as /devices/virtual/input/input1
[    1.660000] mousedev: PS/2 mouse device common for all mice
[    1.660000] rtc-generic rtc-generic: rtc core: registered rtc-generic as rtc0
[    1.660000] ledtrig-cpu: registered to indicate activity on CPUs
[    1.660000] NET: Registered protocol family 17
[    1.660000] mpls_gso: MPLS GSO support
[    1.660000] registered taskstats version 1
[    1.660000] zswap: loaded using pool lzo/zbud
[    1.660000] rtc-generic rtc-generic: setting system clock to 2019-10-25 14:14:23 UTC (1572012863)
[    1.670000] ------------[ cut here ]------------
[    1.670000] WARNING: CPU: 0 PID: 1 at mm/vmalloc.c:150 vmap_page_range_noflush+0xea/0x19c
...
...
many more failures
...
vivier commented 5 years ago

RAM is mapped between 0 and 0x3fffffff, so the maximum is 1024 Mib, ROM is between 0x40000000 and 0x4fffffff, I/O starts at 0x5000000, which is 1280 MiB and explains the assertion crash.

So we may limit to 1024 MiB at QEMU level. I don't know why we can't use the last 24 MiB, but I suspect a problem in the kernel.

vivier commented 5 years ago

We have an hint in the kernel logs:

ABCFGHIJK
Linux version 5.4.0-rc4-mac-17620-g8d7828aa2b90 (laurent@quad) (gcc version 9.2.1 20190827 (Red Hat Cross 9.2.1-1) (GCC)) #31 Fri Oct 25 18:35:50 CEST 2019
Saving 128 bytes of bootinfo
Detected Macintosh model: 35
Apple Macintosh Quadra 800
Built 1 zonelists, mobility grouping on.  Total pages: 259840

259840 * 4 kiB / 1 MiB = 1015 MiB

glaubitz commented 4 years ago

@vivier I think we can close this issue now as this is a hardware limitation, nothing that qemu can change if it emulates a Quadra 800. And since we have the new m68k-virt machine that allows up to 3.2 GB of RAM, the RAM size limitation no longer exists in qemu-m68k.

vivier commented 4 years ago

@vivier I think we can close this issue now as this is a hardware limitation, nothing that qemu can change if it emulates a Quadra 800. And since we have the new m68k-virt machine that allows up to 3.2 GB of RAM, the RAM size limitation no longer exists in qemu-m68k.

Yes, and moreover I think the bug is in the kernel