>Submitter-Id: net >Originator: Scott Blomenkamp <[email protected]> >Synopsis: https://www.google.com/url?q=http://GENERIC.MP&source=gmail&ust=1795678503699000&sa=E hangs or panics at seven points when booted as a Xen PVH domain through OvmfXen >Severity: non-critical >Priority: low >Category: kernel >Class: sw-bug >Release: 8.0 >Environment: System : OpenBSD 8.0 https://www.google.com/url?q=http://GENERIC.MP&source=gmail&ust=1795678503699000&sa=E (stock first; later runs with local workarounds for each fault in turn) Architecture: OpenBSD.amd64 Machine : Xen 4.20 PVH domain, type = "pvh", firmware OvmfXen (EDK2 OvmfPkg/OvmfXen.dsc) as kernel =, 1, 2 and 4 vCPUs >Description: Each fault was located without a console, from a stack via xenctx with the guest's own symbol table and from the message buffer in a domain dump (xl dump-core). Working around each one exposes the next.
1. cpu0 hangs calibrating the TSC: identifycpu -> cpu_freq -> delay -> i8254_delay. PVH has no i8254 (reads return 0xffff). tsc_identify() knows the KVM leaf (tsc_freq_kvm(), whose comment says it is needed "when the i8254 is not emulated") but not Xen's time leaf: CPUID 0x40000x03, sub-leaf 0, ECX = TSC kHz (xen/include/public/arch-x86/cpuid.h). The LAPIC timer runs at 100 MHz under Xen. 2. NULL dereference in acpimadt_attach: a PVH domain's MADT has no I/O APIC entry; the ISA identity-mapping code assumes one. 3. panic: page full in xen_grant_table_alloc: OVMF's own PV drivers leave non-zero grant entries behind, and xen(4) treats frame != 0 as in use, so the first table page looks full. The same panic happens with a stock kernel under HVM when the firmware is OvmfXen (reported separately with its trace). 4. rtcget() never returns: inittodr -> rtcget waits on register D, which reads 0xff (PVH has no RTC). 5. NULL dereference in wsdisplaywrite: sendsyslog writes to a console wsdisplay with no screen attached (wsdisplayopen already returns ENXIO in that state). 6. No console: PVH has no UART and no display, and Xen's PV console (HVM_PARAM_CONSOLE_PFN / CONSOLE_EVTCHN) has no OpenBSD driver. A feature gap, not a bug. 7. panic: acpi S5 transition did not happen at shutdown -p: PVH has no ACPI PM block; Xen's SCHEDOP_shutdown is the power-off path. Also (a limitation): without the invariant-TSC flag (xl without nomigrate=1) a PVH guest has no usable timecounter (no TSC, i8254 or HPET) and goes idle before rc. Xen's pvclock (vcpu_time_info in shared_info) would serve; pvclock(4) is KVM-only. Toolstacks that expose invariant TSC (libvirt with invtsc, as Qubes OS configures it) are not affected. >How-To-Repeat: name = "obsd-pvh" type = "pvh" memory = 1024 vcpus = 2 kernel = "/path/to/OVMFXEN.fd" disk = [ "format=raw,vdev=xvda,access=rw,target=/path/to/openbsd80-gpt.raw" ] vif = [ "bridge=xenbr0" ] nomigrate = 1 A stock 8.0 install on GPT/UEFI. /etc/boot.conf must not switch the loader to com0 (PVH has no UART; the loader spins there). >Fix: None attached. Small defensive checks for 2-5, a Xen case next to the KVM one for 1 and a SCHEDOP_shutdown fallback for 7 got the guest to multi-user (ping 11 s after start, 1/2/4 vCPUs, shutdown -p and xl shutdown both work), so the faults are independent and each is small. Would a PV console driver (the size of viocon(4)) be welcome in xen(4)? Disclosure: I found and analysed this with the help of an AI assistant (Anthropic's Claude), in a lab on Xen 4.20. The faults above were seen in real runs. No AI-written code is attached.
