qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-i386: Disable cache info passthrough by default
@ 2015-08-19 17:08 Eduardo Habkost
  2015-09-01 12:39 ` Igor Mammedov
  0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Habkost @ 2015-08-19 17:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Benoît Canet

The host cache information may not make sense for the guest if the VM
CPU topology doesn't match the host CPU topology. To make sure we won't
expose broken cache information to the guest, disable cache info
passthrough by default, and add a new "host-cache-info" property that
can be used to enable the old behavior for users that really need it.

Cc: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/cpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index cfb8aa7..3a71f15 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -689,7 +689,6 @@ struct X86CPUDefinition {
     int stepping;
     FeatureWordArray features;
     char model_id[48];
-    bool cache_info_passthrough;
 };
 
 static X86CPUDefinition builtin_x86_defs[] = {
@@ -1416,6 +1415,7 @@ static X86CPUDefinition host_cpudef;
 
 static Property host_x86_cpu_properties[] = {
     DEFINE_PROP_BOOL("migratable", X86CPU, migratable, true),
+    DEFINE_PROP_BOOL("host-cache-info", X86CPU, cache_info_passthrough, false),
     DEFINE_PROP_END_OF_LIST()
 };
 
@@ -1442,7 +1442,6 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
     cpu_x86_fill_model_id(host_cpudef.model_id);
 
     xcc->cpu_def = &host_cpudef;
-    host_cpudef.cache_info_passthrough = true;
 
     /* level, xlevel, xlevel2, and the feature words are initialized on
      * instance_init, because they require KVM to be initialized.
@@ -2076,7 +2075,6 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp)
     object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp);
     object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp);
     object_property_set_int(OBJECT(cpu), def->xlevel2, "xlevel2", errp);
-    cpu->cache_info_passthrough = def->cache_info_passthrough;
     object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp);
     for (w = 0; w < FEATURE_WORDS; w++) {
         env->features[w] = def->features[w];
-- 
2.1.0

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

* Re: [Qemu-devel] [PATCH] target-i386: Disable cache info passthrough by default
  2015-08-19 17:08 [Qemu-devel] [PATCH] target-i386: Disable cache info passthrough by default Eduardo Habkost
@ 2015-09-01 12:39 ` Igor Mammedov
  2015-09-01 16:58   ` Eduardo Habkost
  0 siblings, 1 reply; 3+ messages in thread
From: Igor Mammedov @ 2015-09-01 12:39 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, qemu-devel, Benoît Canet

On Wed, 19 Aug 2015 10:08:22 -0700
Eduardo Habkost <ehabkost@redhat.com> wrote:

> The host cache information may not make sense for the guest if the VM
> CPU topology doesn't match the host CPU topology. To make sure we won't
> expose broken cache information to the guest, disable cache info
> passthrough by default, and add a new "host-cache-info" property that
> can be used to enable the old behavior for users that really need it.
> 
> Cc: Benoît Canet <benoit@irqsave.net>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  target-i386/cpu.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index cfb8aa7..3a71f15 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -689,7 +689,6 @@ struct X86CPUDefinition {
>      int stepping;
>      FeatureWordArray features;
>      char model_id[48];
> -    bool cache_info_passthrough;
>  };
>  
>  static X86CPUDefinition builtin_x86_defs[] = {
> @@ -1416,6 +1415,7 @@ static X86CPUDefinition host_cpudef;
>  
>  static Property host_x86_cpu_properties[] = {
>      DEFINE_PROP_BOOL("migratable", X86CPU, migratable, true),
> +    DEFINE_PROP_BOOL("host-cache-info", X86CPU, cache_info_passthrough, false),
>      DEFINE_PROP_END_OF_LIST()
>  };
>  
> @@ -1442,7 +1442,6 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
>      cpu_x86_fill_model_id(host_cpudef.model_id);
>  
>      xcc->cpu_def = &host_cpudef;
> -    host_cpudef.cache_info_passthrough = true;
>  
>      /* level, xlevel, xlevel2, and the feature words are initialized on
>       * instance_init, because they require KVM to be initialized.
> @@ -2076,7 +2075,6 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp)
>      object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp);
>      object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp);
>      object_property_set_int(OBJECT(cpu), def->xlevel2, "xlevel2", errp);
> -    cpu->cache_info_passthrough = def->cache_info_passthrough;
Isn't that a guest visible change?

>      object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp);
>      for (w = 0; w < FEATURE_WORDS; w++) {
>          env->features[w] = def->features[w];

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

* Re: [Qemu-devel] [PATCH] target-i386: Disable cache info passthrough by default
  2015-09-01 12:39 ` Igor Mammedov
@ 2015-09-01 16:58   ` Eduardo Habkost
  0 siblings, 0 replies; 3+ messages in thread
From: Eduardo Habkost @ 2015-09-01 16:58 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: Paolo Bonzini, qemu-devel, Benoît Canet

On Tue, Sep 01, 2015 at 02:39:00PM +0200, Igor Mammedov wrote:
> On Wed, 19 Aug 2015 10:08:22 -0700
> Eduardo Habkost <ehabkost@redhat.com> wrote:
> 
> > The host cache information may not make sense for the guest if the VM
> > CPU topology doesn't match the host CPU topology. To make sure we won't
> > expose broken cache information to the guest, disable cache info
> > passthrough by default, and add a new "host-cache-info" property that
> > can be used to enable the old behavior for users that really need it.
> > 
> > Cc: Benoît Canet <benoit@irqsave.net>
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> >  target-i386/cpu.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > index cfb8aa7..3a71f15 100644
> > --- a/target-i386/cpu.c
> > +++ b/target-i386/cpu.c
> > @@ -689,7 +689,6 @@ struct X86CPUDefinition {
> >      int stepping;
> >      FeatureWordArray features;
> >      char model_id[48];
> > -    bool cache_info_passthrough;
> >  };
> >  
> >  static X86CPUDefinition builtin_x86_defs[] = {
> > @@ -1416,6 +1415,7 @@ static X86CPUDefinition host_cpudef;
> >  
> >  static Property host_x86_cpu_properties[] = {
> >      DEFINE_PROP_BOOL("migratable", X86CPU, migratable, true),
> > +    DEFINE_PROP_BOOL("host-cache-info", X86CPU, cache_info_passthrough, false),
> >      DEFINE_PROP_END_OF_LIST()
> >  };
> >  
> > @@ -1442,7 +1442,6 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
> >      cpu_x86_fill_model_id(host_cpudef.model_id);
> >  
> >      xcc->cpu_def = &host_cpudef;
> > -    host_cpudef.cache_info_passthrough = true;
> >  
> >      /* level, xlevel, xlevel2, and the feature words are initialized on
> >       * instance_init, because they require KVM to be initialized.
> > @@ -2076,7 +2075,6 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp)
> >      object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp);
> >      object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp);
> >      object_property_set_int(OBJECT(cpu), def->xlevel2, "xlevel2", errp);
> > -    cpu->cache_info_passthrough = def->cache_info_passthrough;
> Isn't that a guest visible change?

It is. I am not convinced we should spend time trying to make live
migration work with -cpu host unless we hear from an actual user that
depend on it, but in this case it is really simple to keep compatibility
by adding host-cache-info=on to PC_COMPAT_2_4, so I will send a new
version.

> 
> >      object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp);
> >      for (w = 0; w < FEATURE_WORDS; w++) {
> >          env->features[w] = def->features[w];
> 

-- 
Eduardo

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

end of thread, other threads:[~2015-09-01 16:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19 17:08 [Qemu-devel] [PATCH] target-i386: Disable cache info passthrough by default Eduardo Habkost
2015-09-01 12:39 ` Igor Mammedov
2015-09-01 16:58   ` Eduardo Habkost

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).