All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts)
@ 2015-11-03 19:58 Eduardo Habkost
  2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 1/3] target-i386: Set "check=off" by default on pc-*-2.4 and older Eduardo Habkost
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Eduardo Habkost @ 2015-11-03 19:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Igor Mammedov, Richard Henderson,
	Dr. David Alan Gilbert, Michael S. Tsirkin

The x86 change to make "check" mode be enabled by default made QEMU print
warnings in the default case if running in an Intel host:

  $ qemu-system-x86_64 -machine pc,accel=kvm
  warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]

There's also a warning when about missing the ABM feature if running on a Sandy
Bridge or older host.

ABM is not available on Sandy Bridge and older, SSE4a is not available in any
Intel host. We want to make the default CPU runnable in most hosts, so those
features won't be enabled by default in KVM mode.

We should eventually have all features supported by TCG enabled by default in
TCG mode, but as we don't have a good mechanism today to ensure we have
different defaults in KVM and TCG mode, disable ABM and SSE4a in the qemu64 CPU
model entirely.

Also, as we can't change the guest ABI in pc-*-2.4, disable "check" mode by
default in pc-*-2.4 and older so we don't print spurious warnings.

Note that with this change, the qemu64 CPU model still requires a host
supporting POPCNT (Nehalem or newer, and Opteron_G3 or newer).

Eduardo Habkost (3):
  target-i386: Set "check=off" by default on pc-*-2.4 and older
  target-i386: Remove SSE4a from qemu64 CPU model
  target-i386: Remove ABM from qemu64 CPU model

 include/hw/i386/pc.h | 15 +++++++++++++++
 target-i386/cpu.c    |  3 +--
 2 files changed, 16 insertions(+), 2 deletions(-)

-- 
2.1.0

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

