On 17/08/18 14:27, Mark Kettenis wrote: >> Obviously I can't categorically state that QEMU's emulation is perfect, >> but it can now reliably run all of Linux, MacOS, NetBSD and FreeBSD in >> my local tests which makes me suspect that OpenBSD is trying to do >> something different here. > > Runs fairly stable as long as there is enough RAM. There is an > (unknown) pmap bug that causes memory corruption as soon as the > machine starts swapping.
Right, I wonder if this is related to the invalid memory accesses I'm seeing in QEMU? Fortunately it's fairly easy to boot different images within the VM, so let's go backwards in time... OpenBSD 6.1 - Boots to userspace, but hangs quickly at the installer shell OpenBSD 6.0 - Hangs on boot just after the USB controller initialises OpenBSD 5.9 - Boots to userspace, but hangs quickly at the installer shell (qemu console logs attempt to execute a NULL opcode, so looks like we're jumping off somewhere strange?) OpenBSD 5.8 - Hangs on boot just after the USB controller initialises (qemu console logs an attempt to execute an invalid/unsupported opcode: 00 - 1c - 17 - 0a (004ad5f8) 00000000 1) OpenBSD 5.7 - Lots of "mac_intr_establish called, not yet inited" warnings in the kernel dmesg output - However it boots to userspace and the installer shell seems stable OpenBSD 5.6 - Panics with a stack smash warning: OpenBSD 5.6 (RAMDISK) #163: Fri Aug 8 09:05:59 MDT 2014 dera...@macppc.openbsd.org:/usr/src/sys/arch/macppc/compile/RAMDISK real mem = 1073741824 (1024MB) avail mem = 1029210112 (981MB) warning: no entropy supplied by boot loader mainbus0 at root: model PowerMac3,1 cpu0 at mainbus0: 7400 (Revision 0x209): 900 MHz: L2 cache not enabled mem at mainbus0 not configured mpcpcibr0 at mainbus0 pci: uni-north pci0 at mpcpcibr0 bus 0 panic: smashed stack in ofw_enumerate_pcibus Stopped at Debugger+0x10: lwz r0,36(r1) 00a00ae4: end+0x561cc fp a00ac0 nfp a00ae0 001ee6dc: panic+0xe0 fp a00ae0 nfp a00b40 001e235c: __stack_smash_handler+0x18 fp a00b40 nfp a00b60 0037ea18: ofw_enumerate_pcibus+0x1b0 fp a00b60 nfp a00bc0 0031bc90: pciattach+0xf0 fp a00bc0 nfp a00bf0 001e3e50: config_attach+0x1f0 fp a00bf0 nfp a00c40 0037dc0c: mpcpcibrattach+0x3b0 fp a00c40 nfp a00d60 001e3e50: config_attach+0x1f0 fp a00d60 nfp a00db0 003095f0: dbdma_flush+0x4d8 fp a00db0 nfp a00e90 001e3e50: config_attach+0x1f0 fp a00e90 nfp a00ee0 RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC! DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION! ddb> trace 00a00ae4: end+0x561cc fp a00ac0 nfp a00ae0 001ee6dc: panic+0xe0 fp a00ae0 nfp a00b40 001e235c: __stack_smash_handler+0x18 fp a00b40 nfp a00b60 0037ea18: ofw_enumerate_pcibus+0x1b0 fp a00b60 nfp a00bc0 0031bc90: pciattach+0xf0 fp a00bc0 nfp a00bf0 001e3e50: config_attach+0x1f0 fp a00bf0 nfp a00c40 0037dc0c: mpcpcibrattach+0x3b0 fp a00c40 nfp a00d60 001e3e50: config_attach+0x1f0 fp a00d60 nfp a00db0 003095f0: dbdma_flush+0x4d8 fp a00db0 nfp a00e90 001e3e50: config_attach+0x1f0 fp a00e90 nfp a00ee0 002f63ec: cpu_configure+0x24 fp a00ee0 nfp a00f00 001c525c: main+0x3f0 fp a00f00 nfp a00f40 001001bc: kernel_text+0xa8 fp a00f40 nfp 0 ddb> ps PID PPID PGRP UID S FLAGS WAIT COMMAND * 0 -1 0 0 7 0x10200 swapper ddb> OpenBSD 5.5 - Lots of "mac_intr_establish called, not yet inited" warnings in the kernel dmesg output - Panics on boot when initialising USB: uhub0 at usb0 "Apple OHCI root hub" rev 1.00/1.00 addr 1 panic: trap type 600 at 2cf4a0 (mtx_enter+0x28) lr 2cf490 Stopped at Debugger+0x10: lwz r0,20(r1) 000000fc: tlbdsmsize+0x14 fp 94ba70 nfp 94ba80 001cec40: panic+0xd0 fp 94ba80 nfp 94bae0 002ce8cc: trap+0x184 fp 94bae0 nfp 94bb60 00100900: ddblow+0x1ac fp 94bb60 nfp 94bc10 002cf48c: mtx_enter+0x14 fp 94bc10 nfp 94bc20 001c4a50: config_attach+0x200 fp 94bc20 nfp 94bc60 00351018: mpcpcibrattach+0x3b0 fp 94bc60 nfp 94bd80 001c4a40: config_attach+0x1f0 fp 94bd80 nfp 94bdc0 002e4af0: mb_matchname+0x4e8 fp 94bdc0 nfp 94beb0 001c4a40: config_attach+0x1f0 fp 94beb0 nfp 94bef0 RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC! DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION! ddb> trace 000000fc: tlbdsmsize+0x14 fp 94ba70 nfp 94ba80 001cec40: panic+0xd0 fp 94ba80 nfp 94bae0 002ce8cc: trap+0x184 fp 94bae0 nfp 94bb60 00100900: ddblow+0x1ac fp 94bb60 nfp 94bc10 002cf48c: mtx_enter+0x14 fp 94bc10 nfp 94bc20 001c4a50: config_attach+0x200 fp 94bc20 nfp 94bc60 00351018: mpcpcibrattach+0x3b0 fp 94bc60 nfp 94bd80 001c4a40: config_attach+0x1f0 fp 94bd80 nfp 94bdc0 002e4af0: mb_matchname+0x4e8 fp 94bdc0 nfp 94beb0 001c4a40: config_attach+0x1f0 fp 94beb0 nfp 94bef0 002d1d9c: cpu_configure+0x24 fp 94bef0 nfp 94bf00 001a7314: main+0x3cc fp 94bf00 nfp 94bf40 001001bc: kernel_text+0xa8 fp 94bf40 nfp 0 ddb> ps PID PPID PGRP UID S FLAGS WAIT COMMAND * 0 -1 0 0 7 0x200 swapper ddb> OpenBSD 5.4-5.0 - Starts to boot, but VGA output stays black...? - Lots of "mac_intr_establish called, not yet inited" warnings in the kernel dmesg output - Gets to userspace over serial but hangs mid-message If we ignore the openpic warnings for the moment, something interesting definitely happened between 5.7 and 5.8, since that's where I go from a working userspace to something that hangs and often emits messages to QEMU console about invalid opcodes (which generally means you've jumped to the wrong or random bit of memory). ATB, Mark.