#1107104 qemu-system-x86: qemu-system-i386 -smp 6 (-smp >2) breaks the NetBSD bootloader now ‒ regression from 1:7.2+dfsg-7+deb12u7 to 1:9.1.1+ds-2~bpo12+1 and later

Package:
qemu-system-x86
Source:
qemu-system-x86
Description:
QEMU full system emulation binaries (x86)
Submitter:
наб
Date:
2025-08-27 07:55:02 UTC
Severity:
normal
Tags:
#1107104#5
Date:
2025-06-01 15:47:47 UTC
From:
To:
Dear Maintainer,

  curl -SOL ftp://ftp.netbsd.org/pub/NetBSD/images/10.1/NetBSD-10.1-i386.iso
  qemu-system-i386 -enable-kvm -smp 6 -m 4G -cdrom NetBSD-10.1-i386.iso
no longer manages to advance past the bootloader
(the same applies to booting off disk, but this is easier to repro).

This /used to work/ in 1:7.2+dfsg-7+deb12u7 and in previous versions.

If you drop the -smp 6 it works on all of them,
but you only have 1 CPU.

#1107104#10
Date:
2025-06-01 16:07:18 UTC
From:
To:
Control: tag -1 + unreproducible

I just tried the exact commands with qemu 10.0.0+ds-2~bpo12+2.
Works just fine for me, after hitting Enter to confirm the
default boot option, it starts netbsd installer which start
asking questions.

Also tried with tcg (not kvm) and using qemu-system-x86_64, -
also works.

I'm on an amd notebook here right now, maybe this is important,
but it shouldn't be for tcg.  The system is bookworm.

What I'm doing wrong?

Thanks,

/mjt

#1107104#17
Date:
2025-06-01 16:20:17 UTC
From:
To:
For me it loads the kernel (numbers and spinners) then bootloops...
I'm also on bookworm, lscpu says
    Model name:             Intel(R) Xeon(R) CPU           E5645  @ 2.40GHz

I don't think I have anything weird going on.
Your setup seems the same as mine
(except for the underlying hardware, which really shouldn't matter).

I'll try some other systems and see what falls out.

#1107104#22
Date:
2025-06-01 17:10:23 UTC
From:
To:
I repro this with

debootstrap --variant minbase bookworm bookworm
mount --bind /dev bookworm/dev
mount --bind /sys bookworm/sys
mount --bind /proc bookworm/proc
# copy NetBSD-10.1-i386.iso
chroot bookworm
cat >> /etc/apt/sources.list
deb     http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
^D
apt update
apt install qemu-system-x86
apt install qemu-system-x86/bookworm-backports
qemu-system-i386 -enable-kvm -smp 6 -m 4G -cdrom NetBSD-10.1-i386.iso

both on the machine above (bookworm host) and on a
  Intel(R) Core(TM) i5-10210Y CPU @ 1.00GHz
laptop (slightly old sid host, 6.1.0-27 kernel).

Attaching log from -vga none -nographic.

#1107104#27
Date:
2025-08-03 06:27:17 UTC
From:
To:
However, I can reproduce a different failure with
10.0.0+ds-2~bpo12+2, and with 10.0.2+ds-2+b1 on
trixie:

Choose an option; RETURN for default; SPACE to stop countdown.
Option 1 will be chosen in 0 seconds.
20389236+589100+746196 [919406+939408+1024752]=0x17787ac
WARNING: couldn't open /var/db/entropy-file
Loading /stand/i386/10.1/modules/cd9660/cd9660.kmod
WARNING: 1 module failed to load
ESC[2JESCcESC[?7lESC[2JESC[0mSeaBIOS (version 1.16.3-debian-1.16.3-2)
..

This module loading failure looks rather suspicious.  And
it doesn't happen with 10.1.0-rc1.

It does not look right at all.

Maybe your failure is actually similar to mine, the prob is that
the netbsd kernel is unable to correctly read the cd-rom?

Still, I'm not sure where to go from here.

/mjt

#1107104#32
Date:
2025-08-03 08:44:58 UTC
From:
To:
Control: tag -1 - unreproducible + confirmed upstream
9.0 and 9.1, is the one which broke netbsd.iso like above
(not like in the original report, which I still can't reproduce):

commit 88dd4ca06c8392155289e5462cd26af3762a1b04
Author: Zhao Liu <zhao1.liu@intel.com>
Date:   Wed Apr 24 23:49:14 2024 +0800

     i386/cpu: Use APIC ID info to encode cache topo in CPUID[4]

     Refer to the fixes of cache_info_passthrough ([1], [2]) and SDM, the
     CPUID.04H:EAX[bits 25:14] and CPUID.04H:EAX[bits 31:26] should use the
     nearest power-of-2 integer.
     ....

(I had to apply a fix target/i386/cpu.h on top of it, or else qemu
does not build at all due to missing ArchCPU.l1_cache_per_core).

Next, the following commit (part of 10.1.0-rc0) fixes the issue for me:

commit f985a1195ba2d9c6f6f33e83fe2e419a7e8acb60
Author: Chuang Xu <xuchuangxclwt@bytedance.com>
Date:   Mon Jul 14 16:08:56 2025 +0800

     i386/cpu: Fix number of addressable IDs field for CPUID.01H.EBX[23:16]

     When QEMU is started with:
     -cpu host,migratable=on,host-cache-info=on,l3-cache=off
     -smp 180,sockets=2,dies=1,cores=45,threads=2

     On Intel platform:
     CPUID.01H.EBX[23:16] is defined as "max number of addressable IDs for
     logical processors in the physical package".
     ....


Since the latter commit which fixed the issue in 10.1 isn't
directly back-portable to 10.0, we'll think about other
possibilities in this area.

BTW, the same issue is present when using qemu-system-x86_64.
And it only affects intel-based CPUs, it does not happen on AMD.
That's why I weren't able to repro it before.

Let's mark it as confirmed+upstream, hopefully it's the same
issue as reported.

/mjt

#1107104#43
Date:
2025-08-12 08:20:00 UTC
From:
To:
On Sun, 3 Aug 2025 11:44:58 +0300 Michael Tokarev <mjt@tls.msk.ru> wrote:
..
I now picked this commit to 10.0 (stable) series too.

I'm marking this bug as notfound in 10.1 (currently in
experimental), and it will (hopefully) be fixed in the
next trixie point release too.

Thanks,

/mjt

#1107104#58
Date:
2025-08-27 07:52:55 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
qemu, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1107104@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Tokarev <mjt@tls.msk.ru> (supplier of updated qemu package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Wed, 27 Aug 2025 10:34:09 +0300
Source: qemu
Architecture: source
Version: 1:10.1.0+ds-1
Distribution: unstable
Urgency: medium
Maintainer: Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>
Changed-By: Michael Tokarev <mjt@tls.msk.ru>
Closes: 1097693 1107104 1108387
Changes:
 qemu (1:10.1.0+ds-1) unstable; urgency=medium
 .
   * new upstream release (v10.1.0)
     Closes: #1107104, #1108387
   * d/gbp.conf: switch to upstream-10.1 branch
   * d/watch: switch to 10.1.x series
   * d/copyright: update Files-Excluded
   * d/patches/qemu-img-options.patch: remove
   * remove patches which has been applied upstream:
     - hw-display-qxl-render.c-fix-qxl_unpack_chunks-chunk-.patch
     - system-physmem-fix-use-after-free-with-dispatch.patch
     - pcie_sriov-Fix-configuration-and-state-synchronizati.patch
     - hw-uefi-clear-uefi-vars-buffer-in-uefi_vars_write-CVE-2025-8860.patch
   * d/patches/gnu-hurd.patch: refresh
   * d/patches/disable-pycotap.patch: refresh
   * d/control.mk: checked-version=10.1.0+ds
   * d/rules: remove --enable-avx2 (not used anymore)
   * d/rules: dts files in pc-bios moved into a subdir (pc-bios/dtb)
   * skip-install-dtb.patch: avoid installing dtb files during arch build
     These are built in indep step in d/rules.
     + skip-install-dtb.patch
   * d/rules: use ${sysdataidir} in one more place instead of direct reference
   * d/control: remove redundant unversioned python3 from Build-Depends
   * d/control.mk: enable microblaze system targets on 32bit hosts
     microbiaze has been erroneously treated as 64bit architecture,
     and has been disabled in 10.0 on 32bit hosts.  Now it is correctly
     treated as 32bit architecture and is buildable on 32bit hosts again
   * d/control: suggest passt among with vde2
   * d/rules: add comment to remove ipxe from FIRMWAREPATH
   * d/rules: remove --disable-pie from i386 qemu-user build
     and remove references to old related bugs
   * two patches for roms to support gcc -std=23 (bool type)
     +SLOF-stdc23.patch
     +u-boot-sam460ex-stdc23.patch
     Closes: #1097693
   * d/*.lintian-overrides: remove spelling-error-in-binary wtH mips overrides
Checksums-Sha1:
 dd8805e0abffc8aef6c574a259c01d94eff1bb83 12242 qemu_10.1.0+ds-1.dsc
 f77bd4eca6697b7569b45ce53a0569b112f9efaa 40218072 qemu_10.1.0+ds.orig.tar.xz
 d2b133d72cd0c7cccc935ee9f19853794cf23432 123100 qemu_10.1.0+ds-1.debian.tar.xz
 d7649cc055717e23c150a15bbdf69a9d4a40fee1 7575 qemu_10.1.0+ds-1_source.buildinfo
Checksums-Sha256:
 e024802b060951ff6fcaa9f35577d0cd362276669bff4640f89b0219cd99e5d6 12242 qemu_10.1.0+ds-1.dsc
 580ebb2760d85859b7b9211aad8cb77b2641efd39016c62dde37a07961b7ed85 40218072 qemu_10.1.0+ds.orig.tar.xz
 e8bb2f8bf059522ff652062d51e4239d3a8aea2529788ffe7320fed0b487cf21 123100 qemu_10.1.0+ds-1.debian.tar.xz
 74860cf06e02994940eb7734be3467bf3f23e5f1a988cbc39543b91cd02e4b0c 7575 qemu_10.1.0+ds-1_source.buildinfo
Files:
 9763f3d7d2547a4f148568951e7f9dbc 12242 otherosfs optional qemu_10.1.0+ds-1.dsc
 266fe1d037202fcb3081aa21e06fb20c 40218072 otherosfs optional qemu_10.1.0+ds.orig.tar.xz
 c6263388299bd02714a822adf898576a 123100 otherosfs optional qemu_10.1.0+ds-1.debian.tar.xz
 301aee8c7e23b6fa03e21ce014ae00be 7575 otherosfs optional qemu_10.1.0+ds-1_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmiutRcACgkQgqpKJDse
lHiQcw//YkYVqz0q+Jwo9xmdCPLWgnHMoTRyYevMJlQ4VdQzkpeEgKQpnGbvqZb+
vTk/Tcr65iLwhHE6wt0NCVJvG96simV4GpJFM5l3W2Ylf5abUiGmYamhTAj1B9rq
ROaFw3KTlXITYUFcRJFEw6Jvx8Y3r5W/4trqdpNjF15zzf8XONeDL/71f59VBpYJ
MLGCvbkwUt/XFesJj99SiTtbaGVWAUN/wGwfoTi77KvTJISuYOJ/BnwYxTSiniLs
yxAGDbC9bMmx0k8/iNvPq5AEfCaHWzXu4d9zzgBznRHkiBwn/L5IyDTA7FTS+7us
TRknTjwENp3oSqjP5WUiA5fd+1dzDHRqfTIrWqPHGhUoT1FKhTUnCJdzkOand8Wr
lNFVyoVJTcwQNxkNASadq8qJCCtxaRxdwTSJt/loFiBX4JRIIw5aAXgRVN/JV/AS
zhMgEz0KHsQN/3/0gEPOpux3EDPMWX3X7aO7krMmxwKSun6CIMGlansakHsmQ8Xu
VrfW2g9ilBQpZnG4+R9C2N+uY9aytac0N2zgJvWUswzM8Uciybk28R7lB/tTrtkn
CQVLWM79fMT7XsADVhOce3nYgN6LQ4VeYMLK6FaQdsx4JUcr4Ln5+3XQtotzkEE5
b4RmdAj0bIPoeR3fdkNZowVZBrEJnN8AZcRk69buW3UkRTIYpJk=
=ovH6
-----END PGP SIGNATURE-----