* [Qemu-devel] [PATCH v2 1/3] target-i386: Set "check=off" by default on pc-*-2.4 and older
  2015-11-03 19:58 [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Eduardo Habkost
@ 2015-11-03 19:58 ` Eduardo Habkost
  2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 2/3] target-i386: Remove SSE4a from qemu64 CPU model Eduardo Habkost
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Eduardo Habkost @ 2015-11-03 19:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Igor Mammedov, Richard Henderson,
	Dr. David Alan Gilbert, Michael S. Tsirkin

The default CPU model (qemu64) have some issues today: it enables some
features (ABM and SSE4a) that are not present in many host CPUs. That
means many hosts (but not all of them) had those features silently
disabled in the default configuration in QEMU 2.4 and older.

With the new "check=on" default, this causes warnings to be printed in
the default configuration, because of the lack of SSE4A on all Intel
hosts, and the lack of ABM on Sandy Bridge and older hosts:

  $ qemu-system-x86_64 -machine pc,accel=kvm
  warning: host doesn't support requested feature: CPUID.80000001H:ECX.abm [bit 5]
  warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]

Those issues will be fixed in pc-*-2.5 and newer. But as we can't change
the guest ABI in pc-*-2.4, disable "check" mode by default in pc-*-2.4
and older so we don't print spurious warnings.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/i386/pc.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 606dbc2..8be4520 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -322,6 +322,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = "host" "-" TYPE_X86_CPU,\
             .property = "host-cache-info",\
             .value    = "on",\
+        },\
+        {\
+            .driver   = TYPE_X86_CPU,\
+            .property = "check",\
+            .value    = "off",\
         },
 
 #define PC_COMPAT_2_3 \
-- 
2.1.0

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

* [Qemu-devel] [PATCH v2 2/3] target-i386: Remove SSE4a from qemu64 CPU model
  2015-11-03 19:58 [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Eduardo Habkost
  2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 1/3] target-i386: Set "check=off" by default on pc-*-2.4 and older Eduardo Habkost
@ 2015-11-03 19:58 ` Eduardo Habkost
  2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 3/3] target-i386: Remove ABM " Eduardo Habkost
  2015-11-03 20:22 ` [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Paolo Bonzini
  3 siblings, 0 replies; 7+ messages in thread
From: Eduardo Habkost @ 2015-11-03 19:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Igor Mammedov, Richard Henderson,
	Dr. David Alan Gilbert, Michael S. Tsirkin

SSE4a is not available in any Intel CPU, and we want to make the default
CPU runnable in most hosts, so it doesn't make sense to enable it by
default in KVM mode.

We should eventually have all features supported by TCG enabled by
default in TCG mode, but as we don't have a good mechanism today to
ensure we have different defaults in KVM and TCG mode, disable SSE4a in
the qemu64 CPU model entirely.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/i386/pc.h | 5 +++++
 target-i386/cpu.c    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8be4520..bc82c14 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -327,6 +327,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = TYPE_X86_CPU,\
             .property = "check",\
             .value    = "off",\
+        },\
+        {\
+            .driver   = "qemu64" "-" TYPE_X86_CPU,\
+            .property = "sse4a",\
+            .value    = "on",\
         },
 
 #define PC_COMPAT_2_3 \
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 9280bfc..f270ddb 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -676,7 +676,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
         .features[FEAT_8000_0001_ECX] =
             CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM |
-            CPUID_EXT3_ABM | CPUID_EXT3_SSE4A,
+            CPUID_EXT3_ABM,
         .xlevel = 0x8000000A,
     },
     {
-- 
2.1.0

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

* [Qemu-devel] [PATCH v2 3/3] target-i386: Remove ABM from qemu64 CPU model
  2015-11-03 19:58 [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Eduardo Habkost
  2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 1/3] target-i386: Set "check=off" by default on pc-*-2.4 and older Eduardo Habkost
  2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 2/3] target-i386: Remove SSE4a from qemu64 CPU model Eduardo Habkost
@ 2015-11-03 19:58 ` Eduardo Habkost
  2015-11-03 20:22 ` [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Paolo Bonzini
  3 siblings, 0 replies; 7+ messages in thread
From: Eduardo Habkost @ 2015-11-03 19:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Igor Mammedov, Richard Henderson,
	Dr. David Alan Gilbert, Michael S. Tsirkin

ABM is not available on Sandy Bridge and older, and we want to make the
default CPU runnable in most hosts, so it won't be enabled by default in
KVM mode.

We should eventually have all features supported by TCG enabled by
default in TCG mode, but as we don't have a good mechanism today to
ensure we have different defaults in KVM and TCG mode, disable ABM in
the qemu64 CPU model entirely.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/i386/pc.h | 5 +++++
 target-i386/cpu.c    | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index bc82c14..8b54863 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -332,6 +332,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = "qemu64" "-" TYPE_X86_CPU,\
             .property = "sse4a",\
             .value    = "on",\
+        },\
+        {\
+            .driver   = "qemu64" "-" TYPE_X86_CPU,\
+            .property = "abm",\
+            .value    = "on",\
         },
 
 #define PC_COMPAT_2_3 \
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index f270ddb..35cd267 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -675,8 +675,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .features[FEAT_8000_0001_EDX] =
             CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
         .features[FEAT_8000_0001_ECX] =
-            CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM |
-            CPUID_EXT3_ABM,
+            CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM,
         .xlevel = 0x8000000A,
     },
     {
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts)
  2015-11-03 19:58 [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Eduardo Habkost
                   ` (2 preceding siblings ...)
  2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 3/3] target-i386: Remove ABM " Eduardo Habkost
@ 2015-11-03 20:22 ` Paolo Bonzini
  2015-11-03 22:54   ` Eduardo Habkost
  3 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2015-11-03 20:22 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel
  Cc: Igor Mammedov, Michael S. Tsirkin, Dr. David Alan Gilbert,
	Richard Henderson



On 03/11/2015 20:58, Eduardo Habkost wrote:
> The x86 change to make "check" mode be enabled by default made QEMU print
> warnings in the default case if running in an Intel host:
> 
>   $ qemu-system-x86_64 -machine pc,accel=kvm
>   warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]
> 
> There's also a warning when about missing the ABM feature if running on a Sandy
> Bridge or older host.
> 
> ABM is not available on Sandy Bridge and older, SSE4a is not available in any
> Intel host. We want to make the default CPU runnable in most hosts, so those
> features won't be enabled by default in KVM mode.
> 
> We should eventually have all features supported by TCG enabled by default in
> TCG mode, but as we don't have a good mechanism today to ensure we have
> different defaults in KVM and TCG mode, disable ABM and SSE4a in the qemu64 CPU
> model entirely.
> 
> Also, as we can't change the guest ABI in pc-*-2.4, disable "check" mode by
> default in pc-*-2.4 and older so we don't print spurious warnings.
> 
> Note that with this change, the qemu64 CPU model still requires a host
> supporting POPCNT (Nehalem or newer, and Opteron_G3 or newer).

Do we want to remove that one as well?

> Eduardo Habkost (3):
>   target-i386: Set "check=off" by default on pc-*-2.4 and older
>   target-i386: Remove SSE4a from qemu64 CPU model
>   target-i386: Remove ABM from qemu64 CPU model
> 
>  include/hw/i386/pc.h | 15 +++++++++++++++
>  target-i386/cpu.c    |  3 +--
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 

In any case,

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

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

* Re: [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts)
  2015-11-03 20:22 ` [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Paolo Bonzini
@ 2015-11-03 22:54   ` Eduardo Habkost
  2015-11-04 10:50     ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2015-11-03 22:54 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Igor Mammedov, Michael S. Tsirkin, qemu-devel,
	Dr. David Alan Gilbert, Richard Henderson

On Tue, Nov 03, 2015 at 09:22:30PM +0100, Paolo Bonzini wrote:
> On 03/11/2015 20:58, Eduardo Habkost wrote:
> > The x86 change to make "check" mode be enabled by default made QEMU print
> > warnings in the default case if running in an Intel host:
> > 
> >   $ qemu-system-x86_64 -machine pc,accel=kvm
> >   warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]
> > 
> > There's also a warning when about missing the ABM feature if running on a Sandy
> > Bridge or older host.
> > 
> > ABM is not available on Sandy Bridge and older, SSE4a is not available in any
> > Intel host. We want to make the default CPU runnable in most hosts, so those
> > features won't be enabled by default in KVM mode.
> > 
> > We should eventually have all features supported by TCG enabled by default in
> > TCG mode, but as we don't have a good mechanism today to ensure we have
> > different defaults in KVM and TCG mode, disable ABM and SSE4a in the qemu64 CPU
> > model entirely.
> > 
> > Also, as we can't change the guest ABI in pc-*-2.4, disable "check" mode by
> > default in pc-*-2.4 and older so we don't print spurious warnings.
> > 
> > Note that with this change, the qemu64 CPU model still requires a host
> > supporting POPCNT (Nehalem or newer, and Opteron_G3 or newer).
> 
> Do we want to remove that one as well?

Probably, yes. libvirt even has these commented out in their cpu_map.xml:

    <model name='qemu64'>
      <model name='kvm64'/>
      <!-- These are supported only by TCG.  KVM supports them only if the
           host does.  So we leave them out:

           <feature name='popcnt'/>
           <feature name='lahf_lm'/>
           <feature name='sse4a'/>
           <feature name='abm'/>
      -->
      <feature name='svm'/>
    </model>

(libvirt must stop making assumptions about the CPU model feature sets so
all <feature> elements in cpu_map.xml should go away. But at least the
current cpu_map.xml is a good reference to what it expects today.)

-- 
Eduardo

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

* Re: [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts)
  2015-11-03 22:54   ` Eduardo Habkost
@ 2015-11-04 10:50     ` Paolo Bonzini
  0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2015-11-04 10:50 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Igor Mammedov, Richard Henderson, qemu-devel,
	Dr. David Alan Gilbert, Michael S. Tsirkin



On 03/11/2015 23:54, Eduardo Habkost wrote:
> Probably, yes. libvirt even has these commented out in their cpu_map.xml:
> 
>     <model name='qemu64'>
>       <model name='kvm64'/>
>       <!-- These are supported only by TCG.  KVM supports them only if the
>            host does.  So we leave them out:
> 
>            <feature name='popcnt'/>
>            <feature name='lahf_lm'/>
>            <feature name='sse4a'/>
>            <feature name='abm'/>
>       -->
>       <feature name='svm'/>
>     </model>
> 
> (libvirt must stop making assumptions about the CPU model feature sets so
> all <feature> elements in cpu_map.xml should go away. But at least the
> current cpu_map.xml is a good reference to what it expects today.)

FWIW, lahf_lm is present on virtually all 64-bit machines and is rare
enough that KVM could just emulate it, so we shouldn't remove it.  But
removing popcnt is a good suggestion to take from libvirt.  It can be
done on top of this series.  We should get all of this into the first
-rc, anyway.

Paolo

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

end of thread, other threads:[~2015-11-04 10:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 19:58 [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Eduardo Habkost
2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 1/3] target-i386: Set "check=off" by default on pc-*-2.4 and older Eduardo Habkost
2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 2/3] target-i386: Remove SSE4a from qemu64 CPU model Eduardo Habkost
2015-11-03 19:58 ` [Qemu-devel] [PATCH v2 3/3] target-i386: Remove ABM " Eduardo Habkost
2015-11-03 20:22 ` [Qemu-devel] [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by default in KVM mode (in most hosts) Paolo Bonzini
2015-11-03 22:54   ` Eduardo Habkost
2015-11-04 10:50     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.