* [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779
@ 2026-11-18 11:47 Denis V. Lunev
2026-11-18 11:47 ` [PATCH hci-8.0/8.1 1/2] hw/loader: stop rom_reset() overwriting the BIOS after cpr-exec #VSTOR-155779 Denis V. Lunev
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Denis V. Lunev @ 2026-11-18 11:47 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
A VM started on 7.x and live-migrated to 8.0 pauses on its first reboot
after virsh qemu-update:
KVM internal error. Suberror: 1
...
emulation failure
Since f344758e7a0 rom_reset() returns before the INMIGRATE branch while
a cpr migration is incoming, so the cpr-exec target keeps the host's
BIOS image and writes it into pc.bios on the next guest reset. The
guest still runs the SeaBIOS it was started with from shadow RAM,
copies code from the new image over itself in qemu_reboot() and
crashes. Every VM that carries a pre-8.0 SeaBIOS into a qemu-update on
8.0 is hit. The field case is ASUP-4010, the RCA is in VSTOR-155779:
https://virtuozzo.atlassian.net/browse/VSTOR-155779
Patch 1 treats an incoming cpr like an incoming migration in
rom_reset(). Patch 2 adds a migrate-cpr-exec case: the new QEMU gets a
BIOS file that differs in one byte, and after cpr-exec and system_reset
the ROM must still hold the image the guest started with.
Both patches apply to hci-8.0 and hci-8.1 as is. A VM updated by the
current QEMU that has not rebooted yet recovers with one more
qemu-update to the fixed build. hci-7.4 has the same bug in a
different shape; its fix is sent separately.
Tested on dev-cl04 (vz10 kernel) on both branches: migrate-cpr-exec
passes, and with patch 1 reverted only the new case fails, with the
new image in the ROM.
Denis V. Lunev (2):
hw/loader: stop rom_reset() overwriting the BIOS after cpr-exec
#VSTOR-155779
iotests/migrate-cpr-exec: cover a guest reset with a new BIOS file
#VSTOR-155779
hw/core/loader.c | 12 ++----
tests/qemu-iotests/tests/migrate-cpr-exec | 38 +++++++++++++++++++
tests/qemu-iotests/tests/migrate-cpr-exec.out | 4 +-
3 files changed, 44 insertions(+), 10 deletions(-)
base-commit: e139ba63e8fb5a7d03bbe72e8ca435199d5b51ce
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH hci-8.0/8.1 1/2] hw/loader: stop rom_reset() overwriting the BIOS after cpr-exec #VSTOR-155779
2026-11-18 11:47 [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779 Denis V. Lunev
@ 2026-11-18 11:47 ` Denis V. Lunev
2026-11-18 11:47 ` [PATCH hci-8.0/8.1 2/2] iotests/migrate-cpr-exec: cover a guest reset with a new BIOS file #VSTOR-155779 Denis V. Lunev
2026-11-18 14:11 ` [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779 Andrey Drobyshev
2 siblings, 0 replies; 4+ messages in thread
From: Denis V. Lunev @ 2026-11-18 11:47 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Denis V. Lunev <den@openvz.org>
Since f344758e7a0 rom_reset() returns early while a cpr migration is
incoming. The return comes before the INMIGRATE branch that drops the
data of isrom ROMs, so the new QEMU keeps the BIOS image it loaded from
the host, and the first guest reset after qemu-update copies that image
into pc.bios.
The guest does not re-enter through the ROM. PAM is not reset, so
SeaBIOS runs from shadow RAM, finds HaveRunPost set and copies its code
back from the high ROM alias in qemu_reboot(). When the host's
bios-256k.bin is a different build from the one the guest started with,
SeaBIOS overwrites the code it is running and the vCPU stops with "KVM
internal error. Suberror: 1". Every VM started on 7.x and live-migrated
to 8.0 pauses this way on its first reboot after qemu-update.
Treat an incoming cpr like an incoming migration: drop the data of
isrom ROMs and write nothing. The cpr-exec target runs with -incoming
and is in INMIGRATE already, but the check does not rely on that.
Fixes: f344758e7a0 ("migration/cpr: avoid resetting ROMs on qemu-update #VSTOR-101576")
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
hw/core/loader.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index faa03b79e25..31f7f04b999 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -1202,21 +1202,17 @@ static void rom_reset(void *unused)
{
Rom *rom;
- if (cpr_is_incoming()) {
- /* No need to reset any ROM on CPR */
- return;
- }
-
QTAILQ_FOREACH(rom, &roms, next) {
if (rom->fw_file) {
continue;
}
/*
* We don't need to fill in the RAM with ROM data because we'll fill
- * the data in during the next incoming migration in all cases. Note
- * that some of those RAMs can actually be modified by the guest.
+ * the data in during the next incoming migration in all cases, and
+ * CPR keeps the RAM in place. Note that some of those RAMs can
+ * actually be modified by the guest.
*/
- if (runstate_check(RUN_STATE_INMIGRATE)) {
+ if (runstate_check(RUN_STATE_INMIGRATE) || cpr_is_incoming()) {
if (rom->data && rom->isrom) {
/*
* Free it so that a rom_reset after migration doesn't
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH hci-8.0/8.1 2/2] iotests/migrate-cpr-exec: cover a guest reset with a new BIOS file #VSTOR-155779
2026-11-18 11:47 [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779 Denis V. Lunev
2026-11-18 11:47 ` [PATCH hci-8.0/8.1 1/2] hw/loader: stop rom_reset() overwriting the BIOS after cpr-exec #VSTOR-155779 Denis V. Lunev
@ 2026-11-18 11:47 ` Denis V. Lunev
2026-11-18 14:11 ` [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779 Andrey Drobyshev
2 siblings, 0 replies; 4+ messages in thread
From: Denis V. Lunev @ 2026-11-18 11:47 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Denis V. Lunev <den@openvz.org>
Start the new QEMU with a BIOS file that differs from the guest's in one
byte. After cpr-exec and system_reset the BIOS ROM must still hold the
image the guest started with.
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
tests/qemu-iotests/tests/migrate-cpr-exec | 38 +++++++++++++++++++
tests/qemu-iotests/tests/migrate-cpr-exec.out | 4 +-
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/tests/migrate-cpr-exec b/tests/qemu-iotests/tests/migrate-cpr-exec
index 2b30929561c..450c8f41783 100755
--- a/tests/qemu-iotests/tests/migrate-cpr-exec
+++ b/tests/qemu-iotests/tests/migrate-cpr-exec
@@ -20,6 +20,7 @@
import logging
import os
+import re
from tempfile import NamedTemporaryFile
import iotests
@@ -529,6 +530,43 @@ class TestCprExec(iotests.QMPTestCase):
'-numa', 'node,nodeid=0,memdev=ram0')
self._test_cpr(pre_cpr_hook=hotplug_dimm)
+ def _bios_rom(self) -> tuple:
+ roms = self.vm.qmp('human-monitor-command',
+ command_line='info roms')['return']
+ m = re.search(r'addr=([0-9a-f]+) size=0x([0-9a-f]+) mem=rom '
+ r'name="([^"]*bios[^"]*)"', roms)
+ assert m, roms
+ return int(m[1], 16), int(m[2], 16)
+
+ def _dump_guest_mem(self, addr: int, size: int) -> bytes:
+ path = self._log_path('guest-mem.bin')
+ res = self.vm.qmp('pmemsave', val=addr, size=size, filename=path)
+ assert 'return' in res, res
+ with open(path, 'rb') as f:
+ return f.read()
+
+ def test_bios_rom_reset(self) -> None:
+ """Reset after cpr-exec keeps the guest's BIOS. See #VSTOR-155779"""
+ new_bios = self._log_path('bios-new.bin')
+ rom = {}
+
+ def swap_bios():
+ addr, size = self._bios_rom()
+ old = self._dump_guest_mem(addr, size)
+ with open(new_bios, 'wb') as f:
+ f.write(bytes([old[0] ^ 0xff]) + old[1:])
+ self.vm._qemu_full_args += ('-bios', new_bios)
+ rom.update(addr=addr, old=old)
+
+ def reset():
+ res = self.vm.qmp('system_reset')
+ assert 'return' in res, res
+ self.assertEqual(
+ self._dump_guest_mem(rom['addr'], len(rom['old'])),
+ rom['old'])
+
+ self._test_cpr(pre_cpr_hook=swap_bios, post_cpr_hook=reset)
+
if __name__ == '__main__':
iotests.activate_logging()
diff --git a/tests/qemu-iotests/tests/migrate-cpr-exec.out b/tests/qemu-iotests/tests/migrate-cpr-exec.out
index cfa5c0d0e66..5c26d15c0d0 100644
--- a/tests/qemu-iotests/tests/migrate-cpr-exec.out
+++ b/tests/qemu-iotests/tests/migrate-cpr-exec.out
@@ -1,5 +1,5 @@
-...................................
+....................................
----------------------------------------------------------------------
-Ran 35 tests
+Ran 36 tests
OK
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779
2026-11-18 11:47 [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779 Denis V. Lunev
2026-11-18 11:47 ` [PATCH hci-8.0/8.1 1/2] hw/loader: stop rom_reset() overwriting the BIOS after cpr-exec #VSTOR-155779 Denis V. Lunev
2026-11-18 11:47 ` [PATCH hci-8.0/8.1 2/2] iotests/migrate-cpr-exec: cover a guest reset with a new BIOS file #VSTOR-155779 Denis V. Lunev
@ 2026-11-18 14:11 ` Andrey Drobyshev
2 siblings, 0 replies; 4+ messages in thread
From: Andrey Drobyshev @ 2026-11-18 14:11 UTC (permalink / raw)
To: Denis V. Lunev, svt-core
LGTM, Ack
Applied to both hci-8.0 and hci-8.1
On 11/18/26 1:47 PM, Denis V. Lunev wrote:
> A VM started on 7.x and live-migrated to 8.0 pauses on its first reboot
> after virsh qemu-update:
>
> KVM internal error. Suberror: 1
> ...
> emulation failure
>
> Since f344758e7a0 rom_reset() returns before the INMIGRATE branch while
> a cpr migration is incoming, so the cpr-exec target keeps the host's
> BIOS image and writes it into pc.bios on the next guest reset. The
> guest still runs the SeaBIOS it was started with from shadow RAM,
> copies code from the new image over itself in qemu_reboot() and
> crashes. Every VM that carries a pre-8.0 SeaBIOS into a qemu-update on
> 8.0 is hit. The field case is ASUP-4010, the RCA is in VSTOR-155779:
>
> https://virtuozzo.atlassian.net/browse/VSTOR-155779
>
> Patch 1 treats an incoming cpr like an incoming migration in
> rom_reset(). Patch 2 adds a migrate-cpr-exec case: the new QEMU gets a
> BIOS file that differs in one byte, and after cpr-exec and system_reset
> the ROM must still hold the image the guest started with.
>
> Both patches apply to hci-8.0 and hci-8.1 as is. A VM updated by the
> current QEMU that has not rebooted yet recovers with one more
> qemu-update to the fixed build. hci-7.4 has the same bug in a
> different shape; its fix is sent separately.
>
> Tested on dev-cl04 (vz10 kernel) on both branches: migrate-cpr-exec
> passes, and with patch 1 reverted only the new case fails, with the
> new image in the ROM.
>
> Denis V. Lunev (2):
> hw/loader: stop rom_reset() overwriting the BIOS after cpr-exec
> #VSTOR-155779
> iotests/migrate-cpr-exec: cover a guest reset with a new BIOS file
> #VSTOR-155779
>
> hw/core/loader.c | 12 ++----
> tests/qemu-iotests/tests/migrate-cpr-exec | 38 +++++++++++++++++++
> tests/qemu-iotests/tests/migrate-cpr-exec.out | 4 +-
> 3 files changed, 44 insertions(+), 10 deletions(-)
>
>
> base-commit: e139ba63e8fb5a7d03bbe72e8ca435199d5b51ce
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-18 14:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 11:47 [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779 Denis V. Lunev
2026-11-18 11:47 ` [PATCH hci-8.0/8.1 1/2] hw/loader: stop rom_reset() overwriting the BIOS after cpr-exec #VSTOR-155779 Denis V. Lunev
2026-11-18 11:47 ` [PATCH hci-8.0/8.1 2/2] iotests/migrate-cpr-exec: cover a guest reset with a new BIOS file #VSTOR-155779 Denis V. Lunev
2026-11-18 14:11 ` [PATCH hci-8.0/8.1 0/2] hw/loader: keep the guest's BIOS on reset after qemu-update #VSTOR-155779 Andrey Drobyshev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.