From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id E8B7D80F81 for ; Thu, 29 Oct 2026 09:58:12 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69T9uxlo030982; Thu, 29 Oct 2026 12:57:00 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69T9uxlo030982 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1793267821; bh=Okhz/T0MoBnU7F6QMHGD8TF3VthE4Y3wHBzWJ1/REVQ=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=tmU9GAPCnSH6GYc7mCjNab2YJE3ICgVgFSaYawdLfYbDgeo/wTTVuId9XWVA958Hn vncx6WktZyZ02gQZnspCvGyJV8tNA5X/viT0MJcIIJj4bWK99IVkIs6CMMspr+8vEb Pmdo2cfTS94qIgx1LoNqIIalTf2nxLmfoAdrIrUOYdg9cCQQnEi/9gWUw28wSJXEKo GGfMzp1hpDlGx93gECE8+c5OzCCfSIHB4G8BoXMvDCRpiosJgbTJGxHZsJCYIvTshP xlP2waygkkRJ2YUBw5+j+/niZ/gKBlj7aoP1YxJvUkR4E+uFZiiwmsJKM/67nyttHl vLoSG73HlHtOA== Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69T9upK6030947 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 29 Oct 2026 12:56:51 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69T9upK6030947 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="J+jEpWxp" Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4a028616bebso14018685e9.1 for ; Thu, 29 Oct 2026 02:56:51 -0700 (PDT) X-Gm-Message-State: AFq9FYIkrUR7luVEcTLwwUV1D23m9bnUCIi3oeBBjyBbco3IWG6FWQRo GGcR3M7+76FOKKy7y4y1pCq6lYeJ4ggk4Mgalklv1fLPNjVaqYcUKrqXO7MXAk4RCCo1vhEIm/x UKrt9kJCiWKyHJ/+V7mwb+nf8WnLxpGxKhBxzb+RPJ4Fa58ARquB/GA== X-Gm-Gg: AYBFou3C8xAkdz8kkDNl4Ekq7YGRK4zElyOm3CpX7ncLjWi3WTilIHdU1w/r3cFGeO9 FufbgKH4WI3Er93ZvkfkCTwfhIsWEiFtMC74ZoYMpUgCzByHHe9Eyx7lbVSzdUm1I7RVbBpvutD zFe/az0KtfRlm+QEQ28OtVcIZuB9VYCCaznvwi75u8HCuIOPuSf/4pK43jjA6lDo8+sWQlU6Bjs AxgDMRfMVKOXk7TZf24Y0bE9W0zsGS/1pRlVa9+XM2oGQqwZT/2CQvJaqPJh1hlkbjn/c51q7XP r3ZYY7gL5Q== X-Received: by 2002:a05:600c:530d:b0:49e:7c8c:361d with SMTP id 5b1f17b1804b1-4a966774cbemr104000875e9.22.1793267810959; Thu, 29 Oct 2026 02:56:50 -0700 (PDT) X-Received: by 2002:a05:600c:530d:b0:49e:7c8c:361d with SMTP id 5b1f17b1804b1-4a966774cbemr104000545e9.22.1793267810554; Thu, 29 Oct 2026 02:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793267810; cv=none; d=google.com; s=arc-20260327; b=SplG6wKNAdLtFRmR2bMwLwSciyoPy6xE7AVwb8HyyY9Jd6aL71MWRV3N5+1YlZy9/A 62A7x8grve+s5YW7Fm8KYqOnKEFlQq2J4tqe9W2TPykRced4LUYxsiCwScsewwGNDv1F TyZjCuBWlflgcMt/+OgnT264DTSIfo47rgDEKf1oWaRRbVX0FBoyxyj4iD0AyaoNoBkn H7kxojNCYOHbJb3cAv1SBAg6wImepKeFJAUyl6CZ3I+ywMFNPSH7srT7WYNLbcA1ccUJ /Xlr7RjA0Th9o2Jwr9D9Un7+5CsKCvoq++Je9owmq9uett2gvP02rAlrTqssjH0fXJPj jWVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0dZcgSkXnQ8FeZP3CKdqNdqt1HSPbYPbHDDyl/khuxw=; fh=Kr/R+ZQiC/tid3qUs5C3px+AHPSuipOrrdrDcZfSlMY=; b=FvwPqPx90mTKuaXgVBP/qCZF4+mPyqAsOIqzZ0By4iKmCUdVSJlrjV6VkoH4nYEIx5 kRitPjq8JdBvQ0EOZTN9h/8r+poHiOCdQbPJjQ6A9vuCzgPxtnLPOhxbLyLoWfoEpnE5 mAyNoUmqqzhvEbtAZ2rarajFKn71wGU2x+ov2FgWBu0zskBaAc5XkKO1BK/MZrxjek6X DIWR2SrC+y3p4U02TSfgbPinr2rjgzv0wpEuyegt+RwIPueyAJK2PF1GjnTymyzLx/Ap Q1NFfWZoJ234Z+qjcx0qFi4fqOU/4iNfG20d0kXLTtxjNlv0YZnM3W8Tmph4ucDRPJxO RD/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=J+jEpWxp; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-48e3ebca7besor2850257f8f.10.2026.10.29.02.56.50 for (Google Transport Security); Thu, 29 Oct 2026 02:56:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf as permitted sender) client-ip=2a06:5b06:b600:300:2c3:d099:6fb:56cf; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=J+jEpWxp; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1793267810; x=1793872610; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=0dZcgSkXnQ8FeZP3CKdqNdqt1HSPbYPbHDDyl/khuxw=; b=J+jEpWxpCmjRVUqrtbP6zkQPDs2LjbRJ6etkSWdGD9D4LQczl+PjEjESSJZFyhgw8F tIO4fEN/zncvn7m7I2fezSLT6wVvnOVFY68s6LErRqP09z+SYkV/yDbbCbpzeCwDZ6Bo xKSkqi6eIwy0VNp1gpXMMu7RlaA/SWTN3n1N3PJoipTcFZDVL8C3iyH8JTvkg2jmdkI5 afFReamgRW/y1tKh38wltfGQybFvr7ny3wxDSs0Ddi9i51X/LdpA7HkJ1taR36MLFlJR 2Wde0xBEJI61l7Z8VgNzEorV4g/c0Z2gvVwBzf0vjKg2sJBWFkqrISa1xvNSA8MxXxnx mutQ== X-Received: by 2002:a05:6000:4007:b0:488:823d:5086 with SMTP id ffacd0b85a97d-48e5d319b40mr12366740f8f.0.1793267810010; Thu, 29 Oct 2026 02:56:50 -0700 (PDT) Received: from athena.sw.ru ([2a06:5b06:b600:300:2c3:d099:6fb:56cf]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ecd3418sm29958312f8f.41.2026.10.29.02.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2026 02:56:49 -0700 (PDT) From: "Denis V. Lunev" To: andrey.zhadchenko@virtuozzo.com Date: Thu, 29 Oct 2026 10:56:41 +0100 Message-ID: <20261029095645.4173762-3-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261029095645.4173762-1-den@openvz.org> References: <20261029095645.4173762-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.0/hci-8.1 2/6] i386: keep hle and rtm on Virtuozzo machine types up to vz9.2.0 #PSBM-149402 X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Denis V. Lunev Intel microcode updates for TAA disable TSX, and a host may also boot with tsx=off. KVM then stops offering hle and rtm, QEMU filters them, and a guest started with TSX can no longer be migrated, restored or reverted to a snapshot on that host: libvirt rejects the filtered features (VSTOR-75689, VSTOR-105458). The guest read its CPUID at boot, so the bits have to stay until it is restarted. Add x-tsx-compat: hle and rtm requested by an Intel CPU model or on the command line are then not filtered, and KVM gets them in the guest CPUID, ignoring bits it does not support. With TSX disabled by microcode XBEGIN aborts and HLE prefixes are ignored, so a guest that keeps using TSX falls back to its lock path. Where TSX_CTRL disables TSX instead, XBEGIN raises #UD, as it does with the libvirt relaxation this replaces. pc_vz_9_2_compat turns it on for vz9.2.0 and every older vz machine type, the only ones used by guests started before release 8.0. vz10.x types and -cpu host expansion stay strict. Signed-off-by: Denis V. Lunev --- hw/i386/pc.c | 5 +++++ hw/i386/pc_piix.c | 3 ++- hw/i386/pc_q35.c | 2 +- include/hw/i386/pc.h | 3 +++ target/i386/cpu.c | 27 ++++++++++++++++++++++++++- target/i386/cpu.h | 7 +++++++ 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 76289b86c28..25b17866103 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -548,6 +548,11 @@ GlobalProperty pc_vz_compat[] = { }; const size_t pc_vz_compat_len = G_N_ELEMENTS(pc_vz_compat); +GlobalProperty pc_vz_9_2_compat[] = { + { TYPE_X86_CPU, "x-tsx-compat", "on" }, +}; +const size_t pc_vz_9_2_compat_len = G_N_ELEMENTS(pc_vz_9_2_compat); + GlobalProperty pc_vz_7_16_compat[] = { { TYPE_X86_CPU, "kvm-pv-ipi", "off" }, { TYPE_X86_CPU, "kvm-pv-tlb-flush", "off" }, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1a50c2a645c..5be7c2ab967 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -1060,7 +1060,8 @@ DEFINE_I440FX_RHEL_MACHINE(7, 2, 0); X(10, 0, 0, MT_VER_SYM(10, 0, 0), false) \ X(7, 16, 0, MT_VER_SYM(7, 6, 0), false, hw_compat_vz_9_1, \ hw_compat_vz_7_16, \ - pc_vz_7_16_compat) \ + pc_vz_7_16_compat, \ + pc_vz_9_2_compat) \ X(7, 12, 0, MT_VER_SYM(7, 6, 0), false, hw_compat_vz_7_12) \ X(7, 10, 0, MT_VER_SYM(7, 6, 0), false, hw_compat_vz_7_10) \ X(7, 8, 0, MT_VER_SYM(7, 5, 0), false) \ diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 2f4a14b4e01..019239bec6a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -974,7 +974,7 @@ DEFINE_Q35_RHEL_MACHINE(7, 3, 0); #define VZ_Q35_MT(X) \ X(10, 1, 0, MT_VER_SYM(10, 2, 0), true) \ X(10, 0, 0, MT_VER_SYM(10, 0, 0), false) \ - X(9, 2, 0, MT_VER_SYM(9, 6, 0), false) \ + X(9, 2, 0, MT_VER_SYM(9, 6, 0), false, pc_vz_9_2_compat) \ X(9, 1, 0, MT_VER_SYM(9, 4, 0), false, hw_compat_vz_9_1) \ X(9, 0, 0, MT_VER_SYM(9, 2, 0), false) \ X(7, 16, 0, MT_VER_SYM(7, 6, 0), false, hw_compat_vz_7_16, \ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 4d8a01528b8..bd73426644e 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -364,6 +364,9 @@ extern const size_t pc_rhel_7_2_compat_len; extern GlobalProperty pc_vz_compat[]; extern const size_t pc_vz_compat_len; +extern GlobalProperty pc_vz_9_2_compat[]; +extern const size_t pc_vz_9_2_compat_len; + extern GlobalProperty pc_vz_7_16_compat[]; extern const size_t pc_vz_7_16_compat_len; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 5310d68443b..5ff5644dee9 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -9100,6 +9100,29 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp) } } +/* Requested features that a vz compat property keeps despite the host */ +static uint64_t x86_cpu_compat_kept_features(X86CPU *cpu, FeatureWord w) +{ + CPUX86State *env = &cpu->env; + uint64_t kept = 0; + + if (!kvm_enabled()) { + return 0; + } + + switch (w) { + case FEAT_7_0_EBX: + if (cpu->tsx_compat && IS_INTEL_CPU(env)) { + kept = CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_RTM; + } + break; + default: + break; + } + + return kept & env->features[w]; +} + /* * Finishes initialization of CPUID data, filters CPU feature * words based on host availability of each feature. @@ -9126,7 +9149,8 @@ static bool x86_cpu_filter_features(X86CPU *cpu, bool verbose) uint64_t host_feat = x86_cpu_get_supported_feature_word(NULL, w); uint64_t requested_features = env->features[w]; - uint64_t unavailable_features = requested_features & ~host_feat; + uint64_t unavailable_features = requested_features & ~host_feat & + ~x86_cpu_compat_kept_features(cpu, w); mark_unavailable_features(cpu, w, unavailable_features, prefix); } @@ -10056,6 +10080,7 @@ static const Property x86_cpu_properties[] = { arch_cap_always_on, false), DEFINE_PROP_BOOL("x-pdcm-on-even-without-pmu", X86CPU, pdcm_on_even_without_pmu, false), + DEFINE_PROP_BOOL("x-tsx-compat", X86CPU, tsx_compat, false), }; #ifndef CONFIG_USER_ONLY diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 07b7a9417b1..85efd0b9fbe 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2331,6 +2331,13 @@ struct ArchCPU { */ bool pdcm_on_even_without_pmu; + /* + * Virtuozzo machine types up to vz9.2.0: do not filter requested + * features the host no longer provides, so that a guest started on an + * older node keeps its CPUID. + */ + bool tsx_compat; + /* Number of physical address bits supported */ uint32_t phys_bits; -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel