Article View: muc.lists.freebsd.bugs
Article #564[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
From: bugzilla-noreply
Date: Thu, 19 Nov 2026 18:35
Date: Thu, 19 Nov 2026 18:35
108 lines
6265 bytes
6265 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300921
Bug ID: 300921
Summary: x86/xen: PVH guest started by firmware (OVMF) hangs in
i8254_delay() when starting APs with more than one
vCPU
Product: Base System
Version: 15.1-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: sablomenkamp@gmail.com
Environment: FreeBSD 15.1-RELEASE amd64 (GENERIC) as a Xen PVH guest, on Xen
4.20.5-pre (Debian 13 dom0) and on Qubes OS 4.3.1 (Xen 4.19.5). The guest is
started by firmware rather than by Xen's PVH loader: OvmfXen, built from EDK2
tag edk2-stable202608 (OvmfPkg/OvmfXen.dsc, unmodified), is the domain's PVH
kernel (xl: type = "pvh", kernel = "OVMF.fd"). OVMF runs loader.efi from the
guest's EFI partition, and the loader starts the kernel. This is the route
described in "Xen and FreeBSD" (FreeBSD Journal, Nov/Dec 2024) for running OS
loaders in a PVH guest. The code involved is unchanged in main 2c2007fa3e65.
With vcpus = 1 the guest boots to login, and the Xen devices (xbd, xn, xc0,
xenstore, evtchn, gntdev, privcmd, balloon, xctrl) attach. With vcpus = 2 or
more it hangs right after the cache topology warnings, and vCPU 1 never comes
up. The stack of vCPU 0, read with xenctx and the kernel's symbols:
getit
i8254_delay
DELAY
ipi_startup
cpu_mp_start
mp_start
mi_startup
Cause: started this way, the kernel enters through the native entry point, not
hammer_time_xen(), so init_ops keeps its native hooks and early_delay stays
i8254_delay. Until a timecounter is up, DELAY() falls back to
init_ops.early_delay. A PVH domain has no emulated i8254, the counter never
moves, and i8254_delay() never returns. The first DELAY() caller is the AP
startup in ipi_startup(), which is why a single vCPU boots. When Xen loads the
kernel directly as PVH, hammer_time_xen() installs xen_pvh_init_ops with
early_delay = xen_delay, and SMP works.
How to repeat: an xl config with type = "pvh", kernel = <OvmfXen OVMF.fd>,
vcpus = 2, and a FreeBSD 15.1 VM image (FreeBSD-15.1-RELEASE-amd64-ufs.raw,
which has an EFI partition) as xvda. With vcpus = 1 it boots. (Separately, the
loader's autoboot countdown doesn't advance in this setup, presumably because
there is no RTC; pressing Enter, or autoboot_delay="-1" in loader.conf, gets
past it.)
Suggested fix: in sys/x86/xen/hvm.c, a SYSINIT at SI_SUB_HYPERVISOR (after the
ACPI tables can be mapped, before the APs start at SI_SUB_CPU). In a Xen
HVM-type domain with the shared info page mapped, whose init_ops.early_delay is
still i8254_delay, and whose FADT boot flags (acpi_get_fadt_bootflags())
contain both ACPI_FADT_NO_VGA and ACPI_FADT_NO_CMOS_RTC, set
init_ops.early_delay = xen_delay, as the PVH entry point does. This is the test
Linux uses to recognise a PVH guest that was not started through the PVH entry
(xen_hvm_guest_late_init() in arch/x86/xen/enlighten_hvm.c). Xen's FADT for a
PVH guest reports IAPC_BOOT_ARCH = NO_VGA, NO_CMOS_RTC; for an HVM guest it
reports 8042, and HVM guests always have the emulated RTC. xen_delay() is
correct in any Xen guest with shared info, so a false match would not break a
boot.
Tested on 15.1-RELEASE GENERIC with this change (the kernel also carried the
fixes from PR 300888-300891): started by OvmfXen as PVH, 2 and 4 vCPUs boot,
all APs launch, and the Xen devices attach; PVH started directly by Xen (2
vCPUs) and HVM (2 vCPUs) are unchanged, and the new code does not trigger
there. Also tested on Qubes OS 4.3.1 as a PVH qube with 2 vCPUs, started by
OvmfXen, with the Qubes qrexec agent working. A tested patch against main
(about 45 lines, one file) is available if wanted.
Disclosure: found and analysed with an AI assistant (Claude). The reproduction,
the test runs and the results are from my own machines.
--
You are receiving this mail because:
You are the assignee for the bug.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<bug-300921-227@https.bugs.freebsd.org/bugzilla/>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: bugzilla-noreply@freebsd.org Newsgroups: muc.lists.freebsd.bugs Subject: [Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU Date: Thu, 19 Nov 2026 18:35:56 +0000 Organization: Newsgate at muc.de e.V. Approved: news-admin@muc.de Distribution: world Message-ID: <bug-300921-227@https.bugs.freebsd.org/bugzilla/> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="60355"; mail-complaints-to="news-admin@muc.de" X-Original-To: bugs@mlmmj.nyi.freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795113356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0NDJ/1Dt/AdYzR87rT/J9aopvqx9j/PwA1T9Y95i5R8=; b=yXY5HoqX2dwCIn56NGJIIiKiGDYANuJ5BEcsx2iv4JmtViCp3zVBne7dF+1QTHA3R8XZ1Y EMBdJDICHVCbbWToPfp1EXkamiJw248/qbF5s1liDUFewBOHRi75/IPFZVYEJFo9OlW1Cp +TJvlCtTHDgcLb/Xe1W2IRZdKA1XGtaKLJ8o105yQMfMG2AUiCz6OOclaDoGNcaflJYiUs c/1sZuvAnvLaH/LVeu4fBcfc+vffTq3LNzB0l9R2b4mrNLnlB+Zxf5iauA0GpSftzZjDed RuHIEhlOoT7KYPt9VFjTkniHef/kQWptUCRO18L/eUlaTcIhxofVqSkeuOxTeQ== X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Auto-Submitted: auto-generated Precedence: list X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes