Page MenuHomeFreeBSD

{emulators,sysutils}/xen-{kernel,tools}: update to 4.21
Needs ReviewPublic

Authored by royger on Thu, Feb 26, 7:14 PM.
Tags
None
Referenced Files
F149572668: D55538.id174179.diff
Wed, Mar 25, 8:19 AM
Unknown Object (File)
Tue, Mar 24, 7:32 AM
Unknown Object (File)
Sun, Mar 22, 3:33 PM
Unknown Object (File)
Sun, Mar 22, 3:01 AM
Unknown Object (File)
Sat, Mar 21, 8:01 PM
Unknown Object (File)
Sat, Mar 21, 9:42 AM
Unknown Object (File)
Fri, Mar 13, 8:55 PM
Unknown Object (File)
Thu, Mar 12, 10:38 PM

Details

Reviewers
arrowd
mat
bapt
Summary

Update to latest stable version. Fetch QEMU from the release tarball,
building from git is getting more and more complex, and we don't usually
have a delta of patches on top of QEMU that would dissaper if using git.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

royger updated this revision to Diff 172786.
royger created this revision.

Add missing DIST_SUBDIR for xen-kernel

sysutils/xen-tools/Makefile
67

qemuu is this a typo?

sysutils/xen-tools/Makefile
67

hehe, no, it's an acronym for QEMU Upstream. Long time ago Xen had a forked version of QEMU (qemu-trad), and the way to differentiate between them was qemuu (QEMU Upstream) vs qemu-trad (QEMU Traditional).

It seems the information of distinfo for emulator/xen-kernel needs to be updated again:

===>   xen-kernel-4.21.0.20260212 depends on file: /usr/local/sbin/pkg - found
=> xen/4.21.0.20260212/xen-project-xen-afaf4e7b503ad3e79602b39064e58d6488d10f3d_GL0.tar.gz is not in /usr/ports/emulators/xen-kernel/distinfo.
=> Either /usr/ports/emulators/xen-kernel/distinfo is out of date, or
=> xen/4.21.0.20260212/xen-project-xen-afaf4e7b503ad3e79602b39064e58d6488d10f3d_GL0.tar.gz is spelled incorrectly.
*** Error code 1

After cd /usr/ports/emulators/xen-kernel && make makesum work fine on FreeBSD-16 CURRENT:

xl info:

# xl info
host                   : host1.my.domain
release                : 16.0-CURRENT
version                : FreeBSD 16.0-CURRENT #2 main-b1f72dd2a9a5: Sat Mar 21 14:42:39 UTC 2026     root@host1.my.domain:/usr/obj/usr/jails/src/src_16/src/amd64.amd64/sys/GENERIC-NODEBUG
machine                : amd64
nr_cpus                : 12
max_cpu_id             : 11
nr_nodes               : 1
cores_per_socket       : 6
threads_per_core       : 2
cpu_mhz                : 2496.001
hw_caps                : bfebfbff:77fafbbf:2c100800:00000121:0000000f:239c27eb:984007ac:00000100
virt_caps              : pv hvm hvm_directio pv_directio hap shadow iommu_hap_pt_share vmtrace gnttab-v1 gnttab-v2
total_memory           : 32555
free_memory            : 30171
sharing_freed_memory   : 0
sharing_used_memory    : 0
outstanding_claims     : 0
free_cpus              : 0
xen_major              : 4
xen_minor              : 21
xen_extra              : .1-pre
xen_version            : 4.21.1-pre
xen_caps               : xen-3.0-x86_64 hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 
xen_scheduler          : credit2
xen_pagesize           : 4096
platform_params        : virt_start=0x0
xen_changeset          : 
xen_commandline        : dom0_mem=2048M,max:2048M dom0_max_vcpus=2 dom0=pvh com1=115200,8n1 dom0_vcpus_pin
cc_compiler            : FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-proj
cc_compile_by          : root
cc_compile_domain      : 
cc_compile_date        : Sat Mar 21 20:13:42 UTC 2026
build_id               : 018343013672e0b53141ca8bdf24fce6cee7d266
xend_config_format     : 4

Also, the system is not very stable, but I don't know if this is related to the Xen kernel or FreeBSD 16. Sometimes after loading into multiplayer mode, the system freezes and the image on the screen becomes distorted.

Boot method: UEFI

/boot/loader.conf:

xen_cmdline="dom0_mem=4096M dom0=pvh dom0_max_vcpus=2 com1=115200,8n1 dom0_vcpus_pin guest_loglvl=all loglvl=all console=vga vga=gfx-1280x1024x16 noreboot"
kern.vt.fb.default_mode="1280x1024"
efi_max_resolution="1280x1024"

upd: In my case, FreeBSD 16 freezes, without the XEN kernel. I assume everything is fine with the XEN.

Another test on FreeBSD 15-STABLE:

FreeBSD xen1.my.domain 15.0-STABLE FreeBSD 15.0-STABLE stable/15-45b0c46d1c0b GENERIC amd64

xen packages:

edk2-xen-x64-g202508           EDK2 Firmware for xen_x64
xen-kernel-4.21.0.20260212     Hypervisor using a microkernel design
xen-tools-4.21.0.20260212      Xen Hypervisor management tools

fails to start the guest with the following errors:

libxl: error: libxl_qmp.c:1455:qmp_ev_fd_callback: Domain 2:received POLLHUP|POLLERR from QMP socket
libxl: error: libxl_qmp.c:1492:qmp_ev_fd_callback: Domain 2:Error happened with the QMP connection to QEMU
libxl: error: libxl_dm.c:3334:device_model_postconfig_done: Domain 2:Post DM startup configs failed, rc=-26
libxl: error: libxl_create.c:1913:domcreate_devmodel_started: Domain 2:device model did not start: -26
libxl: error: libxl_xshelp.c:206:libxl__xs_read_mandatory: xenstore read failed: `/libxl/2/type': No such file or directory

full xl output: https://pastebin.com/xhY0MNRT

On the same host (same revision/xl.cfg/xen_cmdline) everything works with 4.19:

edk2-xen-x64-g202508           EDK2 Firmware for xen_x64
xen-kernel-4.19.1.20250217     Hypervisor using a microkernel design
xen-tools-4.19.1.20250217_1    Xen Hypervisor management tools

full xl output: https://pastebin.com/DgU9hn7T

Can you paste the contents of /var/log/xen/qemu-<domain name>.log?

Can you paste the contents of /var/log/xen/qemu-<domain name>.log?

Guest xen.cfg:

xen_platform_pci = 1
name = "freebsd1"
memory = 4096
vcpus = 2
boot="d"
vga = "stdvga"
videoram=32
vncunused=0
on_poweroff="destroy";
on_reboot="restart";
on_crash="destroy";
usbdevice = 'tablet'
hap="1"
nestedhvm="0"
bios = "ovmf"
apic=1
acpi=1
localtime=1
usb=1
vif = [
  'bridge=bridge1,mac=00:a0:98:9d:04:9b,type=ioemu,model=virtio-net,mtu=1500'
]
vnc = 1
spice = 0
vnclisten = "0.0.0.0"
vncdisplay="0"
disk = [
'/usr/jails/jails-data/freebsd1-data/dsk1.vhd,raw,xvda,rw', '/usr/jails/src/iso/cbsd-iso-FreeBSD-15.0-RELEASE-amd64-disc1.iso,raw,hdb:cdrom,r'
]
builder = "hvm"
serial="pty"

/var/log/xen/qemu-dm-freebsd1.log:

char device redirected to /dev/pts/2 (label serial0)

If I comment serial=, the log is empty.

I also noticed that a qemu-system-i386.core core file is being created:

pid 4614 (qemu-system-i386), jid 0, uid 0: exited on signal 11 (core dumped)

lldb:

root@xen1:/var/log/xen # pkg which /usr/local/lib/xen/bin/qemu-system-i386
/usr/local/lib/xen/bin/qemu-system-i386 was installed by package xen-tools-4.21.0.20260212

root@xen1:/var/log/xen # lldb -c ./qemu-system-i386.core /usr/local/lib/xen/bin/qemu-system-i386 
(lldb) target create "/usr/local/lib/xen/bin/qemu-system-i386" --core "./qemu-system-i386.core"
Core file '/var/log/xen/qemu-system-i386.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'qemu-system-i386', stop reason = signal SIGSEGV
  * frame #0: 0x00003b37a1892c78 qemu-system-i386`error_vprepend(errp=0x00003b3fc2515de8, fmt="", ap=0x00003b3fc2515c30) at error.c:142:5
    frame #1: 0x00003b37a1892de4 qemu-system-i386`error_prepend(errp=<unavailable>, fmt=<unavailable>) at error.c:152:5
    frame #2: 0x00003b37a13436e9 qemu-system-i386`xen_console_device_create(backend=0x00005ce749c00ba0, opts=<unavailable>, errp=0x00003b3fc2515de8) at xen_console.c:555:9
    frame #3: 0x00003b37a14c968a qemu-system-i386`xen_backend_device_create(xenbus=0x00005ce72c0b9320, type="console", name="0", opts=0x00005ce74ac83c00, errp=0x00003b3fc2515de8) at xen-backend.c:142:5
    frame #4: 0x00003b37a14cbee3 qemu-system-i386`xen_bus_backend_changed [inlined] xen_bus_backend_create(xenbus=0x00005ce72c0b9320, type="console", name="0", path="backend/console/3/0", errp=0x00003b3fc2515de8) at xen-bus.c:179:5
    frame #5: 0x00003b37a14cbec2 qemu-system-i386`xen_bus_backend_changed [inlined] xen_bus_type_enumerate(xenbus=0x00005ce72c0b9320, type="console") at xen-bus.c:218:13
    frame #6: 0x00003b37a14cba49 qemu-system-i386`xen_bus_backend_changed [inlined] xen_bus_enumerate(xenbus=<unavailable>) at xen-bus.c:247:9
    frame #7: 0x00003b37a14cb9a5 qemu-system-i386`xen_bus_backend_changed(opaque=0x00005ce72c0b9320, path=<unavailable>) at xen-bus.c:288:5
    frame #8: 0x00003b37a1895359 qemu-system-i386`notifier_list_notify(list=0x00005ce72c0b0c28, data=0x00005ce7498060f0) at notify.c:39:9
    frame #9: 0x00003b37a14d061b qemu-system-i386`watch_event(opaque=0x00005ce72c0b0c20) at xen-operations.c:227:9
    frame #10: 0x00003b37a188bccb qemu-system-i386`aio_dispatch_handler(ctx=0x00005ce72b923b80, node=<unavailable>) at aio-posix.c:372:9
    frame #11: 0x00003b37a188aeec qemu-system-i386`aio_dispatch [inlined] aio_dispatch_handlers(ctx=0x00005ce72b923b80) at aio-posix.c:414:20
    frame #12: 0x00003b37a188aed4 qemu-system-i386`aio_dispatch(ctx=0x00005ce72b923b80) at aio-posix.c:424:5
    frame #13: 0x00003b37a18a2c5e qemu-system-i386`aio_ctx_dispatch(source=<unavailable>, callback=<unavailable>, user_data=<unavailable>) at async.c:360:5
    frame #14: 0x00003b3fcc4ea081 libglib-2.0.so.0`___lldb_unnamed_symbol2555 + 369
    frame #15: 0x00003b3fcc4e9ef7 libglib-2.0.so.0`g_main_context_dispatch + 87
    frame #16: 0x00003b37a18a3462 qemu-system-i386`main_loop_wait [inlined] glib_pollfds_poll at main-loop.c:287:9
    frame #17: 0x00003b37a18a3425 qemu-system-i386`main_loop_wait [inlined] os_host_main_loop_wait(timeout=<unavailable>) at main-loop.c:310:5
    frame #18: 0x00003b37a18a33d4 qemu-system-i386`main_loop_wait(nonblocking=0) at main-loop.c:589:11
    frame #19: 0x00003b37a14f1277 qemu-system-i386`qemu_main_loop at runstate.c:826:9
    frame #20: 0x00003b37a17e518b qemu-system-i386`qemu_default_main at main.c:37:14
    frame #21: 0x00003b3fd4ea189f libc.so.7`__libc_start1(argc=43, argv=0x00003b3fc2516138, env=0x00003b3fc2516298, cleanup=<unavailable>, mainX=(qemu-system-i386`main at main.c:46)) at libc_start1.c:180:7
    frame #22: 0x00003b37a12d2cf1 qemu-system-i386`_start at crt1_s.S:80
(lldb) up
frame #1: 0x00003b37a1892de4 qemu-system-i386`error_prepend(errp=<unavailable>, fmt=<unavailable>) at error.c:152:5
   149      va_list ap;
   150 
   151      va_start(ap, fmt);
-> 152      error_vprepend(errp, fmt, ap);
   153      va_end(ap);
   154  }
   155 
(lldb) up
frame #2: 0x00003b37a13436e9 qemu-system-i386`xen_console_device_create(backend=0x00005ce749c00ba0, opts=<unavailable>, errp=0x00003b3fc2515de8) at xen_console.c:555:9
   552      }
   553 
   554      if (xs_node_scanf(xsh, XBT_NULL, fe, "type", errp, "%ms", &type) != 1) {
-> 555          error_prepend(errp, "failed to read console device type: ");
   556          goto fail;
   557      }
   558 
(lldb) up
frame #3: 0x00003b37a14c968a qemu-system-i386`xen_backend_device_create(xenbus=0x00005ce72c0b9320, type="console", name="0", opts=0x00005ce74ac83c00, errp=0x00003b3fc2515de8) at xen-backend.c:142:5
   139      backend->xenbus = xenbus;
   140      backend->name = g_strdup(name);
   141 
-> 142      impl->create(backend, opts, errp);
   143 
   144      backend->impl = impl;
   145      xen_backend_list_add(backend);
(lldb)

Attempt to fix the QEMU segfault.

Attempt to fix the QEMU segfault.

The problem has been solved, guest machines are working successfully:

root@xen1:~ # xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  2047     2     r-----      35.1
freebsd1                                     1  4096     2     -b----      21.9
root@xen1:~ # xl info
host                   : xen1.my.domain
release                : 15.0-STABLE
version                : FreeBSD 15.0-STABLE stable/15-45b0c46d1c0b GENERIC
machine                : amd64
nr_cpus                : 12
max_cpu_id             : 11
nr_nodes               : 1
cores_per_socket       : 6
threads_per_core       : 2
cpu_mhz                : 2496.000
hw_caps                : bfebfbff:77fafbbf:2c100800:00000121:0000000f:239c27eb:984007ac:00000100
virt_caps              : pv hvm hvm_directio pv_directio hap shadow iommu_hap_pt_share vmtrace gnttab-v1 gnttab-v2
total_memory           : 32555
free_memory            : 26055
sharing_freed_memory   : 0
sharing_used_memory    : 0
outstanding_claims     : 0
free_cpus              : 0
xen_major              : 4
xen_minor              : 21
xen_extra              : .1-pre
xen_version            : 4.21.1-pre
xen_caps               : xen-3.0-x86_64 hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 
xen_scheduler          : credit2
xen_pagesize           : 4096
platform_params        : virt_start=0x0
xen_changeset          : 
xen_commandline        : dom0_mem=2048M,max:2048M dom0=pvh dom0_max_vcpus=2 com1=115200,8n1 dom0_vcpus_pin guest_loglvl=all loglvl=all console=vga vga=gfx-1280x1024x16
cc_compiler            : FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-proj
cc_compile_by          : root
cc_compile_domain      : 
cc_compile_date        : Wed Mar 25 08:21:06 UTC 2026
build_id               : 9e92ba2715a8ca5c4fca0fe364da34d8b9ae319d
xend_config_format     : 4