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, "Denis V. Lunev" <den@openvz.org>
Subject: [PATCH hci-8.0/8.1 1/1] i386: keep only requested SVM leaf features in x-svm-features-compat #VSTOR-154398
Date: Wed, 11 Nov 2026 12:19:16 +0100	[thread overview]
Message-ID: <20261111111917.4012602-2-den@openvz.org> (raw)
In-Reply-To: <20261111111917.4012602-1-den@openvz.org>

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

x-svm-features-compat keeps every FEAT_SVM bit when svm is off,
including the defaults of the CPU model. QEMU 8.2 drops those through
the dependency on svm, and libvirt checks the QOM features of the
incoming guest against the definition sent by the source. Every AMD
named-model guest of a vz9.0-9.2 machine type without svm (the KVM
default for all named models) is refused when it comes from HCI 7.4:

  guest CPU doesn't match specification: extra features: npt,nrip-save

so hci-upgrade from 7.4 cannot evacuate a single node.

The compat is only needed for Vz7 host-model guests, which run with
npt=on,nrip-save=on,svm=off given explicitly. Keep just the FEAT_SVM
bits requested by the user, both against the dependency on svm and
against the host, and let the model defaults and the bits -cpu host
takes from the host go as they do on QEMU 8.2. The guest cannot see
any of them without svm, so its CPUID does not change.

Fixes: e51cdbf863df ("i386: keep SVM leaf features without svm on vz types up to vz9.2.0 #PSBM-144630")
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 target/i386/cpu.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index e22fafeaef0..6b68eebc35d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -8998,15 +8998,15 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
     for (i = 0; i < ARRAY_SIZE(feature_dependencies); i++) {
         FeatureDep *d = &feature_dependencies[i];
 
-        /* CPUID leaf 0x8000000a stays empty without svm anyway */
-        if (cpu->svm_features_compat && kvm_enabled() &&
-            d->to.index == FEAT_SVM) {
-            continue;
-        }
-
         if (!(env->features[d->from.index] & d->from.mask)) {
             uint64_t unavailable_features = env->features[d->to.index] & d->to.mask;
 
+            /* CPUID leaf 0x8000000a stays empty without svm anyway */
+            if (cpu->svm_features_compat && kvm_enabled() &&
+                d->to.index == FEAT_SVM) {
+                unavailable_features &= ~env->user_features[FEAT_SVM];
+            }
+
             /* Not an error unless the dependent feature was added explicitly.  */
             mark_unavailable_features(cpu, d->to.index,
                                       unavailable_features & env->user_features[d->to.index],
@@ -9168,7 +9168,7 @@ static uint64_t x86_cpu_compat_kept_features(X86CPU *cpu, FeatureWord w)
         }
         if (cpu->svm_features_compat &&
             !(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_SVM)) {
-            kept = ~0ULL;
+            kept |= env->user_features[FEAT_SVM];
         }
         break;
     default:
-- 
2.53.0


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 11:19 [PATCH hci-8.0/8.1 0/1] i386: fix 7.4 -> 8.0 migration of AMD guests without svm #VSTOR-154398 Denis V. Lunev
2026-11-11 11:19 ` Denis V. Lunev [this message]
2026-11-11 14:26   ` [PATCH hci-8.0/8.1 1/1] i386: keep only requested SVM leaf features in x-svm-features-compat #VSTOR-154398 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=20261111111917.4012602-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.