Skip to contentSkip to conversation

target-i386: Fixes for migratable/invtsc

PATCH Superseded Eduardo Habkost 1 participant 4 messages May 16, 2014 – Jun 2, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover target-i386: Fixes for migratable/invtsc

This series contains two fixes for the qom-cpu branch:
* Make the new "migratable" property actually work;
* Avoid breaking setups where "-cpu host" needs to be migratable. (See discussion at http://marc.info/?l=qemu-devel&m=139838802220184&w=2 )

Cc Andreas Färber <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Richard Henderson <[email protected]>

Eduardo Habkost (2):
target-i386: Use x86_cpu_get_supported_feature_word() for "-cpu host"
target-i386: Set migratable=yes by default on "host" CPU mooel

 target-i386/cpu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
1.9.0
#1 lore raw

PATCH v2 1/2 target-i386: Use x86_cpu_get_supported_feature_word() for "-cpu host"

This will make "-cpu host" reuse the feature filtering logic used by x86_cpu_filter_features() (i.e. TCG support, and the new "migratable" flag).

This doesn't add "-cpu host" support to TCG mode yet, but that may be possible eventually.

---
 target-i386/cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
target-i386/cpu.c +4 -3
index 715078a..61e8800 100644
@@ -1279,6 +1279,9 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
     dc->props = host_x86_cpu_properties;
 }
 
+static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
+                                                   bool migratable_only);
+
 static void host_x86_cpu_initfn(Object *obj)
 {
     X86CPU *cpu = X86_CPU(obj);
@@ -1293,10 +1296,8 @@ static void host_x86_cpu_initfn(Object *obj)
     env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX);
 
     for (w = 0; w < FEATURE_WORDS; w++) {
-        FeatureWordInfo *wi = &feature_word_info[w];
         env->features[w] =
-            kvm_arch_get_supported_cpuid(s, wi->cpuid_eax, wi->cpuid_ecx,
-                                         wi->cpuid_reg);
+            x86_cpu_get_supported_feature_word(w, cpu->migratable);
     }
     object_property_set_bool(OBJECT(cpu), true, "pmu", &error_abort);
 }
Signature · 1 line
1.9.0
#2 lore raw

PATCH v2 2/2 target-i386: Set migratable=yes by default on "host" CPU mooel

In reply to Eduardo Habkost

Having only migratable flags reported by default on the "host" CPU model is safer for the following reasons:

* Existing users may expect "-cpu host" to be migration-safe, if they take care of always using compatible host CPUs, host kernels, and QEMU versions.
* Users who don't care aboug migration and want to enable all features supported by the host kernel can simply change their setup to use migratable=no.

Without this change, people using "-cpu host" will stop being able to migrate, because now "invtsc" is getting enabled by default.

We are not setting migratable=yes by default on all X86CPU subclasses, because users should be able to get non-migratable features enabled if they ask for them explicitly.

---
For a discussion about why it makes sense to set it by default, see:
http://marc.info/?l=qemu-devel&m=139838802220184&w=2

---
 target-i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-i386/cpu.c +1 -1
index 61e8800..1395473 100644
@@ -1243,7 +1243,7 @@ static int cpu_x86_fill_model_id(char *str)
 static X86CPUDefinition host_cpudef;
 
 static Property host_x86_cpu_properties[] = {
-    DEFINE_PROP_BOOL("migratable", X86CPU, migratable, false),
+    DEFINE_PROP_BOOL("migratable", X86CPU, migratable, true),
     DEFINE_PROP_END_OF_LIST()
 };
 
Signature · 1 line
1.9.0
#3 lore raw
In reply to Eduardo Habkost

Ping? qom-cpu is still broken and needs the fixes below.

Are there plans to include them and submit a pull request soon?

This one is also pending:

Message-ID: <[email protected]>
From: Marcelo Tosatti <[email protected]>
Subject: [Qemu-devel] [qom/qom-cpu PATCH] i386: improve invtsc migration
blocker error message
http://marc.info/?l=qemu-devel&m=140138256316042

Quoted 24 lines · Eduardo Habkost

This series contains two fixes for the qom-cpu branch:
* Make the new "migratable" property actually work;
* Avoid breaking setups where "-cpu host" needs to be migratable. (See discussion at http://marc.info/?l=qemu-devel&m=139838802220184&w=2 )

Cc Andreas Färber <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Aurelien Jarno <[email protected]>
Cc Richard Henderson <[email protected]>

Eduardo Habkost (2):
target-i386: Use x86_cpu_get_supported_feature_word() for "-cpu host"
target-i386: Set migratable=yes by default on "host" CPU mooel

 target-i386/cpu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
1.9.0
Signature · 1 line
Eduardo