Re: [PATCH v2] i386: Make migration fail when Hyper-V reenlightenment was enabled but 'user_tsc_khz' is unset

2021-03-29 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > * Vitaly Kuznetsov (vkuzn...@redhat.com) wrote: >> KVM doesn't fully support Hyper-V reenlightenment notifications on >> migration. In particular, it doesn't support emulating TSC frequency >> of the source host b

Re: [PATCH v2] i386: Make migration fail when Hyper-V reenlightenment was enabled but 'user_tsc_khz' is unset

2021-03-30 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > * Vitaly Kuznetsov (vkuzn...@redhat.com) wrote: >> "Dr. David Alan Gilbert" writes: >> >> > * Vitaly Kuznetsov (vkuzn...@redhat.com) wrote: >> >> KVM doesn't fully support Hyper-V reenlightenmen

[PATCH] i386: Make 'hv-reenlightenment' require explicit 'tsc-frequency' setting

2021-03-30 Thread Vitaly Kuznetsov
s works but the migration fail late and this may come as an unpleasant surprise. To make things more explicit, require 'tsc-frequency=' on the command line when 'hv-reenlightenment' was enabled. Make the change affect 6.0+ machine types only to preserve previously-valid configurat

[PATCH v2] i386: Make 'hv-reenlightenment' require explicit 'tsc-frequency' setting

2021-03-31 Thread Vitaly Kuznetsov
works but the migration fails late and this may come as an unpleasant surprise. To make things more explicit, require 'tsc-frequency=' on the command line when 'hv-reenlightenment' was enabled. Make the change affect 6.0+ machine types only to preserve previously-valid configu

[PATCH 0/2] i386: Fix interrupt based Async PF enablement

2021-04-01 Thread Vitaly Kuznetsov
machine types to preserve migration. This went unnoticed because of 1) I believe. Vitaly Kuznetsov (2): i386: Add 'kvm-asyncpf-int' to kvm_default_props array i386: Disable 'kvm-asyncpf-int' feature for machine types <= 5.1 hw/i386/pc.c | 1 + target/i386/cpu.c | 1 + 2 files changed, 2 insertions(+) -- 2.30.2

[PATCH 2/2] i386: Disable 'kvm-asyncpf-int' feature for machine types <= 5.1

2021-04-01 Thread Vitaly Kuznetsov
props[]' so it was rarely enabled. Fixes: db5daafab2 ("target/i386: support KVM_FEATURE_ASYNC_PF_INT") Signed-off-by: Vitaly Kuznetsov --- hw/i386/pc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 8a84b25a031e..04d5f76bf133 100644 --- a/h

[PATCH 1/2] i386: Add 'kvm-asyncpf-int' to kvm_default_props array

2021-04-01 Thread Vitaly Kuznetsov
Just like all other KVM PV features, 'kvm-asyncpf-int' needs to be added to all CPU models when KVM is enabled or the feature will always remain 'off' unless specified explicitly on the command line. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 1 + 1 file

Re: [PATCH 0/2] i386: Fix interrupt based Async PF enablement

2021-04-06 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 01/04/21 17:19, Vitaly Kuznetsov wrote: >> I noticed two issues with 'kvm-asyncpf-int' enablement: >> 1) We forgot to add to to kvm_default_props[] so it doesn't get enabled >> automatically (unless '-cpu host' is used

[PATCH RFC] target/i386: Add Intel CPU model versions supporting 'xsaves'

2021-04-07 Thread Vitaly Kuznetsov
PU models have 'xsaves' enabled from the very beginning so the comment blaming KVM to explain why Intel CPUs lack 'xsaves' is likely outdated. Signed-off-by: Vitaly Kuznetsov --- The only CPU model where I keep the original comment and don't add a version supporting 'xsa

Re: [PATCH RFC] target/i386: Add Intel CPU model versions supporting 'xsaves'

2021-04-08 Thread Vitaly Kuznetsov
Wen Pu writes: > On 2021/4/7 23:43, Vitaly Kuznetsov wrote: >> Hyper-V 2016 refuses to boot on Skylake+ CPU models because they lack >> 'xsaves'/'vmx-xsaves' features and this diverges from real hardware. The >> same issue emerges with AMD "EPYC"

[PATCH] target/i386: Add CPU model versions supporting 'xsaves'

2021-04-12 Thread Vitaly Kuznetsov
PU models have 'xsaves' enabled from the very beginning so the comment blaming KVM to explain why other CPUs lack 'xsaves' is likely outdated. Signed-off-by: Vitaly Kuznetsov --- This patch is a succesor of "[PATCH RFC] target/i386: Add Intel CPU model versions supporti

Re: [PATCH v7 3/9] i386: hardcode supported eVMCS version to '1'

2021-06-07 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Jun 04, 2021 at 09:28:15AM +0200, Vitaly Kuznetsov wrote: >> Eduardo Habkost writes: >> >> > On Thu, Jun 03, 2021 at 01:48:29PM +0200, Vitaly Kuznetsov wrote: >> >> Currently, the only eVMCS version, supported by KVM (and d

[PATCH v8 1/9] i386: avoid hardcoding '12' as 'hyperv_vendor_id' length

2021-06-08 Thread Vitaly Kuznetsov
While this is very unlikely to change, let's avoid hardcoding '12' as 'hyperv_vendor_id' length. No functional change intended. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 9 + 1 file changed, 5 insertions(+), 4 d

[PATCH v8 4/9] i386: make hyperv_expand_features() return bool

2021-06-08 Thread Vitaly Kuznetsov
Return 'false' when hyperv_expand_features() sets an error. No functional change intended. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 40 +--- 1 file changed, 21 insertions(+), 19 deletions(-) di

[PATCH v8 0/9] i386: KVM: expand Hyper-V features early

2021-06-08 Thread Vitaly Kuznetsov
and as we parse Hyper-V features after creating KVM vCPUs and not at feature expansion time. To support the use-case we first need to make KVM_GET_SUPPORTED_HV_CPUID ioctl a system-wide ioctl as the existing vCPU version can't be used that early. This is what KVM part does. With that done, we can mak

[PATCH v8 2/9] i386: clarify 'hv-passthrough' behavior

2021-06-08 Thread Vitaly Kuznetsov
Clarify the fact that 'hv-passthrough' only enables features which are already known to QEMU and that it overrides all other 'hv-*' settings. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 7 +-- 1 file changed, 5 insertions(+),

[PATCH v8 5/9] i386: expand Hyper-V features during CPU feature expansion time

2021-06-08 Thread Vitaly Kuznetsov
can't use kvm_arch_get_supported_cpuid() as Hyper-V specific CPUID leaves intersect with KVM's. Note, early expansion will only happen when KVM supports system wide KVM_GET_SUPPORTED_HV_CPUID ioctl (KVM_CAP_SYS_HYPERV_CPUID). Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov -

[PATCH v8 6/9] i386: kill off hv_cpuid_check_and_set()

2021-06-08 Thread Vitaly Kuznetsov
it. Also, in 'passthrough' mode we don't really need to check dependencies because KVM is supposed to provide a consistent set anyway. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 104 +++--- 1 file c

[PATCH v8 7/9] i386: HV_HYPERCALL_AVAILABLE privilege bit is always needed

2021-06-08 Thread Vitaly Kuznetsov
observed. We may, however, want to tighten the checks eventually. Conforming to the spec is probably also a good idea. Enable HV_HYPERCALL_AVAILABLE bit unconditionally. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 10 +- 1 file changed, 5

[PATCH v8 3/9] i386: hardcode supported eVMCS version to '1'

2021-06-08 Thread Vitaly Kuznetsov
blement options (e.g. 'hv-evmcs=2'). Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 2 +- target/i386/kvm/kvm.c | 39 +++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/docs/hyperv.txt b/docs/hyperv.txt index a51953daa

[PATCH v8 8/9] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS privileges

2021-06-08 Thread Vitaly Kuznetsov
When Hyper-V SynIC is enabled, we may need to allow Windows guests to make hypercalls (POST_MESSAGES/SIGNAL_EVENTS). No issue is currently observed because KVM is very permissive, allowing these hypercalls regarding of guest visible CPUid bits. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly

[PATCH v8 9/9] qtest/hyperv: Introduce a simple hyper-v test

2021-06-08 Thread Vitaly Kuznetsov
For the beginning, just test 'hv-passthrough' and a couple of custom Hyper-V enlightenments configurations through QMP. Later, it would be great to complement this by checking CPUID values from within the guest. Signed-off-by: Vitaly Kuznetsov --- MAINTAINERS | 1 + t

Re: [PATCH v8 3/9] i386: hardcode supported eVMCS version to '1'

2021-06-16 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Tue, Jun 08, 2021 at 02:08:11PM +0200, Vitaly Kuznetsov wrote: >> Currently, the only eVMCS version, supported by KVM (and described in TLFS) >> is '1'. When Enlightened VMCS feature is enabled, QEMU takes the supported >

Re: [PATCH v3] i386: docs: Briefly describe KVM PV features

2021-10-27 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Mon, 4 Oct 2021 16:04:45 +0200 > Vitaly Kuznetsov wrote: > Thanks for the review! As I can see, the patch already made it to 'master': commit 7f7c8d0ce3630849a4df3d627b11de354fcb3bb0 Author: Vitaly Kuznetsov Date: Mon Oct 4 16:04:45 2021 +0

Re: [PULL 04/11] i386: expand Hyper-V features during CPU feature expansion time

2021-07-16 Thread Vitaly Kuznetsov
Peter Maydell writes: > On Tue, 13 Jul 2021 at 17:19, Eduardo Habkost wrote: >> >> From: Vitaly Kuznetsov >> >> To make Hyper-V features appear in e.g. QMP query-cpu-model-expansion we >> need to expand and set the corresponding CPUID leaves early. Modify >

[PATCH 1/2] i386: assert 'cs->kvm_state' is not null

2021-07-16 Thread Vitaly Kuznetsov
ERV_CPUID is supported and KVM_CAP_SYS_HYPERV_CPUID implies KVM_CAP_HYPERV_CPUID so get_supported_hv_cpuid_legacy() is never really called. Add asserts to strengthen the protection against broken KVM behavior. Coverity: CID 1458243 Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 14

[PATCH 2/2] i386: Fix coding style in kvm_hyperv_expand_features()

2021-07-16 Thread Vitaly Kuznetsov
QEMU coding style requires braces around bodies of ifs. Reported-by: Peter Maydell Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e69abe48e3f8..28ca682b1089

Re: [PATCH v8 9/9] qtest/hyperv: Introduce a simple hyper-v test

2021-07-16 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Thu, 8 Jul 2021 17:02:22 -0400 > Eduardo Habkost wrote: > >> On Tue, Jun 08, 2021 at 02:08:17PM +0200, Vitaly Kuznetsov wrote: >> > For the beginning, just test 'hv-passthrough' and a couple of custom >> > Hyper-V enlighten

[PATCH] qtest/hyperv: Introduce a simple hyper-v test

2021-07-16 Thread Vitaly Kuznetsov
For the beginning, just test 'hv-passthrough' and a couple of custom Hyper-V enlightenments configurations through QMP. Later, it would be great to complement this by checking CPUID values from within the guest. Signed-off-by: Vitaly Kuznetsov --- - Changes since "[PATCH v8

Re: [PATCH] qtest/hyperv: Introduce a simple hyper-v test

2021-07-19 Thread Vitaly Kuznetsov
Andrew Jones writes: > On Fri, Jul 16, 2021 at 02:55:28PM +0200, Vitaly Kuznetsov wrote: >> For the beginning, just test 'hv-passthrough' and a couple of custom >> Hyper-V enlightenments configurations through QMP. Later, it would >> be great to complement thi

[PATCH 0/3] i386/kvm: Paravirtualized features usage enforcement

2021-07-22 Thread Vitaly Kuznetsov
v.txt. Vitaly Kuznetsov (3): docs: Briefly describe KVM PV features i386: Support KVM_CAP_ENFORCE_PV_FEATURE_CPUID i386: Support KVM_CAP_HYPERV_ENFORCE_CPUID docs/hyperv.txt | 17 +-- docs/kvm-pv.txt | 103 ++ target/i386/cpu.c

[PATCH 2/3] i386: Support KVM_CAP_ENFORCE_PV_FEATURE_CPUID

2021-07-22 Thread Vitaly Kuznetsov
10 and is not enabled by default in QEMU. Signed-off-by: Vitaly Kuznetsov --- docs/kvm-pv.txt | 13 - target/i386/cpu.c | 2 ++ target/i386/cpu.h | 3 +++ target/i386/kvm/kvm.c | 10 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/kvm-pv.t

[PATCH 3/3] i386: Support KVM_CAP_HYPERV_ENFORCE_CPUID

2021-07-22 Thread Vitaly Kuznetsov
enlightenments. The feature is supported by Linux >= 5.14 and is not enabled by default in QEMU. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 17 ++--- target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + target/i386/kvm/kvm.c | 9 + 4 files changed,

[PATCH 1/3] docs: Briefly describe KVM PV features

2021-07-22 Thread Vitaly Kuznetsov
KVM PV features don't seem to be documented anywhere, in particular, the fact that some of the features are enabled by default and some are not can only be figured out from the code. Signed-off-by: Vitaly Kuznetsov --- docs/kvm-pv.txt | 92 +++

Re: [PATCH v2 0/8] i386: Assorted KVM PV and Hyper-V feature improvements

2021-09-17 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > This is a continuation of "[PATCH 0/3] i386/kvm: Paravirtualized features > usage > enforcement" series, thus v2. > > This series implements several unrelated features but as there are code > dependencies between them I'm sending

Re: [PATCH v2 0/8] i386: Assorted KVM PV and Hyper-V feature improvements

2021-09-30 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 02/09/21 11:35, Vitaly Kuznetsov wrote: >> This is a continuation of "[PATCH 0/3] i386/kvm: Paravirtualized features >> usage >> enforcement" series, thus v2. >> >> This series implements several unrelated features but as

[PATCH v3] i386: docs: Briefly describe KVM PV features

2021-10-04 Thread Vitaly Kuznetsov
KVM PV features don't seem to be documented anywhere, in particular, the fact that some of the features are enabled by default and some are not can only be figured out from the code. Signed-off-by: Vitaly Kuznetsov --- Changes since "[PATCH v2 0/8] i386: Assorted KVM PV and Hyper

[PATCH 3/3] i386: Make sure kvm_arch_set_tsc_khz() succeeds on migration when 'hv-reenlightenment' was exposed

2021-03-18 Thread Vitaly Kuznetsov
tsc_khz to it. We already have env.tsc_khz packed in 'cpu/tsc_khz' but we don't want to be dependent on the section order. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/hyperv.h | 1 + target/i386/kvm/kvm.c| 11 +++ target/i386/machine.c| 37

[PATCH 0/3] i386: Make sure TSC frequency is preserved across migration when Hyper-V reenlightenment is in use

2021-03-18 Thread Vitaly Kuznetsov
to proceed with migration. Vitaly Kuznetsov (3): i386: Make Hyper-V related sections KVM only i386: Fix 'hypercall_hypercall' typo i386: Make sure kvm_arch_set_tsc_khz() succeeds on migration when 'hv-reenlightenment' was exposed target/i386/kvm/hyperv.h | 1 +

[PATCH 2/3] i386: Fix 'hypercall_hypercall' typo

2021-03-18 Thread Vitaly Kuznetsov
Even the name of this section is 'cpu/msr_hyperv_hypercall', 'hypercall_hypercall' is clearly a typo. Signed-off-by: Vitaly Kuznetsov --- target/i386/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/machine.c b/target/

[PATCH 1/3] i386: Make Hyper-V related sections KVM only

2021-03-18 Thread Vitaly Kuznetsov
Currently, Hyper-V enlightenments are only implemented by KVM so there's no need to have corresponding vmstate_x86_cpu sections when !CONFIG_KVM. Signed-off-by: Vitaly Kuznetsov --- target/i386/machine.c | 4 1 file changed, 4 insertions(+) diff --git a/target/i386/machine.c b/target

Re: [PATCH 3/3] i386: Make sure kvm_arch_set_tsc_khz() succeeds on migration when 'hv-reenlightenment' was exposed

2021-03-18 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 18/03/21 17:02, Vitaly Kuznetsov wrote: >> KVM doesn't fully support Hyper-V reenlightenment notifications on >> migration. In particular, it doesn't support emulating TSC frequency >> of the source host by trapping all TSC acces

Re: [PATCH 3/3] i386: Make sure kvm_arch_set_tsc_khz() succeeds on migration when 'hv-reenlightenment' was exposed

2021-03-19 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 18/03/21 17:38, Vitaly Kuznetsov wrote: >>> Could we instead fail to load the reenlightenment section if >>> user_tsc_khz was not set? This seems to be user (well, management) >>> error really, since reenlightenment has to be en

Re: [PATCH 3/3] i386: Make sure kvm_arch_set_tsc_khz() succeeds on migration when 'hv-reenlightenment' was exposed

2021-03-19 Thread Vitaly Kuznetsov
Marcelo Tosatti writes: > On Thu, Mar 18, 2021 at 05:38:00PM +0100, Vitaly Kuznetsov wrote: >> Paolo Bonzini writes: >> >> > On 18/03/21 17:02, Vitaly Kuznetsov wrote: >> >> KVM doesn't fully support Hyper-V reenlightenment notifications on >>

Re: [PATCH 3/3] i386: Make sure kvm_arch_set_tsc_khz() succeeds on migration when 'hv-reenlightenment' was exposed

2021-03-19 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 19/03/21 10:41, Vitaly Kuznetsov wrote: >>> What I want to achieve is to forbid migration of VMs with >>> reenlightenment, if they don't also specify tsc-khz to the frequency of >>> the TSC on the source host. We can't check i

[PATCH v2] i386: Make migration fail when Hyper-V reenlightenment was enabled but 'user_tsc_khz' is unset

2021-03-19 Thread Vitaly Kuznetsov
nlightenment' use-case as we have to guarantee that TSC frequency stays constant. Require 'tsc-frequency=' command line option to be specified for successful migration when re-enlightenment was enabled by the guest. Signed-off-by: Vitaly Kuznetsov --- This patch is a s

Re: [PATCH 0/2] i386: Add support for Hyper-V Enlightened MSR-Bitmap feature

2022-01-27 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > The new nested specific enlightenment speeds up L2 vmexits by avoiding > unnecessary updates to L2 MSR-Bitmap. Support for both VMX and SVM is > coming to KVM: > https://lore.kernel.org/kvm/20211129094704.326635-1-vkuzn...@redhat.com/ > https://lore

[PATCH v2 1/3] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES

2022-02-17 Thread Vitaly Kuznetsov
handling to hv_build_cpuid_leaf() and drop now-unneeded 'hyperv_nested'. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h | 1 - target/i386/kvm/kvm.c | 23 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/

[PATCH v2 0/3] i386: Add support for Hyper-V Enlightened MSR-Bitmap and XMM fast hypercall input features

2022-02-17 Thread Vitaly Kuznetsov
eature on Intel CPUs is coming in v5.17 and is queued for 5.18 for AMD CPUs. Vitaly Kuznetsov (3): i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES i386: Hyper-V Enlightened MSR bitmap feature i386: Hyper-V XMM fast hypercall input feature docs/hyperv.txt| 16 +++

[PATCH v2 2/3] i386: Hyper-V Enlightened MSR bitmap feature

2022-02-17 Thread Vitaly Kuznetsov
The newly introduced enlightenment allow L0 (KVM) and L1 (Hyper-V) hypervisors to collaborate to avoid unnecessary updates to L2 MSR-Bitmap upon vmexits. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h

[PATCH v2 3/3] i386: Hyper-V XMM fast hypercall input feature

2022-02-17 Thread Vitaly Kuznetsov
e HV_HYPERCALL_{PARAMS_XMM_AVAILABLE -> XMM_INPUT_AVAILABLE} to comply with KVM. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 6 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + target/i386/kvm/hyperv-proto.h | 2 +- target/i386/kvm/

[PATCH 2/2] vmxcap: Add 5-level EPT bit

2022-02-21 Thread Vitaly Kuznetsov
5-level EPT is present in Icelake Server CPUs and is supported by QEMU ('vmx-page-walk-5'). Signed-off-by: Vitaly Kuznetsov --- scripts/kvm/vmxcap | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index 6fe66d5f5753..f140040104bf 100755 ---

[PATCH 1/2] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support

2022-02-21 Thread Vitaly Kuznetsov
r-v6' CPU model with 'vmx-page-walk-5' enabled by default. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 8 1 file changed, 8 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index aa9e6368004c..6e25d1333971 100644 --- a/target/i386/cpu.c +++ b/ta

Re: [Qemu-devel] [PATCH 6/8] i386/kvm: hv-stimer requires hv-time and hv-synic

2022-04-12 Thread Vitaly Kuznetsov
Divya Garg writes: > Hi Vitaly Kuznetsov ! > I was working on hyperv flags and saw that we introduced new > dependencies some > time back > (https://sourcegraph.com/github.com/qemu/qemu/-/commit/c686193072a47032d83cb4e131dc49ae30f9e5d7?visible=1). > After these changes,

Re: [Qemu-devel] [PATCH 6/8] i386/kvm: hv-stimer requires hv-time and hv-synic

2022-04-12 Thread Vitaly Kuznetsov
Divya Garg writes: > On 12/04/22 6:18 pm, Vitaly Kuznetsov wrote: >> Divya Garg writes: >> >>> Hi Vitaly Kuznetsov ! >>> I was working on hyperv flags and saw that we introduced new >>> dependencies some >>> time back &g

[PATCH 2/2] i386: Hyper-V Enlightened MSR bitmap feature

2022-01-05 Thread Vitaly Kuznetsov
The newly introduced enlightenment allow L0 (KVM) and L1 (Hyper-V) hypervisors to collaborate to avoid unnecessary updates to L2 MSR-Bitmap upon vmexits. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h

[PATCH 0/2] i386: Add support for Hyper-V Enlightened MSR-Bitmap feature

2022-01-05 Thread Vitaly Kuznetsov
...@redhat.com/ Vitaly Kuznetsov (2): i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES i386: Hyper-V Enlightened MSR bitmap feature docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 2 +- target/i386/kvm/hyperv-proto.h

[PATCH 1/2] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES

2022-01-05 Thread Vitaly Kuznetsov
handling to hv_build_cpuid_leaf() and drop now-unneeded 'hyperv_nested'. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h | 1 - target/i386/kvm/kvm.c | 23 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/

Re: [PATCH v2 0/3] i386: Add support for Hyper-V Enlightened MSR-Bitmap and XMM fast hypercall input features

2022-03-06 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > 'XMM fast hypercall input feature' is supported by KVM since v5.14, > it allows for faster Hyper-V hypercall processing. > > 'Enlightened MSR-Bitmap' is a new nested specific enlightenment speeds up > L2 vmexits by avoiding unnece

[PATCH] target/i386: do not set unsupported VMX secondary execution controls

2020-03-31 Thread Vitaly Kuznetsov
instead as these [are supposed to] come together. Fixes: 048c95163b4 ("target/i386: work around KVM_GET_MSRS bug for secondary execution controls") Suggested-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 41 ++--- 1 fil

Re: [PATCH] target/i386: do not set unsupported VMX secondary execution controls

2020-04-01 Thread Vitaly Kuznetsov
"Montes, Julio" writes: > Hi Vitaly > > thanks for raising this, unfortunately this patch didn't work for me, I still > get the same error: > > Does you kernel have 95c5c7c77c ("KVM: nVMX: list VMX MSRs in KVM_GET_MSR_INDEX_LIST")? -- Vitaly

Re: [PATCH] target/i386: do not set unsupported VMX secondary execution controls

2020-04-01 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > So you would think that would tkae care of RDSEED exiting - but what > about VMCS shadowing? > SECONDARY_EXEC_SHADOW_VMCS is special, we are able to emulate it in KVM even when it is not supported by hardware, see nested_vmx_setup_ctls_msrs(): /*

Re: [PATCH] target/i386: do not set unsupported VMX secondary execution controls

2020-04-01 Thread Vitaly Kuznetsov
"Montes, Julio" writes: >> Does you kernel have 95c5c7c77c ("KVM: nVMX: list VMX MSRs in >> KVM_GET_MSR_INDEX_LIST")? > > I was using linux 5.0.0, now I have 5.3.0 and it's working, thanks for fixing > this > Thanks for the confirmation! I don't see any good solution for kernels without 95c5c7

[Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2020-03-06 Thread Vitaly Kuznetsov
If you're seeing "KVM internal error. Suberror: 1" it can be multiple things, not necessarily the same bug. Could you please confirm that: - You are running a nested configuration - The issue is observed with a UEFI booted guest BTW, kernel 5.4 you have has the patch fixing the original bug. --

[Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2020-03-09 Thread Vitaly Kuznetsov
'nested' parameter for kvm_intel module controls whether you're able to run nested configurations and it is enabled by default, it doesn't say anything about whether your configuration is nested or not. Could you please describe your environment? In case it is nested, it will look like: L0(host)

[Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2020-03-10 Thread Vitaly Kuznetsov
With Win10 you need to make sure it is not running Hyper-V under the hood (e.g. when you enable Hyper-V role Windows will put itself in a VM -- and thus you will get a nested environment). To be 100% sure do the following: # rmmod kvm_intel # modprobe kvm_intel nested=0 And see if the issue repro

[Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2020-03-10 Thread Vitaly Kuznetsov
Thanks for checking, this is a different issue then, please open a new bug. Also, if I understood you correctly, the problem appeared after an upgrade? It would make sense to try to bisect between qemu and kernel versions (personally, I'd start with kernel because it's easier to rollback and has h

[Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2020-03-10 Thread Vitaly Kuznetsov
Sorry but I'm not at all familiar with bug reporting process in Ubuntu. The "KVM internal error. Suberror: 1" issue is definitely not libvirt related (may be induced by the VM configuration created in libvirt but that's it). -- You received this bug notification because you are a member of qemu-

Re: kvm_buf_set_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.

2020-05-14 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > * Philippe Mathieu-Daudé (phi...@redhat.com) wrote: >> Cc'ing David/Paolo in case they have a clue... >> >> On 5/14/20 1:27 PM, Li Feng wrote: >> > Dear all, >> > >> > I have encountered a weird crash. >> > I remember before a few days it works well and I reb

[PATCH] i386/kvm: correct the meaning of '0xffffffff' value for hv-spinlocks

2020-05-15 Thread Vitaly Kuznetsov
on 6.0 the mistake was corrected to 'never notify' which sounds logical. Fix QEMU accordingly. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 2 +- target/i386/cpu.c | 2 +- target/i386/cpu.h | 4 ++-- target/i386/kvm.c | 4 ++-- 4 files changed, 6 insertions(+), 6 dele

[PATCH RFC] memory: pause all vCPUs for the duration of memory transactions

2020-10-26 Thread Vitaly Kuznetsov
ansaction in one shot but as a band-aid we can just pause all vCPUs to make memory transations atomic. Reported-by: Dr. David Alan Gilbert Signed-off-by: Vitaly Kuznetsov --- RFC: Generally, memap updates happen only a few times during guest boot but I'm not sure there are no scena

Re: [PATCH RFC] memory: pause all vCPUs for the duration of memory transactions

2020-10-27 Thread Vitaly Kuznetsov
David Hildenbrand writes: > On 26.10.20 11:43, David Hildenbrand wrote: >> On 26.10.20 09:49, Vitaly Kuznetsov wrote: >>> Currently, KVM doesn't provide an API to make atomic updates to memmap when >>> the change touches more than one memory slot, e.g. in case we&

Re: [PATCH RFC] memory: pause all vCPUs for the duration of memory transactions

2020-10-27 Thread Vitaly Kuznetsov
David Hildenbrand writes: > On 27.10.20 14:02, Vitaly Kuznetsov wrote: >> >> Sorry for not being clear: your patch looks good to me, what I tried to >> say is that with the current KVM API the only way to guarantee atomicity >> of the update is to make vCPUs stop (o

Re: [PATCH RFC] memory: pause all vCPUs for the duration of memory transactions

2020-10-27 Thread Vitaly Kuznetsov
David Hildenbrand writes: > On 27.10.20 13:36, Vitaly Kuznetsov wrote: >> David Hildenbrand writes: >> >>> On 26.10.20 11:43, David Hildenbrand wrote: >>>> On 26.10.20 09:49, Vitaly Kuznetsov wrote: >>>>> Currently, KVM doesn't pro

Re: [PATCH RFC] memory: pause all vCPUs for the duration of memory transactions

2020-10-27 Thread Vitaly Kuznetsov
David Hildenbrand writes: >>> Same applies to all other kinds of operations (splitting, punching out, >>> ...) as you also mentioned. >> >> One question from a QEMU newbie though: why do you put >> kvm_ioctl_inhibit_begin()/kvm_ioctl_inhibit_end() to kvm_region_resize() >> only and not taking it

Re: [PATCH 1/5] i386: move hyperv_vendor_id initialization to x86_cpu_realizefn()

2021-03-10 Thread Vitaly Kuznetsov
Claudio Fontana writes: > On 11/19/20 11:32 AM, Vitaly Kuznetsov wrote: >> As a preparation to expanding Hyper-V CPU features early, move >> hyperv_vendor_id initialization to x86_cpu_realizefn(). Introduce >> x86_cpu_hyperv_realize() to not not pollute x86_cpu_

Re: [PATCH 1/5] i386: move hyperv_vendor_id initialization to x86_cpu_realizefn()

2021-03-10 Thread Vitaly Kuznetsov
Claudio Fontana writes: > On 3/10/21 12:43 PM, Vitaly Kuznetsov wrote: >> Claudio Fontana writes: >> >>> On 11/19/20 11:32 AM, Vitaly Kuznetsov wrote: >>>> As a preparation to expanding Hyper-V CPU features early, move >>>> hyperv_vendor_id

Re: [PATCH v3 18/19] i386: provide simple 'hv-default=on' option

2021-01-21 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Thu, 21 Jan 2021 09:45:33 +0100 > Vitaly Kuznetsov wrote: > >> > >> > So far I read snippet above as a problem: >> > 1: >> > host supports evmcs: >> > and exposes HYPERV_FEAT_EVMCS in CPUID >> >&g

[PATCH v4 02/21] i386: invert hyperv_spinlock_attempts setting logic with hv_passthrough

2021-02-10 Thread Vitaly Kuznetsov
There is no need to have this special case: like all other Hyper-V enlightenments we can just use kernel's supplied value in hv_passthrough mode. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/i38

[PATCH v4 00/19] i386: KVM: expand Hyper-V features early and provide simple 'hv-default=on' option

2021-02-10 Thread Vitaly Kuznetsov
is what KVM part does. With that done, we can make early Hyper-V feature expansion (this series). In addition, provide a simple 'hv-default' option which enables (and requires from KVM) all currently supported Hyper-V enlightenments. Unlike 'hv-passthrough' mode, this is going to

[PATCH v4 07/21] i386: drop FEAT_HYPERV feature leaves

2021-02-10 Thread Vitaly Kuznetsov
converted to using raw CPUID func/reg pairs for features, this allows us to get rid of hv_cpuid_get_fw() conversion. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 90 +-- target/i386/cpu.h | 5 -- target/i386/kvm/kvm.c | 108 ++---

[PATCH v4 04/21] i386: stop using env->features[] for filling Hyper-V CPUIDs

2021-02-10 Thread Vitaly Kuznetsov
As a preparatory patch to dropping Hyper-V CPUID leaves from feature_word_info[] stop using env->features[] as a temporary storage of Hyper-V CPUIDs, just build Hyper-V CPUID leaves directly from kvm_hyperv_properties[] data. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h |

[PATCH v4 10/21] i386: move eVMCS enablement to hyperv_init_vcpu()

2021-02-10 Thread Vitaly Kuznetsov
hyperv_expand_features() will be called before we create vCPU so evmcs enablement should go away. hyperv_init_vcpu() looks like the right place. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 60 ++- 1 file changed, 37 insertions(+), 23

[PATCH v4 03/21] i386: always fill Hyper-V CPUID feature leaves from X86CPU data

2021-02-10 Thread Vitaly Kuznetsov
guest but arguably this is a good change. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 9 - 1 file changed, 9 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 211efbd13b49..ba285a364792 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386

[PATCH v4 08/21] i386: introduce hv_cpuid_cache

2021-02-10 Thread Vitaly Kuznetsov
ote, hv_cpuid_get_fw() is converted to using hv_cpuid_get_host() just to be removed later with Hyper-V specific feature words. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 109 ++ 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/target/i386/

[PATCH v4 05/21] i386: introduce hyperv_feature_supported()

2021-02-10 Thread Vitaly Kuznetsov
Clean up hv_cpuid_check_and_set() by separating hyperv_feature_supported() off it. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 49 ++- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/target

[PATCH v4 01/21] i386: keep hyperv_vendor string up-to-date

2021-02-10 Thread Vitaly Kuznetsov
7;s query-cpu-model-expansion output is incorrect. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 19 +-- target/i386/kvm/kvm.c | 4 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 9c3d2d60b7e5..d03c

[PATCH v4 16/21] i386: track explicit 'hv-*' features enablement/disablement

2021-02-10 Thread Vitaly Kuznetsov
ation time when 'hv-passthrough' is specified and we're running on an older kernel without KVM_CAP_SYS_HYPERV_CPUID support. To get the list of the supported Hyper-V features we need to actually create KVM VCPU and this happens much later. No

[PATCH v4 06/21] i386: introduce hv_cpuid_get_host()

2021-02-10 Thread Vitaly Kuznetsov
As a preparation to implementing hv_cpuid_cache intro introduce hv_cpuid_get_host(). No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 100 +++--- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/target

[PATCH v4 13/21] i386: prefer system KVM_GET_SUPPORTED_HV_CPUID ioctl over vCPU's one

2021-02-10 Thread Vitaly Kuznetsov
KVM_GET_SUPPORTED_HV_CPUID was made a system wide ioctl which can be called prior to creating vCPUs and we are going to use that to expand Hyper-V cpu features early. Use it when it is supported by KVM. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 17 + 1 file

[PATCH v4 15/21] i386: expand Hyper-V features during CPU feature expansion time

2021-02-10 Thread Vitaly Kuznetsov
can't use kvm_arch_get_supported_cpuid() as Hyper-V specific CPUID leaves intersect with KVM's. Note, early expansion will only happen when KVM supports system wide KVM_GET_SUPPORTED_HV_CPUID ioctl (KVM_CAP_SYS_HYPERV_CPUID). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c

[PATCH v4 09/21] i386: split hyperv_handle_properties() into hyperv_expand_features()/hyperv_fill_cpuids()

2021-02-10 Thread Vitaly Kuznetsov
The intention is to call hyperv_expand_features() early, before vCPUs are created and use the acquired data later when we set guest visible CPUID data. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 34 -- 1 file changed, 24 insertions(+), 10

[PATCH v4 12/21] i386: adjust the expected KVM_GET_SUPPORTED_HV_CPUID array size

2021-02-10 Thread Vitaly Kuznetsov
SYNDBG leaves were recently (Linux-5.8) added to KVM but we haven't updated the expected size of KVM_GET_SUPPORTED_HV_CPUID output in KVM so we now make serveral tries before succeeding. Update the default. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 3 ++- 1 file chang

[PATCH v4 21/21] qtest/hyperv: Introduce a simple hyper-v test

2021-02-10 Thread Vitaly Kuznetsov
For the beginning, just test 'hv-default', 'hv-passthrough' and a couple of custom Hyper-V enlightenments configurations through QMP. Later, it would be great to complement this by checking CPUID values from within the guest. Signed-off-by: Vitaly Kuznetsov --- MAINTAINERS

[PATCH v4 11/21] i386: switch hyperv_expand_features() to using error_setg()

2021-02-10 Thread Vitaly Kuznetsov
Use standard error_setg() mechanism in hyperv_expand_features(). Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 101 +- 1 file changed, 61 insertions(+), 40 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index

[PATCH v4 18/21] i386: be more picky about implicit 'hv-evmcs' enablement

2021-02-10 Thread Vitaly Kuznetsov
ently, the only possible scenario is 'hv-passthrough' which will enable 'hv-evmcs' when the host supports it, regardless of guest VMX exposure. The upcoming 'hv-default' should also avoid enabling 'hv-evmcs' without VMX. Signed-off-by: Vitaly Kuznetsov --- targe

[PATCH v4 20/21] i386: provide simple 'hv-default=on' option

2021-02-10 Thread Vitaly Kuznetsov
tion. Introduce a simple 'hv-default=on' CPU flag enabling all currently supported Hyper-V enlightenments. Later, when new enlightenments get implemented, compat_props mechanism will be used to disable them for legacy machine types, this will keep 'hv-default=on' configurations

[PATCH v4 14/21] i386: use global kvm_state in hyperv_enabled() check

2021-02-10 Thread Vitaly Kuznetsov
There is no need to use vCPU-specific kvm state in hyperv_enabled() check and we need to do that when feature expansion happens early, before vCPU specific KVM state is created. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions

[PATCH v4 17/21] i386: support 'hv-passthrough, hv-feature=off' on the command line

2021-02-10 Thread Vitaly Kuznetsov
ure". While on it, make 'hv-passthrough' parse semantics in-line with other options in qemu: when specified, it overrides what was previously set with what's supported by the host. This can later be modified with 'hv-feature=on'/ 'hv-feat

[PATCH v4 19/21] i386: introduce kvm_hv_evmcs_available()

2021-02-10 Thread Vitaly Kuznetsov
Enlightened VMCS feature is hardware specific, it is only supported on Intel CPUs. Introduce a simple kvm_hv_evmcs_available() helper, it will be used to filter out 'hv_evmcs' when 'hyperv=on' option is added to X86MachineClass. Signed-off-by: Vitaly Kuznetsov --- target/i38

  1   2   3   4   5   6   >