From nobody Wed May 15 06:40:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1709657102; cv=none; d=zohomail.com; s=zohoarc; b=dhtmHJyWRr9mMtHmI0T8Xd9bGJP0Qf0QPRYkkUznLYHZbG/TLMQjpdEGYfzIWGCTWAtg0UBXG6aNs9l6qd/TW3BVpxDjA3SImwsL1y8a7Mz+OQaMbRaSMBrN2hLsCYkBWYllNXTUjoPhXTl2kLflEnZmSgLoe/5W9NvOq1m/8qM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709657102; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=rzUSmNr48AuOew4PQoowHUdG5Y8LjTF7gVdoLv9e0Y8=; b=CgFPZ6u6M3CgyhNJi09zfOJyPHa8B+itW0bu/wETb41kXOGFeqJ1E5JwwUrWITRumZploYe1drWCLGjsjLjZ4A+AUR9/du1O+ScGBXmupAKB6IvZ6Rh/nrC3Sn3sYRFcAhV352KqdIxNoubSZ0OFY+Fv0QwpPLzNLvOJOEJGe3E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709657102411711.1788025939443; Tue, 5 Mar 2024 08:45:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhXth-0002Xa-2K; Tue, 05 Mar 2024 11:44:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhXtd-0002X2-4j for qemu-devel@nongnu.org; Tue, 05 Mar 2024 11:44:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhXtb-0000zC-EE for qemu-devel@nongnu.org; Tue, 05 Mar 2024 11:44:04 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-XcyiSUnXMvO2sNS6vY9y5A-1; Tue, 05 Mar 2024 11:42:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8746A85A58C for ; Tue, 5 Mar 2024 16:42:07 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.225.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBEC74073486; Tue, 5 Mar 2024 16:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709657041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rzUSmNr48AuOew4PQoowHUdG5Y8LjTF7gVdoLv9e0Y8=; b=GwOJ0jP8pR6tJChq4zgJ5TJEL9fsMIxlkg0rv94xVvkpynbV77nz58Onnt4IFmrTskFvPQ wFeH/7/kBV+v/4WCY6Itn+2vRxtqsjdBkqyEY1EzJhZAI49p1y+spo8aF7A5Y/YB4jEcCR MijEBX8bExFL4TIwJmmpIdQ+IQcP6yM= X-MC-Unique: XcyiSUnXMvO2sNS6vY9y5A-1 From: Vitaly Kuznetsov To: qemu-devel@nongnu.org, Paolo Bonzini Subject: [PATCH RESEND v3 1/3] i386: Fix conditional CONFIG_SYNDBG enablement Date: Tue, 5 Mar 2024 17:42:02 +0100 Message-ID: <20240305164204.525575-2-vkuznets@redhat.com> In-Reply-To: <20240305164204.525575-1-vkuznets@redhat.com> References: <20240305164204.525575-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=vkuznets@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.568, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1709657104058100003 Content-Type: text/plain; charset="utf-8" Putting HYPERV_FEAT_SYNDBG entry under "#ifdef CONFIG_SYNDBG" in 'kvm_hyperv_properties' array is wrong: as HYPERV_FEAT_SYNDBG is not the highest feature number, the result is an empty (zeroed) entry in the array (and not a skipped entry!). hyperv_feature_supported() is designed to check that all CPUID bits are set but for a zeroed feature in 'kvm_hyperv_properties' it returns 'true' so QEMU considers HYPERV_FEAT_SYNDBG as always supported, regardless of whether KVM host actually supports it. To fix the issue, leave HYPERV_FEAT_SYNDBG's definition in 'kvm_hyperv_properties' array, there's nothing wrong in having it defined even when 'CONFIG_SYNDBG' is not set. Instead, put "hv-syndbg" CPU property under '#ifdef CONFIG_SYNDBG' to alter the existing behavior when the flag is silently skipped in !CONFIG_SYNDBG builds. Leave an 'assert' sentinel in hyperv_feature_supported() making sure there are no 'holes' or improperly defined features in 'kvm_hyperv_properties'. Fixes: d8701185f40c ("hw: hyperv: Initial commit for Synthetic Debugging de= vice") Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 2 ++ target/i386/kvm/kvm.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 2666ef380891..64ce7c4c8242 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7866,8 +7866,10 @@ static Property x86_cpu_properties[] =3D { HYPERV_FEAT_TLBFLUSH_DIRECT, 0), DEFINE_PROP_ON_OFF_AUTO("hv-no-nonarch-coresharing", X86CPU, hyperv_no_nonarch_cs, ON_OFF_AUTO_OFF), +#ifdef CONFIG_SYNDBG DEFINE_PROP_BIT64("hv-syndbg", X86CPU, hyperv_features, HYPERV_FEAT_SYNDBG, 0), +#endif DEFINE_PROP_BOOL("hv-passthrough", X86CPU, hyperv_passthrough, false), DEFINE_PROP_BOOL("hv-enforce-cpuid", X86CPU, hyperv_enforce_cpuid, fal= se), =20 diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 42970ab046fa..f067e35d35b1 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -945,7 +945,6 @@ static struct { .bits =3D HV_DEPRECATING_AEOI_RECOMMENDED} } }, -#ifdef CONFIG_SYNDBG [HYPERV_FEAT_SYNDBG] =3D { .desc =3D "Enable synthetic kernel debugger channel (hv-syndbg)", .flags =3D { @@ -954,7 +953,6 @@ static struct { }, .dependencies =3D BIT(HYPERV_FEAT_SYNIC) | BIT(HYPERV_FEAT_RELAXED) }, -#endif [HYPERV_FEAT_MSR_BITMAP] =3D { .desc =3D "enlightened MSR-Bitmap (hv-emsr-bitmap)", .flags =3D { @@ -1206,6 +1204,13 @@ static bool hyperv_feature_supported(CPUState *cs, i= nt feature) uint32_t func, bits; int i, reg; =20 + /* + * kvm_hyperv_properties needs to define at least one CPUID flag which + * must be used to detect the feature, it's hard to say whether it is + * supported or not otherwise. + */ + assert(kvm_hyperv_properties[feature].flags[0].func); + for (i =3D 0; i < ARRAY_SIZE(kvm_hyperv_properties[feature].flags); i+= +) { =20 func =3D kvm_hyperv_properties[feature].flags[i].func; @@ -3388,13 +3393,11 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_STATUS, env->msr_hv_tsc_emulation_status); } -#ifdef CONFIG_SYNDBG if (hyperv_feat_enabled(cpu, HYPERV_FEAT_SYNDBG) && has_msr_hv_syndbg_options) { kvm_msr_entry_add(cpu, HV_X64_MSR_SYNDBG_OPTIONS, hyperv_syndbg_query_options()); } -#endif } if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VAPIC)) { kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE, --=20 2.43.2 From nobody Wed May 15 06:40:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1709657312; cv=none; d=zohomail.com; s=zohoarc; b=UkauLGI5Wz7sdK8ixchE5i69wjCTD0wV+xGz/h+qbsSDDviqyPURAZPM33NTWO/owXwacad6gyn9qwDkVW7KmboULAkUwATYdOT1bYaA4YMWkayRgIB0sKl3jsmua7q1z32vcD8v5ClGLyz53gcUo/Rdijxd0oL/ZERQHM2zXMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709657312; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=AlBSI0rEWJpGFaPdh4aMHUVj52/YWrBZ2j7p6Ed+yGs=; b=aczLecb6n/hsTgTvwdIFY/5G9MoJjjAIPWd4Qx01rOeCwVwXgEEgIcv3cFLC1m5WmMcuxCUBU8sDLrScPdco5O/dyAA7kFURKdDUUwZzVH1v5uYKLpU82ceX8KX8I0H5buX7LSgyhLIYavRMasmF2acFV+MwTlfFHXJGZrVBfUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709657312483220.317533822364; Tue, 5 Mar 2024 08:48:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhXxV-0006KU-Ha; Tue, 05 Mar 2024 11:48:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhXxF-0006A3-UL for qemu-devel@nongnu.org; Tue, 05 Mar 2024 11:47:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhXxD-0001ox-WD for qemu-devel@nongnu.org; Tue, 05 Mar 2024 11:47:49 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-gBTjMl0tNXa2g2dop_zPSw-1; Tue, 05 Mar 2024 11:42:08 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5806428B6B22 for ; Tue, 5 Mar 2024 16:42:08 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.225.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC8F84073486; Tue, 5 Mar 2024 16:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709657266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AlBSI0rEWJpGFaPdh4aMHUVj52/YWrBZ2j7p6Ed+yGs=; b=TVotDujkAWq8mIEO/xTVQ9aHIgORZH3f4g7eQT6tR40g+2AXWcpmXh3eJxGFHUkIbuT96h RQwe960b7g13yxvHLmBq5TIWnr1b/V0r50TKV2iq5WNT+cHw43LpoimpIV81q43SKiAqn+ YBMu4hoaSC+Vqe/WYL+sxzEX1OHfnZQ= X-MC-Unique: gBTjMl0tNXa2g2dop_zPSw-1 From: Vitaly Kuznetsov To: qemu-devel@nongnu.org, Paolo Bonzini Subject: [PATCH RESEND v3 2/3] i386: Exclude 'hv-syndbg' from 'hv-passthrough' Date: Tue, 5 Mar 2024 17:42:03 +0100 Message-ID: <20240305164204.525575-3-vkuznets@redhat.com> In-Reply-To: <20240305164204.525575-1-vkuznets@redhat.com> References: <20240305164204.525575-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=vkuznets@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.568, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1709657313122100001 Content-Type: text/plain; charset="utf-8" Windows with Hyper-V role enabled doesn't boot with 'hv-passthrough' when no debugger is configured, this significantly limits the usefulness of the feature as there's no support for subtracting Hyper-V features from CPU flags at this moment (e.g. "-cpu host,hv-passthrough,-hv-syndbg" does not work). While this is also theoretically fixable, 'hv-syndbg' is likely very special and unneeded in the default set. Genuine Hyper-V doesn't seem to enable it either. Introduce 'skip_passthrough' flag to 'kvm_hyperv_properties' and use it as one-off to skip 'hv-syndbg' when enabling features in 'hv-passthrough' mode. Note, "-cpu host,hv-passthrough,hv-syndbg" can still be used if needed. As both 'hv-passthrough' and 'hv-syndbg' are debug features, the change should not have any effect on production environments. Signed-off-by: Vitaly Kuznetsov --- docs/system/i386/hyperv.rst | 13 +++++++++---- target/i386/kvm/kvm.c | 7 +++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/system/i386/hyperv.rst b/docs/system/i386/hyperv.rst index 2505dc4c86e0..009947e39141 100644 --- a/docs/system/i386/hyperv.rst +++ b/docs/system/i386/hyperv.rst @@ -262,14 +262,19 @@ Supplementary features ``hv-passthrough`` In some cases (e.g. during development) it may make sense to use QEMU in 'pass-through' mode and give Windows guests all enlightenments currently - supported by KVM. This pass-through mode is enabled by "hv-passthrough" = CPU - flag. + supported by KVM. =20 Note: ``hv-passthrough`` flag only enables enlightenments which are know= n to QEMU (have corresponding 'hv-' flag) and copies ``hv-spinlocks`` and ``hv-ven= dor-id`` values from KVM to QEMU. ``hv-passthrough`` overrides all other 'hv-' se= ttings on - the command line. Also, enabling this flag effectively prevents migratio= n as the - list of enabled enlightenments may differ between target and destination= hosts. + the command line. + + Note: ``hv-passthrough`` does not enable ``hv-syndbg`` which can prevent= certain + Windows guests from booting when used without proper configuration. If n= eeded, + ``hv-syndbg`` can be enabled additionally. + + Note: ``hv-passthrough`` effectively prevents migration as the list of e= nabled + enlightenments may differ between target and destination hosts. =20 ``hv-enforce-cpuid`` By default, KVM allows the guest to use all currently supported Hyper-V diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index f067e35d35b1..f01d19ad2d51 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -823,6 +823,7 @@ static struct { uint32_t bits; } flags[2]; uint64_t dependencies; + bool skip_passthrough; } kvm_hyperv_properties[] =3D { [HYPERV_FEAT_RELAXED] =3D { .desc =3D "relaxed timing (hv-relaxed)", @@ -951,7 +952,8 @@ static struct { {.func =3D HV_CPUID_FEATURES, .reg =3D R_EDX, .bits =3D HV_FEATURE_DEBUG_MSRS_AVAILABLE} }, - .dependencies =3D BIT(HYPERV_FEAT_SYNIC) | BIT(HYPERV_FEAT_RELAXED) + .dependencies =3D BIT(HYPERV_FEAT_SYNIC) | BIT(HYPERV_FEAT_RELAXED= ), + .skip_passthrough =3D true, }, [HYPERV_FEAT_MSR_BITMAP] =3D { .desc =3D "enlightened MSR-Bitmap (hv-emsr-bitmap)", @@ -1360,7 +1362,8 @@ bool kvm_hyperv_expand_features(X86CPU *cpu, Error **= errp) * hv_build_cpuid_leaf() uses this info to build guest CPUIDs. */ for (feat =3D 0; feat < ARRAY_SIZE(kvm_hyperv_properties); feat++)= { - if (hyperv_feature_supported(cs, feat)) { + if (hyperv_feature_supported(cs, feat) && + !kvm_hyperv_properties[feat].skip_passthrough) { cpu->hyperv_features |=3D BIT(feat); } } --=20 2.43.2 From nobody Wed May 15 06:40:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1709657126; cv=none; d=zohomail.com; s=zohoarc; b=F2EIO33zXa3tFVJZjcUe+2V9f0ORUvG2xggv9KVbp1oElBU+bJvbvf3sp104hAiE7YQZb8EjQDWkDOsUy7hgDZThJTixVlHWK1alcgnYNS6wLHDAGzOBI1gEtJBD+OM6BB/8hu6ozuNslwWFNfF1kPNYCBUuic/m1Uw0ST00w9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709657126; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=8b6YKrwFTOQkloU6yGe4dh340t/IAqkoph2jnxslv5c=; b=LnPHdBOZmHfJcv0DeM6qa9kxtuF75TzOMt5zrQyiYZVrgC+epNO6mDpNKOtJvhDsV0goD3uL9V/NA08SH2C8QsBFkdGQFKYuTP5X9gjUspEDxSQ7uxsAyRNuvfbeaP0eLFuXuNFDJVtWv1JA1mCvJ86RWae+0fmg2ni34cOu028= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709657126332580.3089664731674; Tue, 5 Mar 2024 08:45:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhXuY-0002xh-ON; Tue, 05 Mar 2024 11:45:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhXuM-0002sH-K2 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 11:44:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhXuL-00015O-2i for qemu-devel@nongnu.org; Tue, 05 Mar 2024 11:44:50 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-312-mA6qioZbNiC19yDodhCQyg-1; Tue, 05 Mar 2024 11:42:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 294153C025B8 for ; Tue, 5 Mar 2024 16:42:09 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.225.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DEA64073488; Tue, 5 Mar 2024 16:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709657088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8b6YKrwFTOQkloU6yGe4dh340t/IAqkoph2jnxslv5c=; b=gV19k1AYZ1rEhcdy3yL5oP+yQV1I5tLImDFHi2eWArdYE9en4zDpktCq96WHd1N60NWX2V 2Ta25l2IBI7Dz72cA1WIlgd1z74Pyt4CjoxSNqTQJ6lrrJCz2M0caB0H9ijwZ9DUd6wqVq wc/yAY05u/jsim2xze9pOOXGgdUYL/I= X-MC-Unique: mA6qioZbNiC19yDodhCQyg-1 From: Vitaly Kuznetsov To: qemu-devel@nongnu.org, Paolo Bonzini Subject: [PATCH RESEND v3 3/3] docs/system: Add recommendations to Hyper-V enlightenments doc Date: Tue, 5 Mar 2024 17:42:04 +0100 Message-ID: <20240305164204.525575-4-vkuznets@redhat.com> In-Reply-To: <20240305164204.525575-1-vkuznets@redhat.com> References: <20240305164204.525575-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=vkuznets@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.568, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1709657128103100003 Content-Type: text/plain; charset="utf-8" While hyperv.rst already has all currently implemented Hyper-V enlightenments documented, it may be unclear what is the recommended set to achieve the best result. Add the corresponding section to the doc. Signed-off-by: Vitaly Kuznetsov --- docs/system/i386/hyperv.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/system/i386/hyperv.rst b/docs/system/i386/hyperv.rst index 009947e39141..1c1de77feb65 100644 --- a/docs/system/i386/hyperv.rst +++ b/docs/system/i386/hyperv.rst @@ -283,6 +283,36 @@ Supplementary features feature alters this behavior and only allows the guest to use exposed Hy= per-V enlightenments. =20 +Recommendations +--------------- + +To achieve the best performance of Windows and Hyper-V guests and unless t= here +are any specific requirements (e.g. migration to older QEMU/KVM versions, +emulating specific Hyper-V version, ...), it is recommended to enable all +currently implemented Hyper-V enlightenments with the following exceptions: + +- ``hv-syndbg``, ``hv-passthrough``, ``hv-enforce-cpuid`` should not be en= abled + in production configurations as these are debugging/development features. +- ``hv-reset`` can be avoided as modern Hyper-V versions don't expose it. +- ``hv-evmcs`` can (and should) be enabled on Intel CPUs only. While the f= eature + is only used in nested configurations (Hyper-V, WSL2), enabling it for r= egular + Windows guests should not have any negative effects. +- ``hv-no-nonarch-coresharing`` must only be enabled if vCPUs are properly= pinned + so no non-architectural core sharing is possible. +- ``hv-vendor-id``, ``hv-version-id-build``, ``hv-version-id-major``, + ``hv-version-id-minor``, ``hv-version-id-spack``, ``hv-version-id-sbranc= h``, + ``hv-version-id-snumber`` can be left unchanged, guests are not supposed= to + behave differently when different Hyper-V version is presented to them. +- ``hv-crash`` must only be enabled if the crash information is consumed v= ia + QAPI by higher levels of the virtualization stack. Enabling this feature + effectively prevents Windows from creating dumps upon crashes. +- ``hv-reenlightenment`` can only be used on hardware which supports TSC + scaling or when guest migration is not needed. +- ``hv-spinlocks`` should be set to e.g. 0xfff when host CPUs are overcomm= ited + (meaning there are other scheduled tasks or guests) and can be left unch= anged + from the default value (0xffffffff) otherwise. +- ``hv-avic``/``hv-apicv`` should not be enabled if the hardware does not + support APIC virtualization (Intel APICv, AMD AVIC). =20 Useful links ------------ --=20 2.43.2