target-i386: Disable CPUID_EXT_MONITOR when KVM is enabled
PATCH 1/1 target-i386: Disable CPUID_EXT_MONITOR when KVM is enabled
By default, CPUID_EXT_MONITOR is enabled for some cpu models such as Opteron_G3. Disable it if kvm_enabled() is true since monitor/mwait aren't supported by KVM yet.
---
There is no user visible side-effect to this behavior, the aim is to clean up the default flags that are not supported (yet).
target-i386/cpu.c | 1 + 1 file changed, 1 insertion(+)
target-i386/cpu.c +1 -0
@@ -1749,6 +1749,7 @@ static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)if (kvm_enabled ()) { def->features[FEAT_KVM ] |= kvm_default_features; + def->features[FEAT_1_ECX ] &= ~CPUID_EXT_MONITOR ; } def->features[FEAT_1_ECX ] |=CPUID_EXT_HYPERVISOR ;
Signature · 1 line
1.8.1.4
Forwarding message by Eduardo. I had misspelled nongnu.org in my first attempt! The spaces/tab comment by Eduardo has been fixed.
Quoted 6 lines · Eduardo Habkost
By default,
CPUID_EXT_MONITORis enabled for some cpu models such asOpteron_G3. Disable it ifkvm_enabled()is true since monitor/mwait aren't supported by KVM yet.Signed-off-by Bandan Das <[email protected]>
Interesting, I haven't noticed that TCG supports CPUID_EXT_MONITOR.
I believe that's yet another reason to make the KVM CPU models separate classes from the TCG CPU models: because
"-machine ...,accel=kvm -cpu Foo" and "-machine ...,accel=tcg -cpu Foo" _already_ have different meanings today and result in different CPUs. Making them classes would just make the fact that they _are_ different CPU models explicit.
Quoted 3 lines
---
There is no user visible side-effect to this behavior, the aim is to clean up the default flags that are not supported (yet).
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpu Opteron_G3" to match what was already happening in practice.
target-i386/cpu.c static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp) · line 1752
Quoted 13 lines
target-i386/cpu.c | 1 + 1 file changed, 1 insertion(+)target-i386/cpu.c +1
-0@@ -1749,6 +1749,7 @@ static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)if (kvm_enabled ()) { def->features[FEAT_KVM ] |= kvm_default_features; + def->features[FEAT_1_ECX ] &= ~CPUID_EXT_MONITOR ;
You are mixing spaces and tabs, here.
Quoted 6 lines
target-i386/cpu.c +0
-0} def->features[FEAT_1_ECX ] |=CPUID_EXT_HYPERVISOR ;Signature · 1 line
1.8.1.4
Signature · 1 line
Eduardo
Quoted 23 lines
By default,
CPUID_EXT_MONITORis enabled for some cpu models such asOpteron_G3. Disable it ifkvm_enabled()is true since monitor/mwait aren't supported by KVM yet.Signed-off-by Bandan Das <[email protected]>---
There is no user visible side-effect to this behavior, the aim is to clean up the default flags that are not supported (yet).target-i386/cpu.c | 1 + 1 file changed, 1 insertion(+)target-i386/cpu.c +1
-0@@ -1749,6 +1749,7 @@ static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)if (kvm_enabled ()) { def->features[FEAT_KVM ] |= kvm_default_features; + def->features[FEAT_1_ECX ] &= ~CPUID_EXT_MONITOR ; } def->features[FEAT_1_ECX ] |=CPUID_EXT_HYPERVISOR ;
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.
But then -cpu Opteron_G3 does not match a "real" Opteron G3. Is it worth it?
Paolo
Quoted 10 lines · Paolo Bonzini
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.But then -cpu
Opteron_G3does not match a "real" Opteron G3. Is it worth it?
No models match a "real" CPU this way, because neither TCG or KVM support all features supported by a real CPU. I ask the opposite
question: is it worth maintaining an "accurate" CPU model definition that would never work without feature-bit tweaking in the command-line?
Signature · 1 line
Eduardo
Il 27/05/2013 14:09, Eduardo Habkost ha scritto:
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.
Quoted 7 lines
Quoted 2 lines
But then -cpu
Opteron_G3does not match a "real" Opteron G3. Is it worth it?No models match a "real" CPU this way, because neither TCG or KVM support all features supported by a real CPU. I ask the opposite
question: is it worth maintaining an "accurate" CPU model definition that would never work without feature-bit tweaking in the command-line?
It would work with TCG. Changing TCG to KVM should not change hardware if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Paolo
Quoted 13 lines · Paolo Bonzini
Il 27/05/2013 14:09, Eduardo Habkost ha scritto:
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.But then -cpu
Opteron_G3does not match a "real" Opteron G3. Is it worth it?
Quoted 9 lines
Quoted 4 lines
No models match a "real" CPU this way, because neither TCG or KVM support all features supported by a real CPU. I ask the opposite
question: is it worth maintaining an "accurate" CPU model definition that would never work without feature-bit tweaking in the command-line?It would work with TCG. Changing TCG to KVM should not change hardware if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Changing between KVM and TCG _does_ change hardware, today (with or without check/enforce). All CPU models on TCG have features not supported by TCG automatically removed. See the "if (!kvm_enabled())" block at x86_cpu_realizefn().
(That's why I argue that we need separate classes/names for TCG and KVM modes. Otherwise our predefined models get less useful as they will require low-level feature-bit fiddling on the libvirt side to make them work as expected.)
Signature · 1 line
Eduardo
Il 27/05/2013 15:07, Eduardo Habkost ha scritto:
Quoted 8 lines
Quoted 4 lines
Changing TCG to KVM should not change hardware
Quoted 3 lines
if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Changing between KVM and TCG _does_ change hardware, today (with or without check/enforce). All CPU models on TCG have features not supported by TCG automatically removed. See the "if (!kvm_enabled())" block at
x86_cpu_realizefn().
Perhaps (for "-cpu ...,enforce" or check) that's the real bug we have to fix?
Paolo
Quoted 5 lines
(That's why I argue that we need separate classes/names for TCG and KVM modes. Otherwise our predefined models get less useful as they will require low-level feature-bit fiddling on the libvirt side to make them work as expected.)
Quoted 5 lines · Paolo Bonzini
Il 27/05/2013 15:07, Eduardo Habkost ha scritto:
Quoted 4 lines
Quoted 4 lines
Changing TCG to KVM should not change hardware
Quoted 3 lines
if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Quoted 7 lines
Quoted 4 lines
Changing between KVM and TCG _does_ change hardware, today (with or without check/enforce). All CPU models on TCG have features not supported by TCG automatically removed. See the "if (!kvm_enabled())" block at
x86_cpu_realizefn().Perhaps (for "-cpu ...,enforce" or check) that's the real bug we have to fix?
It would be 100% accurate, but would it be useful? We will then have a Opteron_G3 CPU model that can't be used reliably without low-level bit fiddling, on either TCG or KVM mode.
Note that I am not completely against it. I agree that having a single CPU model namespace with 100%-equivalent definitions for both TCG and KVM modes would simplify the logic a lot. I am just not sure if it is worth it.
(To be honest, I am more worried about the amount of time I will waste trying to change the behavior of the TCG code. I am pretty sure I will hear something like "why are you wasting your time trying to make check/enforce work for TCG? Please leave TCG alone!".)
Signature · 1 line
Eduardo
Quoted 24 lines · Eduardo Habkost
Quoted 13 lines · Paolo Bonzini
Il 27/05/2013 14:09, Eduardo Habkost ha scritto:
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.But then -cpu
Opteron_G3does not match a "real" Opteron G3. Is it worth it?Quoted 9 lines
Quoted 4 lines
No models match a "real" CPU this way, because neither TCG or KVM support all features supported by a real CPU. I ask the opposite
question: is it worth maintaining an "accurate" CPU model definition that would never work without feature-bit tweaking in the command-line?It would work with TCG. Changing TCG to KVM should not change hardware if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Quoted 4 lines
Changing between KVM and TCG _does_ change hardware, today (with or without check/enforce). All CPU models on TCG have features not supported by TCG automatically removed. See the "if (!kvm_enabled())" block at
x86_cpu_realizefn().
Yes, this is exactly why I was inclined to remove the monitor flag. We already have uses of kvm_enabled() to set (or remove) kvm specific stuff, and this change is no different. I can see Paolo's point though, having a common definition probably makes sense too.
Quoted 4 lines
(That's why I argue that we need separate classes/names for TCG and KVM modes. Otherwise our predefined models get less useful as they will require low-level feature-bit fiddling on the libvirt side to make them work as expected.)
Agreed. From a user's perspective, I think the more a CPU model "just works", whether it's KVM or TCG, the better.
Bandan
Il 28/05/2013 18:34, Bandan Das ha scritto:
Quoted 26 lines
Quoted 24 lines · Eduardo Habkost
Quoted 22 lines · Paolo Bonzini
Il 27/05/2013 14:09, Eduardo Habkost ha scritto:
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.Quoted 7 lines
Quoted 2 lines
But then -cpu
Opteron_G3does not match a "real" Opteron G3. Is it worth it?No models match a "real" CPU this way, because neither TCG or KVM support all features supported by a real CPU. I ask the opposite
question: is it worth maintaining an "accurate" CPU model definition that would never work without feature-bit tweaking in the command-line?It would work with TCG. Changing TCG to KVM should not change hardware if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Quoted 8 lines
Quoted 4 lines
Changing between KVM and TCG _does_ change hardware, today (with or without check/enforce). All CPU models on TCG have features not supported by TCG automatically removed. See the "if (!kvm_enabled())" block at
x86_cpu_realizefn().Yes, this is exactly why I was inclined to remove the monitor flag. We already have uses of
kvm_enabled()to set (or remove) kvm specific stuff, and this change is no different.
Do any of these affect something that is part of x86_def_t?
Quoted 10 lines
I can see Paolo's point though, having
a common definition probably makes sense too.Quoted 4 lines
(That's why I argue that we need separate classes/names for TCG and KVM modes. Otherwise our predefined models get less useful as they will require low-level feature-bit fiddling on the libvirt side to make them work as expected.)
Agreed. From a user's perspective, I think the more a CPU model "just works", whether it's KVM or TCG, the better.
Yes, that's right. But I think extending the same expectation to "-cpu ...,enforce" is not necessary, and perhaps even wrong for "-cpu ...,check" since it's only a warning rather than a fatal error.
Paolo
Am 28.05.2013 18:46, schrieb Paolo Bonzini:
Quoted 32 lines
Il 28/05/2013 18:34, Bandan Das ha scritto:
Quoted 31 lines
Quoted 28 lines · Eduardo Habkost
Quoted 13 lines · Paolo Bonzini
Il 27/05/2013 14:09, Eduardo Habkost ha scritto:
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.But then -cpu
Opteron_G3does not match a "real" Opteron G3. Is it worth it?Quoted 9 lines
Quoted 4 lines
No models match a "real" CPU this way, because neither TCG or KVM support all features supported by a real CPU. I ask the opposite
question: is it worth maintaining an "accurate" CPU model definition that would never work without feature-bit tweaking in the command-line?It would work with TCG. Changing TCG to KVM should not change hardware if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Changing between KVM and TCG _does_ change hardware, today (with or without check/enforce). All CPU models on TCG have features not supported by TCG automatically removed. See the "if (!kvm_enabled())" block at
x86_cpu_realizefn().
Quoted 5 lines
Quoted 3 lines
Yes, this is exactly why I was inclined to remove the monitor flag. We already have uses of
kvm_enabled()to set (or remove) kvm specific stuff, and this change is no different.Do any of these affect something that is part of
x86_def_t?
The vendor comes to mind.
Andreas
Quoted 17 lines
Quoted 10 lines
I can see Paolo's point though, having
a common definition probably makes sense too.Quoted 4 lines
(That's why I argue that we need separate classes/names for TCG and KVM modes. Otherwise our predefined models get less useful as they will require low-level feature-bit fiddling on the libvirt side to make them work as expected.)
Agreed. From a user's perspective, I think the more a CPU model "just works", whether it's KVM or TCG, the better.
Yes, that's right. But I think extending the same expectation to "-cpu ...,enforce" is not necessary, and perhaps even wrong for "-cpu ...,check" since it's only a warning rather than a fatal error.
Paolo
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
(CCing libvirt people)
Quoted 33 lines · Andreas Färber
Am 28.05.2013 18:46, schrieb Paolo Bonzini:
Quoted 32 lines
Il 28/05/2013 18:34, Bandan Das ha scritto:
Quoted 31 lines
Quoted 28 lines · Eduardo Habkost
Quoted 13 lines · Paolo Bonzini
Il 27/05/2013 14:09, Eduardo Habkost ha scritto:
Quoted 12 lines · Paolo Bonzini
Quoted 10 lines
Il 25/05/2013 03:21, Bandan Das ha scritto:
Quoted 6 lines
There is one user-visible effect: "-cpu ...,enforce" will stop failing because of missing KVM support for
CPUID_EXT_MONITOR. But that's exactly the point: there's no point in having CPU model definitions that would never work as-is with neither TCG or KVM. This patch is changing the meaning of (e.g.) "-machine ...,accel=kvm -cpuOpteron_G3" to match what was already happening in practice.But then -cpu
Opteron_G3does not match a "real" Opteron G3. Is it worth it?Quoted 9 lines
Quoted 4 lines
No models match a "real" CPU this way, because neither TCG or KVM support all features supported by a real CPU. I ask the opposite
question: is it worth maintaining an "accurate" CPU model definition that would never work without feature-bit tweaking in the command-line?It would work with TCG. Changing TCG to KVM should not change hardware if you use "-cpu ...,enforce", so it is right that it fails when starting with KVM.
Changing between KVM and TCG _does_ change hardware, today (with or without check/enforce). All CPU models on TCG have features not supported by TCG automatically removed. See the "if (!kvm_enabled())" block at
x86_cpu_realizefn().
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yes, this is exactly why I was inclined to remove the monitor flag. We already have uses of
kvm_enabled()to set (or remove) kvm specific stuff, and this change is no different.Do any of these affect something that is part of
x86_def_t?The vendor comes to mind.
I believe we can still consider the "vendor" field a special one: if other components care about the TCG/KVM difference regarding the "vendor" field, they can simply set "vendor" explicitly on the command-line.
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
I can see Paolo's point though, having
a common definition probably makes sense too.
Paolo is convincing me that keeping the rest of the features exactly the same on TCG and KVM modes (and making check/enforce work for TCG as well) would simplify the logic a lot. This will add a little extra work for libvirt, that will probably need to use "-cpu Opteron_G3,-monitor" once it implements enforce-mode (to make sure the results really match existing libvirt assumptions about the Opteron_G* models), but it is probably worth it.
I will give it a try and send a proposal soon.
Quoted 19 lines
Quoted 14 lines
Quoted 7 lines
Quoted 4 lines
(That's why I argue that we need separate classes/names for TCG and KVM modes. Otherwise our predefined models get less useful as they will require low-level feature-bit fiddling on the libvirt side to make them work as expected.)
Agreed. From a user's perspective, I think the more a CPU model "just works", whether it's KVM or TCG, the better.
Yes, that's right. But I think extending the same expectation to "-cpu ...,enforce" is not necessary, and perhaps even wrong for "-cpu ...,check" since it's only a warning rather than a fatal error.
Paolo
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Signature · 1 line
Eduardo