All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: svt-core@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org
Subject: [PATCH hci-7.4 1/2] hw/loader: stop rom_reset() overwriting the BIOS after vz-cprload #VSTOR-155779
Date: Wed, 18 Nov 2026 12:47:28 +0100	[thread overview]
Message-ID: <20261118114729.2973585-2-den@openvz.org> (raw)
In-Reply-To: <20261118114729.2973585-1-den@openvz.org>

From: Denis V. Lunev <den@openvz.org>

Since 8883d1305f1 rom_reset() returns early while a cpr restart is in
progress. The new QEMU starts in RUN_STATE_CPR_POSTEXEC, not INMIGRATE,
so the branch that drops the data of isrom ROMs never runs and the BIOS
image loaded from the host is kept. vz-cprload clears
CPR_RESTART_POSTEXEC, and the next guest reset 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". A VM whose node got a new seabios-bin
after the VM started pauses this way on its first reboot after the
update.

Treat a cpr restart like an incoming migration: drop the data of isrom
ROMs and write nothing. Dropping the early return alone is not enough
here: the startup reset would then write the ROMs over the preserved
RAM again.

Fixes: 8883d1305f1 ("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 efd043d7a2d..d786dd7a012 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -1254,21 +1254,17 @@ static void rom_reset(void *unused)
 {
     Rom *rom;
 
-    if (cpr_restart_in_progress()) {
-        /* 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_restart_in_progress()) {
             if (rom->data && rom->isrom) {
                 /*
                  * Free it so that a rom_reset after migration doesn't
-- 
2.55.0


  reply	other threads:[~2026-11-18 11:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 11:47 [PATCH hci-7.4 0/2] hw/loader: keep the guest's BIOS on reset " Denis V. Lunev
2026-11-18 11:47 ` Denis V. Lunev [this message]
2026-11-18 11:51   ` [PATCH hci-7.4 1/2] hw/loader: stop rom_reset() overwriting the BIOS " no-reply
2026-11-18 11:47 ` [PATCH hci-7.4 2/2] iotests/vz-cpr: cover a guest reset with a new BIOS file #VSTOR-155779 Denis V. Lunev
2026-11-18 11:50   ` no-reply
2026-11-18 14:11 ` [PATCH hci-7.4 0/2] hw/loader: keep the guest's BIOS on reset after vz-cprload #VSTOR-155779 Andrey Drobyshev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261118114729.2973585-2-den@openvz.org \
    --to=den@openvz.org \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=svt-core@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.