qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] target-i386: fix losing XCR0 processor state component bits
@ 2016-09-28  8:36 Wanpeng Li
  2016-09-28 17:05 ` Eduardo Habkost
  0 siblings, 1 reply; 3+ messages in thread
From: Wanpeng Li @ 2016-09-28  8:36 UTC (permalink / raw)
  To: kvm, qemu-devel
  Cc: Wanpeng Li, Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin

From: Wanpeng Li <wanpeng.li@hotmail.com>

Commit 96193c22a "target-i386: Move xsave component mask to features array"
leverages features array to handle XCR0 processor state component bits, 
however, it introduces a regression:

warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 0]
warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 1]
warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 2]

My desktop doesn't have enough advance features, so just X87,SSE,AVX 
warnings are splat when I boot a guest.

The get migratable flags logic in x86_cpu_filter_features() path will 
filter out the feature flags which are unsupported and unmigratable. 
However, the bits of XCR0 processor state component featureword don't 
have feat_names, and some features like SSE/AVX etc have feat_names in 
CPUID.01H:EDX, CPUID.01H:ECX, so they are treated as unsupported.

This patch fix it by don't filter out XCR0 processor state components 
bits though they don't have feat_names just as before commit 96193c22ab3.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
v1 -> v2: 
 * move the check to x86_cpu_get_migratable_flags()

 target-i386/cpu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 333309b..cc929ca 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -602,7 +602,10 @@ static uint32_t x86_cpu_get_migratable_flags(FeatureWord w)
         uint32_t f = 1U << i;
         /* If the feature name is unknown, it is not supported by QEMU yet */
         if (!wi->feat_names[i]) {
-            continue;
+            if (w != FEAT_XSAVE_COMP_LO &&
+                w != FEAT_XSAVE_COMP_HI) {
+                continue;
+            }
         }
         /* Skip features known to QEMU, but explicitly marked as unmigratable */
         if (wi->unmigratable_flags & f) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] target-i386: fix losing XCR0 processor state component bits
  2016-09-28  8:36 [Qemu-devel] [PATCH v2] target-i386: fix losing XCR0 processor state component bits Wanpeng Li
@ 2016-09-28 17:05 ` Eduardo Habkost
  2016-09-29  1:03   ` Wanpeng Li
  0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Habkost @ 2016-09-28 17:05 UTC (permalink / raw)
  To: Wanpeng Li
  Cc: kvm, qemu-devel, Wanpeng Li, Paolo Bonzini, Richard Henderson,
	Michael S. Tsirkin

On Wed, Sep 28, 2016 at 04:36:14PM +0800, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
> 
> Commit 96193c22a "target-i386: Move xsave component mask to features array"
> leverages features array to handle XCR0 processor state component bits, 
> however, it introduces a regression:
> 
> warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 0]
> warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 1]
> warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 2]
> 
> My desktop doesn't have enough advance features, so just X87,SSE,AVX 
> warnings are splat when I boot a guest.
> 
> The get migratable flags logic in x86_cpu_filter_features() path will 
> filter out the feature flags which are unsupported and unmigratable. 
> However, the bits of XCR0 processor state component featureword don't 
> have feat_names, and some features like SSE/AVX etc have feat_names in 
> CPUID.01H:EDX, CPUID.01H:ECX, so they are treated as unsupported.
> 
> This patch fix it by don't filter out XCR0 processor state components 
> bits though they don't have feat_names just as before commit 96193c22ab3.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> v1 -> v2: 
>  * move the check to x86_cpu_get_migratable_flags()
> 
>  target-i386/cpu.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 333309b..cc929ca 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -602,7 +602,10 @@ static uint32_t x86_cpu_get_migratable_flags(FeatureWord w)
>          uint32_t f = 1U << i;
>          /* If the feature name is unknown, it is not supported by QEMU yet */
>          if (!wi->feat_names[i]) {
> -            continue;
> +            if (w != FEAT_XSAVE_COMP_LO &&
> +                w != FEAT_XSAVE_COMP_HI) {
> +                continue;
> +            }

We still need to report unknown xstate components as unmigratable
(otherwise -cpu host will enable them automatically). See the fix
I submitted:
  [PATCH] target-i386: Report known CPUID[EAX=0xD,ECX=0]:EAX bits as migratable

-- 
Eduardo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] target-i386: fix losing XCR0 processor state component bits
  2016-09-28 17:05 ` Eduardo Habkost
@ 2016-09-29  1:03   ` Wanpeng Li
  0 siblings, 0 replies; 3+ messages in thread
From: Wanpeng Li @ 2016-09-29  1:03 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: kvm, qemu-devel@nongnu.org Developers, Wanpeng Li, Paolo Bonzini,
	Richard Henderson, Michael S. Tsirkin

2016-09-29 1:05 GMT+08:00 Eduardo Habkost <ehabkost@redhat.com>:
> On Wed, Sep 28, 2016 at 04:36:14PM +0800, Wanpeng Li wrote:
[...]
>
> We still need to report unknown xstate components as unmigratable
> (otherwise -cpu host will enable them automatically). See the fix
> I submitted:
>   [PATCH] target-i386: Report known CPUID[EAX=0xD,ECX=0]:EAX bits as migratable

Hmm, at least you should Cc me when you sent out the patch, anyway,
the patch looks good after I google to finally find it.

Regards,
Wanpeng Li

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-29  1:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-28  8:36 [Qemu-devel] [PATCH v2] target-i386: fix losing XCR0 processor state component bits Wanpeng Li
2016-09-28 17:05 ` Eduardo Habkost
2016-09-29  1:03   ` Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).