🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
7 messages
7 total messages Started by bugzilla-noreply Thu, 19 Nov 2026 18:35
[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
#564
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 18:35
108 lines
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
[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
#565
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 18:37
18 lines
2744 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300921

Scott Blomenkamp <sablomenkamp@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|Any                         |amd64
                 CC|                            |royger@freebsd.org
           Severity|Affects Only Me             |Affects Some People

-- 
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
[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
#566
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 18:41
20 lines
2659 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300921

--- Comment #1 from Scott Blomenkamp <sablomenkamp@gmail.com> ---
Created attachment 277470
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277470&action=edit
Made against 15.1-RELEASE; it applies cleanly, with no offset or fuzz, to main
2c2007fa3e65. SHA-256

This is code generated by Claude

-- 
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
[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
#568
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 19:04
24 lines
2869 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300921

Roger Pau Monné <royger@freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |In Progress

--- Comment #2 from Roger Pau Monné <royger@freebsd.org> ---
It's possibly best to do this by setting:

init_ops.early_delay = xen_delay;

In xen_early_init() itself.  As long as the call to map_shared_info() is
successful xen_delay() can be used.

-- 
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
[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
#570
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 19:34
19 lines
2655 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300921

--- Comment #3 from Roger Pau Monné <royger@freebsd.org> ---
Created attachment 277474
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277474&action=edit
Init Xen-specific delay function

Can you test if this also fixes the issue?  I don't have a setup with OVMF
right now.

-- 
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
[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
#576
Author: bugzilla-noreply
Date: Fri, 20 Nov 2026 00:07
20 lines
2811 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300921

--- Comment #4 from Scott Blomenkamp <sablomenkamp@gmail.com> ---
Thank you Roger for the quick reply. I am testing now and appreciate you. I
recently suffered a accident that disabled me and am trying to find a new way
but while technical, am a neophyte at development and such although I spent
decades supporting QA/Dev teams with datacenter work.. I am trying to leverage
tools (AI) in  respectful and responsible way and would appreciate any
recommendations and or criticism on what I have submitted.

-- 
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
[Bug 300921] x86/xen: PVH guest started by firmware (OVMF) hangs in i8254_delay() when starting APs with more than one vCPU
#581
Author: bugzilla-noreply
Date: Fri, 20 Nov 2026 02:38
35 lines
3510 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300921

--- Comment #5 from Scott Blomenkamp <sablomenkamp@gmail.com> ---
Thanks Roger. I tested attachment 277474 in place of my patch, on
FreeBSD 15.1-RELEASE GENERIC plus local fixes for PR 300888-300891
(sys/x86/xen/hvm.c otherwise unchanged). It fixes the issue for me.

Plain Xen 4.20.5 (Debian dom0):
- PVH started by OvmfXen (edk2-stable202608, OvmfPkg/OvmfXen.dsc,
  unpatched), loader.efi from the guest disk, 2 and 4 vCPUs: boots to
  login, all APs started. With 2+ vCPUs this hung in i8254_delay before.
- PVH, kernel loaded directly by the toolstack, 2 vCPUs: unchanged, boots.
- HVM (BIOS), 2 and 4 vCPUs: boots normally, attimer0 and atrtc0 still
  attach, all APs started.

Qubes OS 4.3.1 (Xen 4.19.5):
- PVH via the same OvmfXen build, 2 and 4 vCPUs: boots, all APs started,
  the Xen devices (evtchn, gntdev, privcmd, xenstore) work.
- HVM with a device-model stubdomain, 2 vCPUs: boots, attimer0 and
  atrtc0 attach, AP started.

Short runs only; I didn't measure early DELAY() accuracy beyond a normal
boot. My attached patch (277470) can be dropped.

As with the original reports, this testing was done with the help of an
AI assistant.

-- 
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads