* [Qemu-devel] [qom-cpu PATCH v3 1/2] target-i386: Use x86_cpu_get_supported_feature_word() for "-cpu host"
2014-06-17 20:31 [Qemu-devel] [qom-cpu PATCH v3 0/2] target-i386: Fixes for migratable/invtsc Eduardo Habkost
@ 2014-06-17 20:31 ` Eduardo Habkost
2014-06-17 20:31 ` [Qemu-devel] [qom-cpu PATCH v3 2/2] target-i386: Set migratable=yes by default on "host" CPU mooel Eduardo Habkost
1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Habkost @ 2014-06-17 20:31 UTC (permalink / raw)
To: qemu-devel, Andreas Färber
Cc: Paolo Bonzini, Richard Henderson, Marcelo Tosatti, Aurelien Jarno,
Igor Mammedov
This will make "-cpu host" to 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.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target-i386/cpu.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index d401a7c..5db0338 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1276,6 +1276,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);
@@ -1290,10 +1293,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);
}
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [qom-cpu PATCH v3 2/2] target-i386: Set migratable=yes by default on "host" CPU mooel
2014-06-17 20:31 [Qemu-devel] [qom-cpu PATCH v3 0/2] target-i386: Fixes for migratable/invtsc Eduardo Habkost
2014-06-17 20:31 ` [Qemu-devel] [qom-cpu PATCH v3 1/2] target-i386: Use x86_cpu_get_supported_feature_word() for "-cpu host" Eduardo Habkost
@ 2014-06-17 20:31 ` Eduardo Habkost
1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Habkost @ 2014-06-17 20:31 UTC (permalink / raw)
To: qemu-devel, Andreas Färber
Cc: Paolo Bonzini, Richard Henderson, Marcelo Tosatti, Aurelien Jarno,
Igor Mammedov
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.
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
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(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 5db0338..8c80dea 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1240,7 +1240,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()
};
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread