KVM: issues with XSAVE support
Paolo Bonzini
maintainercover KVM: issues with XSAVE support
This series fixes two migration bugs concerning KVM's XSAVE ioctls, both found by code inspection (the second in fact is just theoretical until AVX512 or MPX support is added to KVM).
Please review.
Paolo Bonzini (2):
x86: fix migration from pre-version 12
KVM: make XSAVE support more robust
target-i386/cpu.c | 1 + target-i386/cpu.h | 5 +++++ target-i386/kvm.c | 3 ++- target-i386/machine.c | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
Paolo Bonzini
maintainerPATCH 1/2 x86: fix migration from pre-version 12
On KVM, the KVM_SET_XSAVE would be executed with a 0 xstate_bv, and not restore anything.
Since FP and SSE data are always valid, set them in xstate_bv at reset time. In fact, that value is the same that KVM_GET_XSAVE returns on pre-XSAVE hosts.
--- target-i386/cpu.c | 1 + target-i386/cpu.h | 5 +++++ 2 files changed, 6 insertions(+)
target-i386/cpu.c +1 -0
@@ -2386,6 +2386,7 @@ static void x86_cpu_reset(CPUState *s) env->fpuc =0x37f ; env->mxcsr =0x1f80 ; + env->xstate_bv =XSTATE_FP |XSTATE_SSE ; env->pat =0x0007040600070406ULL ; env->msr_ia32_misc_enable =MSR_IA32_MISC_ENABLE_DEFAULT ;
target-i386/cpu.h +5 -0
@@ -380,6 +380,11 @@#define MSR_VM_HSAVE_PA 0xc0010117 +#define XSTATE_SUPPORTED (XSTATE_FP|XSTATE_SSE|XSTATE_YMM) +#define XSTATE_FP 1 +#define XSTATE_SSE 2 +#define XSTATE_YMM 4 +/* CPUID feature words */ typedef enum FeatureWord { FEAT_1_EDX, /* CPUID[1].EDX */
Signature · 1 line
1.8.3.1
Re: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Quoted 3 lines · Paolo Bonzini
On KVM, the
KVM_SET_XSAVEwould be executed with a 0xstate_bv, and not restore anything.
XRSTOR restores FP/SSE state to reset state if no bits are set in xstate_bv. This is what should happen on reset, no?
Quoted 3 lines
Since FP and SSE data are always valid, set them in
xstate_bvat reset time. In fact, that value is the same thatKVM_GET_XSAVEreturns on pre-XSAVE hosts.
It is needed for migration between non xsave host to xsave host.
Quoted 24 lines
Signed-off-by Paolo Bonzini <[email protected]>--- target-i386/cpu.c | 1 + target-i386/cpu.h | 5 +++++ 2 files changed, 6 insertions(+)target-i386/cpu.c +1
-0@@ -2386,6 +2386,7 @@ static void x86_cpu_reset(CPUState *s) env->fpuc =0x37f ; env->mxcsr =0x1f80 ; + env->xstate_bv =XSTATE_FP |XSTATE_SSE ; env->pat =0x0007040600070406ULL ; env->msr_ia32_misc_enable =MSR_IA32_MISC_ENABLE_DEFAULT ;target-i386/cpu.h +0
-0
target-i386/cpu.h line 383
Quoted 4 lines
target-i386/cpu.h +1
-0@@ -380,6 +380,11 @@#define MSR_VM_HSAVE_PA 0xc0010117 +#define XSTATE_SUPPORTED (XSTATE_FP|XSTATE_SSE|XSTATE_YMM)
Supported by whom? By QEMU? We should filer unsupported bits from CPUID.0D then too.
Quoted 10 lines
target-i386/cpu.h +4
-0+#define XSTATE_FP 1 +#define XSTATE_SSE 2 +#define XSTATE_YMM 4 +/* CPUID feature words */ typedef enum FeatureWord { FEAT_1_EDX, /* CPUID[1].EDX */Signature · 1 line
1.8.3.1
--
Gleb.
Paolo Bonzini
maintainerRe: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Il 08/09/2013 13:40, Gleb Natapov ha scritto:
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines
On KVM, the
KVM_SET_XSAVEwould be executed with a 0xstate_bv, and not restore anything.XRSTOR restores FP/SSE state to reset state if no bits are set in
xstate_bv. This is what should happen on reset, no?
Yes. The problem happens on the migration destination when XSAVE data is not transmitted. FP/SSE data is transmitted and must be restored, but xstate_bv is zero and KVM_SET_XSAVE restores FP/SSE state to reset state. The vcpu then loses the values that were set in the migration data.
Quoted 4 lines
Quoted 3 lines
Since FP and SSE data are always valid, set them in
xstate_bvat reset time. In fact, that value is the same thatKVM_GET_XSAVEreturns on pre-XSAVE hosts.It is needed for migration between non xsave host to xsave host.
Yes, and this patch does the same for migration between non-XSAVE QEMU and XSAVE QEMU.
In fact, another bug is that kvm_vcpu_ioctl_x86_set_xsave ignores xstate_bv when XSAVE is not available. Instead, it should reset the FXSAVE data to processor-reset values (except for MXCSR which always comes from XRSTOR data), i.e. to all-zeros except for the x87 control and tag words. It should also check reserved bits of MXCSR.
Quoted 25 lines
Quoted 25 lines
Signed-off-by Paolo Bonzini <[email protected]>--- target-i386/cpu.c | 1 + target-i386/cpu.h | 5 +++++ 2 files changed, 6 insertions(+)target-i386/cpu.c +1
-0@@ -2386,6 +2386,7 @@ static void x86_cpu_reset(CPUState *s) env->fpuc =0x37f ; env->mxcsr =0x1f80 ; + env->xstate_bv =XSTATE_FP |XSTATE_SSE ; env->pat =0x0007040600070406ULL ; env->msr_ia32_misc_enable =MSR_IA32_MISC_ENABLE_DEFAULT ;target-i386/cpu.h +0
-0@@ -380,6 +380,11 @@
Quoted 4 lines
target-i386/cpu.h line 383
Quoted 3 lines
target-i386/cpu.h +1
-0#define MSR_VM_HSAVE_PA 0xc0010117 +#define XSTATE_SUPPORTED (XSTATE_FP|XSTATE_SSE|XSTATE_YMM)Supported by whom? By QEMU? We should filer unsupported bits from CPUID.0D then too.
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
Paolo
Quoted 19 lines
Quoted 11 lines
target-i386/cpu.h +4
-0+#define XSTATE_FP 1 +#define XSTATE_SSE 2 +#define XSTATE_YMM 4 +/* CPUID feature words */ typedef enum FeatureWord { FEAT_1_EDX, /* CPUID[1].EDX */Signature · 1 line
1.8.3.1--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Quoted 13 lines · Paolo Bonzini
Il 08/09/2013 13:40, Gleb Natapov ha scritto:
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines
On KVM, the
KVM_SET_XSAVEwould be executed with a 0xstate_bv, and not restore anything.XRSTOR restores FP/SSE state to reset state if no bits are set in
xstate_bv. This is what should happen on reset, no?Yes. The problem happens on the migration destination when XSAVE data is not transmitted. FP/SSE data is transmitted and must be restored, but
xstate_bvis zero andKVM_SET_XSAVErestores FP/SSE state to reset state. The vcpu then loses the values that were set in the migration data.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Since FP and SSE data are always valid, set them in
xstate_bvat reset time. In fact, that value is the same thatKVM_GET_XSAVEreturns on pre-XSAVE hosts.It is needed for migration between non xsave host to xsave host.
Yes, and this patch does the same for migration between non-XSAVE QEMU and XSAVE QEMU.
Can such migration happen? The commit that added xsave support (f1665b21f16c5dc0ac37de60233a4975aff31193) changed vmstate version id.
Quoted 6 lines
In fact, another bug is that
kvm_vcpu_ioctl_x86_set_xsaveignoresxstate_bvwhen XSAVE is not available. Instead, it should reset the FXSAVE data to processor-reset values (except for MXCSR which always comes from XRSTOR data), i.e. to all-zeros except for the x87 control and tag words. It should also check reserved bits of MXCSR.
I do not see why.
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Signed-off-by Paolo Bonzini <[email protected]>--- target-i386/cpu.c | 1 + target-i386/cpu.h | 5 +++++ 2 files changed, 6 insertions(+)target-i386/cpu.c +1
-0@@ -2386,6 +2386,7 @@ static void x86_cpu_reset(CPUState *s) env->fpuc =0x37f ; env->mxcsr =0x1f80 ; + env->xstate_bv =XSTATE_FP |XSTATE_SSE ; env->pat =0x0007040600070406ULL ; env->msr_ia32_misc_enable =MSR_IA32_MISC_ENABLE_DEFAULT ;target-i386/cpu.h +0
-0@@ -380,6 +380,11 @@
Quoted 8 lines
Quoted 4 lines
target-i386/cpu.h line 383
Quoted 3 lines
target-i386/cpu.h +1
-0#define MSR_VM_HSAVE_PA 0xc0010117 +#define XSTATE_SUPPORTED (XSTATE_FP|XSTATE_SSE|XSTATE_YMM)Supported by whom? By QEMU? We should filer unsupported bits from CPUID.0D then too.
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
IMO this is the main issue here, not separate bug. If we gonna let guest use CPU state QEMU does not support we gonna have a bad time.
--
Gleb.
Paolo Bonzini
maintainerRe: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Il 09/09/2013 11:03, Gleb Natapov ha scritto:
Quoted 17 lines · Paolo Bonzini
Quoted 16 lines
Il 08/09/2013 13:40, Gleb Natapov ha scritto:
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines
On KVM, the
KVM_SET_XSAVEwould be executed with a 0xstate_bv, and not restore anything.XRSTOR restores FP/SSE state to reset state if no bits are set in
xstate_bv. This is what should happen on reset, no?Yes. The problem happens on the migration destination when XSAVE data is not transmitted. FP/SSE data is transmitted and must be restored, but
xstate_bvis zero andKVM_SET_XSAVErestores FP/SSE state to reset state. The vcpu then loses the values that were set in the migration data.Quoted 3 lines
Quoted 3 lines
Since FP and SSE data are always valid, set them in
xstate_bvat reset time. In fact, that value is the same thatKVM_GET_XSAVEreturns on pre-XSAVE hosts.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
It is needed for migration between non xsave host to xsave host.
Yes, and this patch does the same for migration between non-XSAVE QEMU and XSAVE QEMU.
Can such migration happen? The commit that added xsave support (
f1665b21f16c5dc0ac37de60233a4975aff31193) changed vmstate version id.
Yes, old->new migration can happen. New->old of course cannot.
Quoted 7 lines
Quoted 5 lines
In fact, another bug is that
kvm_vcpu_ioctl_x86_set_xsaveignoresxstate_bvwhen XSAVE is not available. Instead, it should reset the FXSAVE data to processor-reset values (except for MXCSR which always comes from XRSTOR data), i.e. to all-zeros except for the x87 control and tag words. It should also check reserved bits of MXCSR.I do not see why.
Because otherwise it behaves in a subtly different manner for XSAVE and non-XSAVE hosts.
Quoted 5 lines
Quoted 3 lines
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
IMO this is the main issue here, not separate bug. If we gonna let guest use CPU state QEMU does not support we gonna have a bad time.
We cannot force the guest not to use a feature; all we can do is hide the CPUID bits so that a well-behaved guest will not use it. QEMU does hide CPUID bits for non-supported XSAVE states, except for "-cpu host".
So this will not be a problem except with "-cpu host".
Paolo
Re: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Quoted 20 lines · Paolo Bonzini
Il 09/09/2013 11:03, Gleb Natapov ha scritto:
Quoted 19 lines · Paolo Bonzini
Quoted 18 lines
Il 08/09/2013 13:40, Gleb Natapov ha scritto:
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines
On KVM, the
KVM_SET_XSAVEwould be executed with a 0xstate_bv, and not restore anything.XRSTOR restores FP/SSE state to reset state if no bits are set in
xstate_bv. This is what should happen on reset, no?Yes. The problem happens on the migration destination when XSAVE data is not transmitted. FP/SSE data is transmitted and must be restored, but
xstate_bvis zero andKVM_SET_XSAVErestores FP/SSE state to reset state. The vcpu then loses the values that were set in the migration data.Quoted 4 lines
Quoted 3 lines
Since FP and SSE data are always valid, set them in
xstate_bvat reset time. In fact, that value is the same thatKVM_GET_XSAVEreturns on pre-XSAVE hosts.It is needed for migration between non xsave host to xsave host.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Yes, and this patch does the same for migration between non-XSAVE QEMU and XSAVE QEMU.
Can such migration happen? The commit that added xsave support (
f1665b21f16c5dc0ac37de60233a4975aff31193) changed vmstate version id.Yes,
old->newmigration can happen.New->oldof course cannot.
I see. I am fine with the patch, but please drop defines that are not used in the patch itself.
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
In fact, another bug is that
kvm_vcpu_ioctl_x86_set_xsaveignoresxstate_bvwhen XSAVE is not available. Instead, it should reset the FXSAVE data to processor-reset values (except for MXCSR which always comes from XRSTOR data), i.e. to all-zeros except for the x87 control and tag words. It should also check reserved bits of MXCSR.I do not see why.
Because otherwise it behaves in a subtly different manner for XSAVE and non-XSAVE hosts.
I do not see how. Can you elaborate?
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
IMO this is the main issue here, not separate bug. If we gonna let guest use CPU state QEMU does not support we gonna have a bad time.
We cannot force the guest not to use a feature; all we can do is hide
Of course we can't, this is correct for other features too, but this is guest's problem.
Quoted 4 lines
the CPUID bits so that a well-behaved guest will not use it. QEMU does hide CPUID bits for non-supported XSAVE states, except for "-cpu host".
So this will not be a problem except with "-cpu host".
--
Gleb.
Re: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Quoted 24 lines · Gleb Natapov
Quoted 23 lines · Paolo Bonzini
Il 09/09/2013 11:03, Gleb Natapov ha scritto:
Quoted 22 lines · Paolo Bonzini
Quoted 21 lines
Il 08/09/2013 13:40, Gleb Natapov ha scritto:
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines
On KVM, the
KVM_SET_XSAVEwould be executed with a 0xstate_bv, and not restore anything.XRSTOR restores FP/SSE state to reset state if no bits are set in
xstate_bv. This is what should happen on reset, no?Yes. The problem happens on the migration destination when XSAVE data is not transmitted. FP/SSE data is transmitted and must be restored, but
xstate_bvis zero andKVM_SET_XSAVErestores FP/SSE state to reset state. The vcpu then loses the values that were set in the migration data.Quoted 4 lines
Quoted 3 lines
Since FP and SSE data are always valid, set them in
xstate_bvat reset time. In fact, that value is the same thatKVM_GET_XSAVEreturns on pre-XSAVE hosts.It is needed for migration between non xsave host to xsave host.
Yes, and this patch does the same for migration between non-XSAVE QEMU and XSAVE QEMU.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Can such migration happen? The commit that added xsave support (
f1665b21f16c5dc0ac37de60233a4975aff31193) changed vmstate version id.Yes,
old->newmigration can happen.New->oldof course cannot.I see. I am fine with the patch, but please drop defines that are not used in the patch itself.
BTW migration question, will xstate_bv no be zeroed by migration code in old->new case?
--
Gleb.
Paolo Bonzini
maintainerRe: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
In reply to Gleb NatapovIl 09/09/2013 12:54, Gleb Natapov ha scritto:
Quoted 24 lines · Paolo Bonzini
Quoted 23 lines
Il 09/09/2013 11:03, Gleb Natapov ha scritto:
Quoted 22 lines · Paolo Bonzini
Quoted 21 lines
Il 08/09/2013 13:40, Gleb Natapov ha scritto:
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines
On KVM, the
KVM_SET_XSAVEwould be executed with a 0xstate_bv, and not restore anything.XRSTOR restores FP/SSE state to reset state if no bits are set in
xstate_bv. This is what should happen on reset, no?Yes. The problem happens on the migration destination when XSAVE data is not transmitted. FP/SSE data is transmitted and must be restored, but
xstate_bvis zero andKVM_SET_XSAVErestores FP/SSE state to reset state. The vcpu then loses the values that were set in the migration data.Quoted 4 lines
Quoted 3 lines
Since FP and SSE data are always valid, set them in
xstate_bvat reset time. In fact, that value is the same thatKVM_GET_XSAVEreturns on pre-XSAVE hosts.It is needed for migration between non xsave host to xsave host.
Yes, and this patch does the same for migration between non-XSAVE QEMU and XSAVE QEMU.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Can such migration happen? The commit that added xsave support (
f1665b21f16c5dc0ac37de60233a4975aff31193) changed vmstate version id.Yes,
old->newmigration can happen.New->oldof course cannot.I see. I am fine with the patch, but please drop defines that are not used in the patch itself.
Ok.
(For the "BTW" question, xstate_bv will not be zeroed, it will remain to the default value).
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
In fact, another bug is that
kvm_vcpu_ioctl_x86_set_xsaveignoresxstate_bvwhen XSAVE is not available. Instead, it should reset the FXSAVE data to processor-reset values (except for MXCSR which always comes from XRSTOR data), i.e. to all-zeros except for the x87 control and tag words. It should also check reserved bits of MXCSR.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I do not see why.
Because otherwise it behaves in a subtly different manner for XSAVE and non-XSAVE hosts.
I do not see how. Can you elaborate?
Suppose userspace calls KVM_SET_XSAVE with XSTATE_BV=0.
On an XSAVE host, when the guest FPU state is loaded KVM will do an XRSTOR. The XRSTOR will restore the FPU state to default values.
On a non-XSAVE host, when the guest FPU state is loaded KVM will do an FXRSTR. The FXRSTR will load the FPU state from the first 512 bytes of the block that was passed to KVM_SET_XSAVE.
This is not a problem because userspace will usually pass to KVM_SET_XSAVE only something that it got from KVM_GET_XSAVE, and KVM_GET_XSAVE will never set XSTATE_BV=0. However, KVM_SET_XSAVE is supposed to emulate XSAVE/XRSTOR if it is not available, and it is failing to emulate this detail.
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
IMO this is the main issue here, not separate bug. If we gonna let guest use CPU state QEMU does not support we gonna have a bad time.
We cannot force the guest not to use a feature; all we can do is hide
Of course we can't, this is correct for other features too, but this is guest's problem.
Ok, then we agree that QEMU doesn't have a problem? The XSAVE data will always be "fresh" as long as the guest obeys CPUID bits it receives, and the CPUID bits that QEMU passes will never enable XSAVE data that QEMU does not support.
Paolo
Re: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Quoted 22 lines · Paolo Bonzini
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
In fact, another bug is that
kvm_vcpu_ioctl_x86_set_xsaveignoresxstate_bvwhen XSAVE is not available. Instead, it should reset the FXSAVE data to processor-reset values (except for MXCSR which always comes from XRSTOR data), i.e. to all-zeros except for the x87 control and tag words. It should also check reserved bits of MXCSR.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I do not see why.
Because otherwise it behaves in a subtly different manner for XSAVE and non-XSAVE hosts.
I do not see how. Can you elaborate?
Suppose userspace calls
KVM_SET_XSAVEwith XSTATE_BV=0.On an XSAVE host, when the guest FPU state is loaded KVM will do an XRSTOR. The XRSTOR will restore the FPU state to default values.
On a non-XSAVE host, when the guest FPU state is loaded KVM will do an FXRSTR. The FXRSTR will load the FPU state from the first 512 bytes of the block that was passed to
KVM_SET_XSAVE.
Quoted 6 lines
This is not a problem because userspace will usually pass to
KVM_SET_XSAVEonly something that it got fromKVM_GET_XSAVE, andKVM_GET_XSAVEwill never set XSTATE_BV=0. However,KVM_SET_XSAVEis supposed to emulate XSAVE/XRSTOR if it is not available, and it is failing to emulate this detail.
You are trying to be bug to bug compatible :) XSTATE_BV can be zero only if FPU state is reset one, otherwise the guest will not survive. KVM_SET_XSAVE is not suppose to emulate XSAVE/XRSTOR, it is not emulator function. It is better to outlaw zero value for XSTATE_BV at all, but we cannot do it because current QEMU uses it.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
IMO this is the main issue here, not separate bug. If we gonna let guest use CPU state QEMU does not support we gonna have a bad time.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
We cannot force the guest not to use a feature; all we can do is hide
Of course we can't, this is correct for other features too, but this is guest's problem.
Ok, then we agree that QEMU doesn't have a problem? The XSAVE data will
Which problem exactly. The problems I see is that 1. We do not support MPX and AVX-512 (but this is probably not the problem you meant :)) 2. 0D data is not consistent with features. Guest may not expect it and do stupid things.
Quoted 4 lines
always be "fresh" as long as the guest obeys CPUID bits it receives, and the CPUID bits that QEMU passes will never enable XSAVE data that QEMU does not support.
--
Gleb.
Paolo Bonzini
maintainerRe: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Il 09/09/2013 13:28, Gleb Natapov ha scritto:
Quoted 7 lines
Quoted 7 lines
On an XSAVE host, when the guest FPU state is loaded KVM will do an XRSTOR. The XRSTOR will restore the FPU state to default values.
On a non-XSAVE host, when the guest FPU state is loaded KVM will do an FXRSTR. The FXRSTR will load the FPU state from the first 512 bytes of the block that was passed to
KVM_SET_XSAVE.
Quoted 8 lines
Quoted 6 lines
This is not a problem because userspace will usually pass to
KVM_SET_XSAVEonly something that it got fromKVM_GET_XSAVE, andKVM_GET_XSAVEwill never set XSTATE_BV=0. However,KVM_SET_XSAVEis supposed to emulate XSAVE/XRSTOR if it is not available, and it is failing to emulate this detail.You are trying to be bug to bug compatible :)
XSTATE_BVcan be zero only if FPU state is reset one, otherwise the guest will not survive.
Yes.
Quoted 4 lines
KVM_SET_XSAVE
is not suppose to emulate XSAVE/XRSTOR, it is not emulator function. It is better to outlaw zero value forXSTATE_BVat all, but we cannot do it because current QEMU uses it.
I agree it'd be better to forbid it. If the mismatch in semantics does not bother you, I won't fix it. It slightly bothers me. :)
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
IMO this is the main issue here, not separate bug. If we gonna let guest use CPU state QEMU does not support we gonna have a bad time.
We cannot force the guest not to use a feature; all we can do is hide
Of course we can't, this is correct for other features too, but this is guest's problem.
Quoted 6 lines
Quoted 1 line
Ok, then we agree that QEMU doesn't have a problem? The XSAVE data will
Which problem exactly. The problems I see is that 1. We do not support MPX and AVX-512 (but this is probably not the problem you meant :)) 2. 0D data is not consistent with features. Guest may not expect it and do stupid things.
It is not a problem to unmarshal information out of KVM_GET_XSAVE data (and back). If the guest does stupid things, it's a bug in an ill-behaving guest.
On the other hand, I agree that passthrough of host 0xD data is bad and will fix it.
Paolo
Quoted 8 lines
Quoted 4 lines
always be "fresh" as long as the guest obeys CPUID bits it receives, and the CPUID bits that QEMU passes will never enable XSAVE data that QEMU does not support.
--
Gleb.
Re: [PATCH uq/master 1/2] x86: fix migration from pre-version 12
Quoted 13 lines · Paolo Bonzini
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yes. QEMU unmarshals information from the XSAVE region and back, so it cannot support MPX or AVX-512 yet (even if KVM were). Separate bug, though.
IMO this is the main issue here, not separate bug. If we gonna let guest use CPU state QEMU does not support we gonna have a bad time.
We cannot force the guest not to use a feature; all we can do is hide
Of course we can't, this is correct for other features too, but this is guest's problem.
Ok, then we agree that QEMU doesn't have a problem? The XSAVE data will
Quoted 9 lines
Quoted 4 lines
Which problem exactly. The problems I see is that 1. We do not support MPX and AVX-512 (but this is probably not the problem you meant :)) 2. 0D data is not consistent with features. Guest may not expect it and do stupid things.
It is not a problem to unmarshal information out of
KVM_GET_XSAVEdata (and back). If the guest does stupid things, it's a bug in an ill-behaving guest.
You know I am first in line to blame guest for everything :) (who needs guests anyway) but in this case I didn't mean that guest does something illegal. If we advertise support for some XSAVE state in 0D leaf guest is in his right to make conclusions we may not expect from that. It may check corespondent feature bit and crash if it is not present for instance.
Quoted 3 lines
On the other hand, I agree that passthrough of host
0xDdata is bad and will fix it.
Thanks!
--
Gleb.
Paolo Bonzini
maintainerPATCH 2/2 KVM: make XSAVE support more robust
In reply to Paolo BonziniQEMU moves state from CPUArchState to struct kvm_xsave and back when it invokes the KVM_*_XSAVE ioctls. Because it doesn't treat the XSAVE region as an opaque blob, it might be impossible to set some state on the destination if migrating to an older version.
This patch blocks migration if it finds that unsupported bits are set in the XSTATE_BV header field. To make this work robustly, QEMU should only report in env->xstate_bv those fields that will actually end up in the migration stream.
--- target-i386/kvm.c | 3 ++- target-i386/machine.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
target-i386/kvm.c +2 -1
@@ -1291,7 +1291,8 @@ static int kvm_get_xsave(X86CPU *cpu) sizeof env->fpregs);memcpy (env->xmm_regs, &xsave->region[XSAVE_XMM_SPACE ],sizeof env->xmm_regs); - env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ]; + env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ] & +XSTATE_SUPPORTED ;memcpy (env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE ],sizeof env->ymmh_regs);return 0 ;
target-i386/machine.c +4 -0
@@ -278,6 +278,10 @@ static int cpu_post_load(void *opaque, int version_id)CPUX86State *env = &cpu->env;int i; +if (env->xstate_bv & ~XSTATE_SUPPORTED ) { +return -EINVAL ; + } +/* * Real mode guest segments register DPL should be zero. * Older KVM version were setting it wrongly.
Signature · 1 line
1.8.3.1
Re: [PATCH uq/master 2/2] KVM: make XSAVE support more robust
Quoted 9 lines · Paolo Bonzini
QEMU moves state from CPUArchState to struct
kvm_xsaveand back when it invokes the KVM_*_XSAVE ioctls. Because it doesn't treat the XSAVE region as an opaque blob, it might be impossible to set some state on the destination if migrating to an older version.This patch blocks migration if it finds that unsupported bits are set in the
XSTATE_BVheader field. To make this work robustly, QEMU should only report inenv->xstate_bvthose fields that will actually end up in the migration stream.
We usually handle host cpu differences in cpuid layer, not by trying to validate migration data. i.e CPUID.0D should be configurable and management should be able to query QEMU what is supported and prevent migration attempt accordingly.
Quoted 12 lines
Signed-off-by Paolo Bonzini <[email protected]>--- target-i386/kvm.c | 3 ++- target-i386/machine.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)target-i386/kvm.c +0
-0
target-i386/kvm.c static int kvm_get_xsave(X86CPU *cpu) · line 1295
Quoted 6 lines
target-i386/kvm.c +2
-1@@ -1291,7 +1291,8 @@ static int kvm_get_xsave(X86CPU *cpu) sizeof env->fpregs);memcpy (env->xmm_regs, &xsave->region[XSAVE_XMM_SPACE ],sizeof env->xmm_regs); - env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ]; + env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ] & +XSTATE_SUPPORTED ;
Don't we just drop state here that will not be restored on the destination and destination will not be able to tell since we masked unsupported bits?
Quoted 20 lines
target-i386/kvm.c +0
-0memcpy (env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE ],sizeof env->ymmh_regs);return 0 ;target-i386/machine.c +4
-0@@ -278,6 +278,10 @@ static int cpu_post_load(void *opaque, int version_id)CPUX86State *env = &cpu->env;int i; +if (env->xstate_bv & ~XSTATE_SUPPORTED ) { +return -EINVAL ; + } +/* * Real mode guest segments register DPL should be zero. * Older KVM version were setting it wrongly. Signature · 1 line
1.8.3.1
--
Gleb.
Paolo Bonzini
maintainerRe: [PATCH uq/master 2/2] KVM: make XSAVE support more robust
Il 08/09/2013 13:52, Gleb Natapov ha scritto:
Quoted 6 lines · Paolo Bonzini
Quoted 5 lines
QEMU moves state from CPUArchState to struct
kvm_xsaveand back when it invokes the KVM_*_XSAVE ioctls. Because it doesn't treat the XSAVE region as an opaque blob, it might be impossible to set some state on the destination if migrating to an older version.
Quoted 7 lines
Quoted 4 lines
This patch blocks migration if it finds that unsupported bits are set in the
XSTATE_BVheader field. To make this work robustly, QEMU should only report inenv->xstate_bvthose fields that will actually end up in the migration stream.We usually handle host cpu differences in cpuid layer, not by trying to validate migration data.
Actually we do both. QEMU for example detects invalid subsections and blocks migration, and CPU differences also result in subsections that the destination does not know.
But as far as QEMU is concerned, setting an unknown bit in XSTATE_BV is not a CPU difference, it is simply invalid migration data.
Quoted 3 lines
i.e CPUID.0D should be configurable and
management should be able to query QEMU what is supported and prevent migration attempt accordingly.
Management is already able to query QEMU of what is supported, because new XSAVE state is always attached to new CPUID bits in leaves other than 0Dh (e.g. EAX=07h, ECX=0h returns AVX512 and MPX support in EBX). QEMU should compute 0Dh data based on those bits indeed.
However, KVM_GET/SET_XSAVE should still return all values supported by the hypervisor, independent of the supported CPUID bits.
Quoted 7 lines
Quoted 7 lines
Signed-off-by Paolo Bonzini <[email protected]>--- target-i386/kvm.c | 3 ++- target-i386/machine.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
Quoted 14 lines
target-i386/kvm.c static int kvm_get_xsave(X86CPU *cpu) · line 1295
Quoted 11 lines
target-i386/kvm.c +2
-1@@ -1291,7 +1291,8 @@ static int kvm_get_xsave(X86CPU *cpu) sizeof env->fpregs);memcpy (env->xmm_regs, &xsave->region[XSAVE_XMM_SPACE ],sizeof env->xmm_regs); - env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ]; + env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ] & +XSTATE_SUPPORTED ;Don't we just drop state here that will not be restored on the destination and destination will not be able to tell since we masked unsupported bits?
A well-behaved guest should not have modified that state anyway, since:
* the source and destination machines should have the same CPU
* since the destination QEMU does not support the feature, the source should have masked it as well
* the guest should always probe CPUID before using a feature
There will be only one change for well-behaved guests with this patch (and the change will be invisible to them since they behave well). After the patch, KVM_SET_XSAVE will set the extended states to the processor-reset state instead of all-zeros. However, all currently-defined states have a processor-reset state that is equal to all-zeroes, so this change is theoretical.
In fact, perhaps even XSTATE_SUPPORTED is not restrictive enough here, and we should hide all features that are not visible in CPUID. It is okay, however, to test it in cpu_post_load.
Paolo
Quoted 28 lines
Quoted 20 lines
target-i386/kvm.c +0
-0memcpy (env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE ],sizeof env->ymmh_regs);return 0 ;target-i386/machine.c +4
-0@@ -278,6 +278,10 @@ static int cpu_post_load(void *opaque, int version_id)CPUX86State *env = &cpu->env;int i; +if (env->xstate_bv & ~XSTATE_SUPPORTED ) { +return -EINVAL ; + } +/* * Real mode guest segments register DPL should be zero. * Older KVM version were setting it wrongly. Signature · 1 line
1.8.3.1--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH uq/master 2/2] KVM: make XSAVE support more robust
Quoted 12 lines · Paolo Bonzini
Il 08/09/2013 13:52, Gleb Natapov ha scritto:
Quoted 11 lines · Paolo Bonzini
Quoted 9 lines
QEMU moves state from CPUArchState to struct
kvm_xsaveand back when it invokes the KVM_*_XSAVE ioctls. Because it doesn't treat the XSAVE region as an opaque blob, it might be impossible to set some state on the destination if migrating to an older version.This patch blocks migration if it finds that unsupported bits are set in the
XSTATE_BVheader field. To make this work robustly, QEMU should only report inenv->xstate_bvthose fields that will actually end up in the migration stream.
Quoted 7 lines
Quoted 2 lines
We usually handle host cpu differences in cpuid layer, not by trying to validate migration data.
Actually we do both. QEMU for example detects invalid subsections and blocks migration, and CPU differences also result in subsections that the destination does not know.
That's different from what you do here though. If xstate_bv was in its separate subsection things would be easier, but it is not.
Quoted 11 lines
But as far as QEMU is concerned, setting an unknown bit in
XSTATE_BVis not a CPU difference, it is simply invalid migration data.Quoted 3 lines
i.e CPUID.0D should be configurable and
management should be able to query QEMU what is supported and prevent migration attempt accordingly.Management is already able to query QEMU of what is supported, because new XSAVE state is always attached to new CPUID bits in leaves other than 0Dh (e.g. EAX=07h, ECX=0h returns AVX512 and MPX support in EBX). QEMU should compute 0Dh data based on those bits indeed.
If it is computable from other data even better, easier for us.
Quoted 4 lines
However, KVM_GET/SET_XSAVE should still return all values supported by the hypervisor, independent of the supported CPUID bits.
Why?
Quoted 22 lines
Quoted 7 lines
Quoted 7 lines
Signed-off-by Paolo Bonzini <[email protected]>--- target-i386/kvm.c | 3 ++- target-i386/machine.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)Quoted 14 lines
target-i386/kvm.c static int kvm_get_xsave(X86CPU *cpu) · line 1295
Quoted 11 lines
target-i386/kvm.c +2
-1@@ -1291,7 +1291,8 @@ static int kvm_get_xsave(X86CPU *cpu) sizeof env->fpregs);memcpy (env->xmm_regs, &xsave->region[XSAVE_XMM_SPACE ],sizeof env->xmm_regs); - env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ]; + env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV ] & +XSTATE_SUPPORTED ;Don't we just drop state here that will not be restored on the destination and destination will not be able to tell since we masked unsupported bits?
Quoted 9 lines
A well-behaved guest should not have modified that state anyway, since:
* the source and destination machines should have the same CPU
* since the destination QEMU does not support the feature, the source should have masked it as well
* the guest should always probe CPUID before using a feature
The I fail to see what is the purpose of the patch. I see two cases:
1. Each extended state has separate CPUID bit (is this guarantied?)
- In this case, as you say, by matching CPUID on src and dst we guaranty that migration data is good.
2. There is a state that is advertised in CPUID.0D, but does not have any regular "feature" CPUID associated with it.
- In this case this patch will drop valid state that needs to be restored.
Quoted 10 lines
There will be only one change for well-behaved guests with this patch (and the change will be invisible to them since they behave well). After the patch,
KVM_SET_XSAVEwill set the extended states to the processor-reset state instead of all-zeros. However, all currently-defined states have a processor-reset state that is equal to all-zeroes, so this change is theoretical.In fact, perhaps even
XSTATE_SUPPORTEDis not restrictive enough here, and we should hide all features that are not visible in CPUID. It is okay, however, to test it incpu_post_load.
The kernel should not even return state that is not visible in CPUID.
Quoted 31 lines
Paolo
Quoted 28 lines
Quoted 20 lines
target-i386/kvm.c +0
-0memcpy (env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE ],sizeof env->ymmh_regs);return 0 ;target-i386/machine.c +4
-0@@ -278,6 +278,10 @@ static int cpu_post_load(void *opaque, int version_id)CPUX86State *env = &cpu->env;int i; +if (env->xstate_bv & ~XSTATE_SUPPORTED ) { +return -EINVAL ; + } +/* * Real mode guest segments register DPL should be zero. * Older KVM version were setting it wrongly. Signature · 1 line
1.8.3.1--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Gleb.
Paolo Bonzini
maintainerRe: [PATCH uq/master 2/2] KVM: make XSAVE support more robust
Il 09/09/2013 11:18, Gleb Natapov ha scritto:
Quoted 16 lines · Paolo Bonzini
Quoted 15 lines
Il 08/09/2013 13:52, Gleb Natapov ha scritto:
Quoted 13 lines · Paolo Bonzini
Quoted 9 lines
QEMU moves state from CPUArchState to struct
kvm_xsaveand back when it invokes the KVM_*_XSAVE ioctls. Because it doesn't treat the XSAVE region as an opaque blob, it might be impossible to set some state on the destination if migrating to an older version.This patch blocks migration if it finds that unsupported bits are set in the
XSTATE_BVheader field. To make this work robustly, QEMU should only report inenv->xstate_bvthose fields that will actually end up in the migration stream.We usually handle host cpu differences in cpuid layer, not by trying to validate migration data.
Quoted 6 lines
Quoted 4 lines
Actually we do both. QEMU for example detects invalid subsections and blocks migration, and CPU differences also result in subsections that the destination does not know.
That's different from what you do here though. If
xstate_bvwas in its separate subsection things would be easier, but it is not.
I agree. And also if YMM was in its separate subsections; future XSAVE states will likely use subsections (whose presence is keyed off bits in env->xstate_bv).
Quoted 4 lines
Quoted 2 lines
However, KVM_GET/SET_XSAVE should still return all values supported by the hypervisor, independent of the supported CPUID bits.
Why?
Because this is not talking to the guest, it is talking to userspace.
The VCPU state is more than what is visible to the guest, and returning all of it seems more consistent with the rest of the KVM API. For example, KVM_GET_FPU always returns SSE state even if the CPUID lacks SSE and/or FXSR.
Quoted 11 lines
Quoted 9 lines
A well-behaved guest should not have modified that state anyway, since:
* the source and destination machines should have the same CPU
* since the destination QEMU does not support the feature, the source should have masked it as well
* the guest should always probe CPUID before using a feature
The I fail to see what is the purpose of the patch. I see two cases:
1. Each extended state has separate CPUID bit (is this guarantied?)
Not guaranteed, but it has always happened so far (AVX, AVX-512, MPX).
Quoted 2 lines
- In this case, as you say, by matching CPUID on src and dst we guaranty that migration data is good.
But we don't match CPUID on src and destination. This is something that the user should do, but it's better if we can test it too. Subsections do that for us; I am, in some sense, emulating subsections for the XSAVE states that are not stored in subsections.
Quoted 5 lines
Quoted 3 lines
In fact, perhaps even
XSTATE_SUPPORTEDis not restrictive enough here, and we should hide all features that are not visible in CPUID. It is okay, however, to test it incpu_post_load.The kernel should not even return state that is not visible in CPUID.
That's an interesting point of view that I hadn't considered. But just like you asked me why it should return state that is not visible in CPUID, I'm asking you why it should not...
Paolo
Quoted 39 lines
Quoted 31 lines
Paolo
Quoted 28 lines
Quoted 20 lines
memcpy(env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE], sizeof env->ymmh_regs); return 0;target-i386/machine.c +4
-0@@ -278,6 +278,10 @@ static int cpu_post_load(void *opaque, int version_id)CPUX86State *env = &cpu->env;int i; +if (env->xstate_bv & ~XSTATE_SUPPORTED ) { +return -EINVAL ; + } +/* * Real mode guest segments register DPL should be zero. * Older KVM version were setting it wrongly. Signature · 1 line
1.8.3.1--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH uq/master 2/2] KVM: make XSAVE support more robust
Quoted 28 lines · Paolo Bonzini
Il 09/09/2013 11:18, Gleb Natapov ha scritto:
Quoted 16 lines · Paolo Bonzini
Quoted 15 lines
Il 08/09/2013 13:52, Gleb Natapov ha scritto:
Quoted 13 lines · Paolo Bonzini
Quoted 9 lines
QEMU moves state from CPUArchState to struct
kvm_xsaveand back when it invokes the KVM_*_XSAVE ioctls. Because it doesn't treat the XSAVE region as an opaque blob, it might be impossible to set some state on the destination if migrating to an older version.This patch blocks migration if it finds that unsupported bits are set in the
XSTATE_BVheader field. To make this work robustly, QEMU should only report inenv->xstate_bvthose fields that will actually end up in the migration stream.We usually handle host cpu differences in cpuid layer, not by trying to validate migration data.
Quoted 6 lines
Quoted 4 lines
Actually we do both. QEMU for example detects invalid subsections and blocks migration, and CPU differences also result in subsections that the destination does not know.
That's different from what you do here though. If
xstate_bvwas in its separate subsection things would be easier, but it is not.I agree. And also if YMM was in its separate subsections; future XSAVE states will likely use subsections (whose presence is keyed off bits in
env->xstate_bv).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
However, KVM_GET/SET_XSAVE should still return all values supported by the hypervisor, independent of the supported CPUID bits.
Why?
Because this is not talking to the guest, it is talking to userspace.
The VCPU state is more than what is visible to the guest, and returning
If a state does not affect guest in any way there is not reason to migrate it.
Quoted 3 lines
all of it seems more consistent with the rest of the KVM API. For example,
KVM_GET_FPUalways returns SSE state even if the CPUID lacks SSE and/or FXSR.
There are counter examples too :) If APIC is not created we do not return fake information on GET_IRQCHIP. I think nobody expected FPU state to grow indefinitely, so fixed, inflexible API was introduced, but now, when CPU state has flexible extended state management it make sense to model it in the API too.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
A well-behaved guest should not have modified that state anyway, since:
* the source and destination machines should have the same CPU
* since the destination QEMU does not support the feature, the source should have masked it as well
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
* the guest should always probe CPUID before using a feature
The I fail to see what is the purpose of the patch. I see two cases:
1. Each extended state has separate CPUID bit (is this guarantied?)Not guaranteed, but it has always happened so far (AVX, AVX-512, MPX).
OK, So for now no need to make 0D configurable, but we need to provide correct one according to those flags, not to passthrough host values.
Quoted 4 lines
Quoted 2 lines
- In this case, as you say, by matching CPUID on src and dst we guaranty that migration data is good.
But we don't match CPUID on src and destination. This is something that
Yes, I was saying that management infrastructure already knows how to handle it.
Quoted 3 lines
the user should do, but it's better if we can test it too. Subsections do that for us; I am, in some sense, emulating subsections for the XSAVE states that are not stored in subsections.
We do not do it for other bits. It is possible currently to migrate to a slightly different cpu without failure and it may cause guest to crash, but we are not trying actively to catch those situations. Why XSAVE is different?
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
In fact, perhaps even
XSTATE_SUPPORTEDis not restrictive enough here, and we should hide all features that are not visible in CPUID. It is okay, however, to test it incpu_post_load.The kernel should not even return state that is not visible in CPUID.
That's an interesting point of view that I hadn't considered. But just like you asked me why it should return state that is not visible in CPUID, I'm asking you why it should not...
For number of reasons. First because since a sate is not used there is no point in migrating it. Second to make interface more deterministic for QEMU. i.e QEMU configures only features it supports and gets exactly same state from the kernel no matter what host cpu is and what kernel version is. This patch will not be needed since kernel will do the job.
--
Gleb.
Paolo Bonzini
maintainerRe: [PATCH uq/master 2/2] KVM: make XSAVE support more robust
Il 09/09/2013 12:41, Gleb Natapov ha scritto:
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
In fact, perhaps even
XSTATE_SUPPORTEDis not restrictive enough here, and we should hide all features that are not visible in CPUID. It is okay, however, to test it incpu_post_load.The kernel should not even return state that is not visible in CPUID.
That's an interesting point of view that I hadn't considered. But just like you asked me why it should return state that is not visible in CPUID, I'm asking you why it should not...
Quoted 6 lines
For number of reasons. First because since a sate is not used there is no point in migrating it. Second to make interface more deterministic for QEMU. i.e QEMU configures only features it supports and gets exactly same state from the kernel no matter what host cpu is and what kernel version is. This patch will not be needed since kernel will do the job.
Good reasons, thanks. Let's do it in the kernel then and avoid this patch altogether.
Paolo