* [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models
@ 2011-05-23 21:46 john cooper
2011-05-28 8:39 ` Jan Kiszka
0 siblings, 1 reply; 18+ messages in thread
From: john cooper @ 2011-05-23 21:46 UTC (permalink / raw)
To: qemu-devel; +Cc: john cooper, Anthony Liguori
Add kvm emulated x2apic flag to config defined cpu models
and general support for such hypervisor emulated flags.
In addition to checking user request flags against the host
we also selectively check against kvm for emulated flags.
Signed-off-by: john cooper <john.cooper@redhat.com>
---
diff --git a/hw/pc.c b/hw/pc.c
index 8106197..5b94e53 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -927,7 +927,7 @@ static CPUState *pc_new_cpu(const char *cpu_model)
env = cpu_init(cpu_model);
if (!env) {
- fprintf(stderr, "Unable to find x86 CPU definition\n");
+ fprintf(stderr, "Unable to support requested x86 CPU definition\n");
exit(1);
}
if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) {
diff --git a/sysconfigs/target/target-x86_64.conf b/sysconfigs/target/target-x86_64.conf
index 0613870..3b85b2e 100644
--- a/sysconfigs/target/target-x86_64.conf
+++ b/sysconfigs/target/target-x86_64.conf
@@ -8,7 +8,7 @@
model = "15"
stepping = "3"
feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36"
- feature_ecx = "sse3 ssse3"
+ feature_ecx = "sse3 ssse3 x2apic"
extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx"
extfeature_ecx = "lahf_lm"
xlevel = "0x8000000A"
@@ -22,7 +22,7 @@
model = "23"
stepping = "3"
feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36"
- feature_ecx = "sse3 cx16 ssse3 sse4.1"
+ feature_ecx = "sse3 cx16 ssse3 sse4.1 x2apic"
extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx"
extfeature_ecx = "lahf_lm"
xlevel = "0x8000000A"
@@ -36,7 +36,7 @@
model = "26"
stepping = "3"
feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36"
- feature_ecx = "sse3 cx16 ssse3 sse4.1 sse4.2 popcnt"
+ feature_ecx = "sse3 cx16 ssse3 sse4.1 sse4.2 popcnt x2apic"
extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx"
extfeature_ecx = "lahf_lm"
xlevel = "0x8000000A"
@@ -50,7 +50,7 @@
model = "6"
stepping = "1"
feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36"
- feature_ecx = "sse3"
+ feature_ecx = "sse3 x2apic"
extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx"
# extfeature_ecx = ""
xlevel = "0x80000008"
@@ -64,7 +64,7 @@
model = "6"
stepping = "1"
feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36"
- feature_ecx = "sse3 cx16"
+ feature_ecx = "sse3 cx16 x2apic"
extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx rdtscp"
extfeature_ecx = "svm lahf_lm"
xlevel = "0x80000008"
@@ -78,7 +78,7 @@
model = "6"
stepping = "1"
feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce pae msr tsc pse de fpu mtrr clflush mca pse36"
- feature_ecx = "sse3 cx16 monitor popcnt"
+ feature_ecx = "sse3 cx16 monitor popcnt x2apic"
extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr tsc pse de fpu lm syscall nx rdtscp"
extfeature_ecx = "svm sse4a abm misalignsse lahf_lm"
xlevel = "0x80000008"
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index e479a4d..c151f12 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -549,15 +549,40 @@ static int unavailable_host_feature(struct model_features_t *f, uint32_t mask)
return 0;
}
-/* best effort attempt to inform user requested cpu flags aren't making
- * their way to the guest. Note: ft[].check_feat ideally should be
- * specified via a guest_def field to suppress report of extraneous flags.
+/* determine the effective set of cpuid features visible to a guest.
+ * in the case kvm is enabled, we also selectively include features
+ * emulated by the hypervisor
*/
-static int check_features_against_host(x86_def_t *guest_def)
+static void summary_cpuid_features(CPUX86State *env, x86_def_t *hd)
+{
+ struct {
+ uint32_t *pfeat, cmd, reg, mask;
+ } fmap[] = {
+ {&hd->features, 0x00000001, R_EDX, 0},
+ {&hd->ext_features, 0x00000001, R_ECX, CPUID_EXT_X2APIC},
+ {&hd->ext2_features, 0x80000001, R_EDX, 0},
+ {&hd->ext3_features, 0x80000001, R_ECX, 0},
+ {NULL} }, *p;
+
+ cpu_x86_fill_host(hd);
+ if (kvm_enabled()) {
+ for (p = fmap; p->pfeat; ++p) {
+ if (p->mask) {
+ *p->pfeat |= p->mask &
+ kvm_arch_get_supported_cpuid(env, p->cmd, 0, p->reg);
+ }
+ }
+ }
+}
+
+/* inform the user of any requested cpu features (both explicitly requested
+ * flags and implicit cpu model flags) not making their way to the guest
+ */
+static int check_features_against_host(CPUX86State *env, x86_def_t *guest_def)
{
x86_def_t host_def;
uint32_t mask;
- int rv, i;
+ int rv;
struct model_features_t ft[] = {
{&guest_def->features, &host_def.features,
~0, feature_name, 0x00000000},
@@ -566,16 +591,16 @@ static int check_features_against_host(x86_def_t *guest_def)
{&guest_def->ext2_features, &host_def.ext2_features,
~PPRO_FEATURES, ext2_feature_name, 0x80000000},
{&guest_def->ext3_features, &host_def.ext3_features,
- ~CPUID_EXT3_SVM, ext3_feature_name, 0x80000001}};
+ ~CPUID_EXT3_SVM, ext3_feature_name, 0x80000001},
+ {NULL} }, *p;
- cpu_x86_fill_host(&host_def);
- for (rv = 0, i = 0; i < ARRAY_SIZE(ft); ++i)
+ summary_cpuid_features(env, &host_def);
+ for (rv = 0, p = ft; p->guest_feat; ++p)
for (mask = 1; mask; mask <<= 1)
- if (ft[i].check_feat & mask && *ft[i].guest_feat & mask &&
- !(*ft[i].host_feat & mask)) {
- unavailable_host_feature(&ft[i], mask);
- rv = 1;
- }
+ if (mask & p->check_feat & *p->guest_feat & ~*p->host_feat) {
+ unavailable_host_feature(p, mask);
+ rv = 1;
+ }
return rv;
}
@@ -602,6 +627,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
if (kvm_enabled() && strcmp(name, "host") == 0) {
cpu_x86_fill_host(x86_cpu_def);
} else if (!def) {
+ fprintf(stderr, "Unknown cpu model: %s\n", name);
goto error;
} else {
memcpy(x86_cpu_def, def, sizeof(*def));
@@ -715,10 +741,6 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
x86_cpu_def->ext3_features &= ~minus_ext3_features;
x86_cpu_def->kvm_features &= ~minus_kvm_features;
x86_cpu_def->svm_features &= ~minus_svm_features;
- if (check_cpuid) {
- if (check_features_against_host(x86_cpu_def) && enforce_cpuid)
- goto error;
- }
free(s);
return 0;
@@ -880,6 +902,11 @@ int cpu_x86_register (CPUX86State *env, const char *cpu_model)
env->cpuid_model[i >> 2] |= c << (8 * (i & 3));
}
}
+ if (check_cpuid) {
+ if (check_features_against_host(env, def) && enforce_cpuid) {
+ return -1;
+ }
+ }
return 0;
}
--
john.cooper@redhat.com
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models
2011-05-23 21:46 [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models john cooper
@ 2011-05-28 8:39 ` Jan Kiszka
2011-05-30 8:18 ` Roedel, Joerg
0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-05-28 8:39 UTC (permalink / raw)
To: john cooper; +Cc: Roedel, Joerg, Anthony Liguori, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]
On 2011-05-23 23:46, john cooper wrote:
> Add kvm emulated x2apic flag to config defined cpu models
> and general support for such hypervisor emulated flags.
>
> In addition to checking user request flags against the host
> we also selectively check against kvm for emulated flags.
As you are already digging through this jungle, could you also check how
much of this diff from qemu-kvm is obsolete now?
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index e479a4d..091d812 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -1175,6 +1175,31 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t
index, uint32_t count,
*ecx |= 1 << 1; /* CmpLegacy bit */
}
}
+ if (kvm_enabled()) {
+ uint32_t h_eax, h_edx;
+
+ host_cpuid(index, 0, &h_eax, NULL, NULL, &h_edx);
+
+ /* disable CPU features that the host does not support */
+
+ /* long mode */
+ if ((h_edx & 0x20000000) == 0 /* || !lm_capable_kernel */)
+ *edx &= ~0x20000000;
+ /* syscall */
+ if ((h_edx & 0x00000800) == 0)
+ *edx &= ~0x00000800;
+ /* nx */
+ if ((h_edx & 0x00100000) == 0)
+ *edx &= ~0x00100000;
+
+ /* disable CPU features that KVM cannot support */
+
+ /* svm */
+ if (!kvm_nested)
+ *ecx &= ~CPUID_EXT3_SVM;
+ /* 3dnow */
+ *edx &= ~0xc0000000;
+ }
break;
case 0x80000002:
case 0x80000003:
If something is still missing in upstream, it should be ported - except
for kvm_nested which should be controllable via '-cpu ...,+/-svm'. TIA!
Jörg, how to deal with -enable-nesting in qemu-kvm to align behavior
with upstream?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models
2011-05-28 8:39 ` Jan Kiszka
@ 2011-05-30 8:18 ` Roedel, Joerg
2011-05-30 14:04 ` [Qemu-devel] drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...) Jan Kiszka
0 siblings, 1 reply; 18+ messages in thread
From: Roedel, Joerg @ 2011-05-30 8:18 UTC (permalink / raw)
To: Jan Kiszka; +Cc: john cooper, Anthony Liguori, qemu-devel@nongnu.org
On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
> Jörg, how to deal with -enable-nesting in qemu-kvm to align behavior
> with upstream?
My personal preference is to just remove it. In upstream-qemu it is
enabled/disabled by +/-svm. -enable-nesting is just a historic thing
which can be wiped out.
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Qemu-devel] drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)
2011-05-30 8:18 ` Roedel, Joerg
@ 2011-05-30 14:04 ` Jan Kiszka
2011-05-30 14:38 ` Nadav Har'El
0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-05-30 14:04 UTC (permalink / raw)
To: Roedel, Joerg; +Cc: john cooper, Anthony Liguori, qemu-devel@nongnu.org, kvm
On 2011-05-30 10:18, Roedel, Joerg wrote:
> On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
>
>> Jörg, how to deal with -enable-nesting in qemu-kvm to align behavior
>> with upstream?
>
> My personal preference is to just remove it. In upstream-qemu it is
> enabled/disabled by +/-svm. -enable-nesting is just a historic thing
> which can be wiped out.
Does any user land depend on it? I guess we have to flag it deprecated
first, trigger some console output when it's specified, and then remove
it one or more releases later (the same applies to many other
qemu-kvm-specific switches).
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)
2011-05-30 14:04 ` [Qemu-devel] drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...) Jan Kiszka
@ 2011-05-30 14:38 ` Nadav Har'El
2011-05-30 15:04 ` [Qemu-devel] drop -enable-nesting Jan Kiszka
0 siblings, 1 reply; 18+ messages in thread
From: Nadav Har'El @ 2011-05-30 14:38 UTC (permalink / raw)
To: Jan Kiszka
Cc: john cooper, Roedel, Joerg, Anthony Liguori,
qemu-devel@nongnu.org, kvm
On Mon, May 30, 2011, Jan Kiszka wrote about "drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)":
> On 2011-05-30 10:18, Roedel, Joerg wrote:
> > On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
> >
> >> Jצrg, how to deal with -enable-nesting in qemu-kvm to align behavior
> >> with upstream?
> >
> > My personal preference is to just remove it. In upstream-qemu it is
> > enabled/disabled by +/-svm. -enable-nesting is just a historic thing
> > which can be wiped out.
"-enable-nesting" could remain as a synonym for enabling either VMX or SVM
in the guest, depending on what was available in the host (because KVM now
supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
--
Nadav Har'El | Monday, May 30 2011, 26 Iyyar 5771
nyh@math.technion.ac.il |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |Software is like sex, it is better when
http://nadav.harel.org.il |it's free -- Linus Torvalds
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 14:38 ` Nadav Har'El
@ 2011-05-30 15:04 ` Jan Kiszka
2011-05-30 15:10 ` Roedel, Joerg
2011-05-30 15:16 ` Nadav Har'El
0 siblings, 2 replies; 18+ messages in thread
From: Jan Kiszka @ 2011-05-30 15:04 UTC (permalink / raw)
To: Nadav Har'El
Cc: john cooper, Roedel, Joerg, Anthony Liguori,
qemu-devel@nongnu.org, kvm
On 2011-05-30 16:38, Nadav Har'El wrote:
> On Mon, May 30, 2011, Jan Kiszka wrote about "drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)":
>> On 2011-05-30 10:18, Roedel, Joerg wrote:
>>> On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
>>>
>>>> Jצrg, how to deal with -enable-nesting in qemu-kvm to align behavior
>>>> with upstream?
>>>
>>> My personal preference is to just remove it. In upstream-qemu it is
>>> enabled/disabled by +/-svm. -enable-nesting is just a historic thing
>>> which can be wiped out.
>
> "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
> in the guest, depending on what was available in the host (because KVM now
> supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
Why? Once nesting is stable (I think SVM already is), there is no reason
for an explicit enable. And you can always mask it out via -cpu.
BTW, what are the defaults for SVM right now in qemu-kvm and upstream?
Enable if the modeled CPU supports it?
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:04 ` [Qemu-devel] drop -enable-nesting Jan Kiszka
@ 2011-05-30 15:10 ` Roedel, Joerg
2011-05-30 15:15 ` Jan Kiszka
2011-05-30 15:16 ` Nadav Har'El
1 sibling, 1 reply; 18+ messages in thread
From: Roedel, Joerg @ 2011-05-30 15:10 UTC (permalink / raw)
To: Jan Kiszka
Cc: john cooper, Anthony Liguori, Nadav Har'El, kvm,
qemu-devel@nongnu.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 1565 bytes --]
On Mon, May 30, 2011 at 11:04:02AM -0400, Jan Kiszka wrote:
> On 2011-05-30 16:38, Nadav Har'El wrote:
> > On Mon, May 30, 2011, Jan Kiszka wrote about "drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)":
> >> On 2011-05-30 10:18, Roedel, Joerg wrote:
> >>> On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
> >>>
> >>>> Jörg, how to deal with -enable-nesting in qemu-kvm to align behavior
> >>>> with upstream?
> >>>
> >>> My personal preference is to just remove it. In upstream-qemu it is
> >>> enabled/disabled by +/-svm. -enable-nesting is just a historic thing
> >>> which can be wiped out.
> >
> > "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
> > in the guest, depending on what was available in the host (because KVM now
> > supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
>
> Why? Once nesting is stable (I think SVM already is), there is no reason
> for an explicit enable. And you can always mask it out via -cpu.
>
> BTW, what are the defaults for SVM right now in qemu-kvm and upstream?
> Enable if the modeled CPU supports it?
qemu-kvm still needs -enable-nesting, otherwise it is disabled. Upstream
qemu should enable it unconditionally (can be disabled with -cpu ,-svm).
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:10 ` Roedel, Joerg
@ 2011-05-30 15:15 ` Jan Kiszka
2011-05-30 15:19 ` Avi Kivity
0 siblings, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-05-30 15:15 UTC (permalink / raw)
To: Roedel, Joerg
Cc: john cooper, Anthony Liguori, Nadav Har'El, kvm,
qemu-devel@nongnu.org
On 2011-05-30 17:10, Roedel, Joerg wrote:
> On Mon, May 30, 2011 at 11:04:02AM -0400, Jan Kiszka wrote:
>> On 2011-05-30 16:38, Nadav Har'El wrote:
>>> On Mon, May 30, 2011, Jan Kiszka wrote about "drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)":
>>>> On 2011-05-30 10:18, Roedel, Joerg wrote:
>>>>> On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
>>>>>
>>>>>> J�rg, how to deal with -enable-nesting in qemu-kvm to align behavior
>>>>>> with upstream?
>>>>>
>>>>> My personal preference is to just remove it. In upstream-qemu it is
>>>>> enabled/disabled by +/-svm. -enable-nesting is just a historic thing
>>>>> which can be wiped out.
>>>
>>> "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
>>> in the guest, depending on what was available in the host (because KVM now
>>> supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
>>
>> Why? Once nesting is stable (I think SVM already is), there is no reason
>> for an explicit enable. And you can always mask it out via -cpu.
>>
>> BTW, what are the defaults for SVM right now in qemu-kvm and upstream?
>> Enable if the modeled CPU supports it?
>
> qemu-kvm still needs -enable-nesting, otherwise it is disabled. Upstream
> qemu should enable it unconditionally (can be disabled with -cpu ,-svm).
Then let's start with aligning qemu-kvm defaults to upstream? I guess
that's what the diff I was citing yesterday is responsible for.
In the same run, -enable-nesting could dump a warning on the console
that this switch is obsolete and will be removed from future versions.
For VMX, I would suggest to keep it off by default until it matured,
asking the user to issue -cpu ...,+vmx.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:15 ` Jan Kiszka
@ 2011-05-30 15:19 ` Avi Kivity
2011-05-30 15:27 ` Jan Kiszka
2011-05-31 8:44 ` Daniel P. Berrange
0 siblings, 2 replies; 18+ messages in thread
From: Avi Kivity @ 2011-05-30 15:19 UTC (permalink / raw)
To: Jan Kiszka, Daniel P. Berrange
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper,
Roedel, Joerg, qemu-devel@nongnu.org
On 05/30/2011 06:15 PM, Jan Kiszka wrote:
> On 2011-05-30 17:10, Roedel, Joerg wrote:
> > On Mon, May 30, 2011 at 11:04:02AM -0400, Jan Kiszka wrote:
> >> On 2011-05-30 16:38, Nadav Har'El wrote:
> >>> On Mon, May 30, 2011, Jan Kiszka wrote about "drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)":
> >>>> On 2011-05-30 10:18, Roedel, Joerg wrote:
> >>>>> On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
> >>>>>
> >>>>>> J�rg, how to deal with -enable-nesting in qemu-kvm to align behavior
> >>>>>> with upstream?
> >>>>>
> >>>>> My personal preference is to just remove it. In upstream-qemu it is
> >>>>> enabled/disabled by +/-svm. -enable-nesting is just a historic thing
> >>>>> which can be wiped out.
> >>>
> >>> "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
> >>> in the guest, depending on what was available in the host (because KVM now
> >>> supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
> >>
> >> Why? Once nesting is stable (I think SVM already is), there is no reason
> >> for an explicit enable. And you can always mask it out via -cpu.
> >>
> >> BTW, what are the defaults for SVM right now in qemu-kvm and upstream?
> >> Enable if the modeled CPU supports it?
> >
> > qemu-kvm still needs -enable-nesting, otherwise it is disabled. Upstream
> > qemu should enable it unconditionally (can be disabled with -cpu ,-svm).
>
> Then let's start with aligning qemu-kvm defaults to upstream? I guess
> that's what the diff I was citing yesterday is responsible for.
>
> In the same run, -enable-nesting could dump a warning on the console
> that this switch is obsolete and will be removed from future versions.
I think it's safe to drop -enable-nesting immediately. Dan, does
libvirt make use of it?
> For VMX, I would suggest to keep it off by default until it matured,
> asking the user to issue -cpu ...,+vmx.
We should do that for svm as well (except for -cpu host or -cpu
something-with-svm). vmx will be kept disabled by the module option,
until it is deemed fit for general consumption.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:19 ` Avi Kivity
@ 2011-05-30 15:27 ` Jan Kiszka
2011-05-30 15:42 ` Jan Kiszka
2011-05-31 8:44 ` Daniel P. Berrange
1 sibling, 1 reply; 18+ messages in thread
From: Jan Kiszka @ 2011-05-30 15:27 UTC (permalink / raw)
To: Avi Kivity
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper,
Roedel, Joerg, qemu-devel@nongnu.org
On 2011-05-30 17:19, Avi Kivity wrote:
> On 05/30/2011 06:15 PM, Jan Kiszka wrote:
>> On 2011-05-30 17:10, Roedel, Joerg wrote:
>>> On Mon, May 30, 2011 at 11:04:02AM -0400, Jan Kiszka wrote:
>>>> On 2011-05-30 16:38, Nadav Har'El wrote:
>>>>> On Mon, May 30, 2011, Jan Kiszka wrote about "drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)":
>>>>>> On 2011-05-30 10:18, Roedel, Joerg wrote:
>>>>>>> On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
>>>>>>>
>>>>>>>> J�rg, how to deal with -enable-nesting in qemu-kvm to align behavior
>>>>>>>> with upstream?
>>>>>>>
>>>>>>> My personal preference is to just remove it. In upstream-qemu it is
>>>>>>> enabled/disabled by +/-svm. -enable-nesting is just a historic thing
>>>>>>> which can be wiped out.
>>>>>
>>>>> "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
>>>>> in the guest, depending on what was available in the host (because KVM now
>>>>> supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
>>>>
>>>> Why? Once nesting is stable (I think SVM already is), there is no reason
>>>> for an explicit enable. And you can always mask it out via -cpu.
>>>>
>>>> BTW, what are the defaults for SVM right now in qemu-kvm and upstream?
>>>> Enable if the modeled CPU supports it?
>>>
>>> qemu-kvm still needs -enable-nesting, otherwise it is disabled. Upstream
>>> qemu should enable it unconditionally (can be disabled with -cpu ,-svm).
>>
>> Then let's start with aligning qemu-kvm defaults to upstream? I guess
>> that's what the diff I was citing yesterday is responsible for.
>>
>> In the same run, -enable-nesting could dump a warning on the console
>> that this switch is obsolete and will be removed from future versions.
>
> I think it's safe to drop -enable-nesting immediately. Dan, does
> libvirt make use of it?
I'm currently checking with some customer who played with Proxmox and
nesting if that stack was aware of the switch or accepted it only via a
side channel.
>
>> For VMX, I would suggest to keep it off by default until it matured,
>> asking the user to issue -cpu ...,+vmx.
>
> We should do that for svm as well (except for -cpu host or -cpu
> something-with-svm).
I assume that's what upstream is doing. Maybe it has it was part of the
artificial default qemu64 model which is AMD based.
> vmx will be kept disabled by the module option,
> until it is deemed fit for general consumption.
>
Yes, even better - no need for duplicate controls.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:27 ` Jan Kiszka
@ 2011-05-30 15:42 ` Jan Kiszka
0 siblings, 0 replies; 18+ messages in thread
From: Jan Kiszka @ 2011-05-30 15:42 UTC (permalink / raw)
To: Avi Kivity
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper,
Roedel, Joerg, qemu-devel@nongnu.org
On 2011-05-30 17:27, Jan Kiszka wrote:
> On 2011-05-30 17:19, Avi Kivity wrote:
>> I think it's safe to drop -enable-nesting immediately. Dan, does
>> libvirt make use of it?
>
> I'm currently checking with some customer who played with Proxmox and
> nesting if that stack was aware of the switch or accepted it only via a
> side channel.
It was a side channel for tweaking the command line options.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:19 ` Avi Kivity
2011-05-30 15:27 ` Jan Kiszka
@ 2011-05-31 8:44 ` Daniel P. Berrange
2011-05-31 8:58 ` Avi Kivity
1 sibling, 1 reply; 18+ messages in thread
From: Daniel P. Berrange @ 2011-05-31 8:44 UTC (permalink / raw)
To: Avi Kivity
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper, Jan Kiszka,
qemu-devel@nongnu.org, Roedel, Joerg
On Mon, May 30, 2011 at 06:19:14PM +0300, Avi Kivity wrote:
> On 05/30/2011 06:15 PM, Jan Kiszka wrote:
> >On 2011-05-30 17:10, Roedel, Joerg wrote:
> >> On Mon, May 30, 2011 at 11:04:02AM -0400, Jan Kiszka wrote:
> >>> On 2011-05-30 16:38, Nadav Har'El wrote:
> >>>> On Mon, May 30, 2011, Jan Kiszka wrote about "drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...)":
> >>>>> On 2011-05-30 10:18, Roedel, Joerg wrote:
> >>>>>> On Sat, May 28, 2011 at 04:39:13AM -0400, Jan Kiszka wrote:
> >>>>>>
> >>>>>>> J�rg, how to deal with -enable-nesting in qemu-kvm to align behavior
> >>>>>>> with upstream?
> >>>>>>
> >>>>>> My personal preference is to just remove it. In upstream-qemu it is
> >>>>>> enabled/disabled by +/-svm. -enable-nesting is just a historic thing
> >>>>>> which can be wiped out.
> >>>>
> >>>> "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
> >>>> in the guest, depending on what was available in the host (because KVM now
> >>>> supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
> >>>
> >>> Why? Once nesting is stable (I think SVM already is), there is no reason
> >>> for an explicit enable. And you can always mask it out via -cpu.
> >>>
> >>> BTW, what are the defaults for SVM right now in qemu-kvm and upstream?
> >>> Enable if the modeled CPU supports it?
> >>
> >> qemu-kvm still needs -enable-nesting, otherwise it is disabled. Upstream
> >> qemu should enable it unconditionally (can be disabled with -cpu ,-svm).
> >
> >Then let's start with aligning qemu-kvm defaults to upstream? I guess
> >that's what the diff I was citing yesterday is responsible for.
> >
> >In the same run, -enable-nesting could dump a warning on the console
> >that this switch is obsolete and will be removed from future versions.
>
> I think it's safe to drop -enable-nesting immediately. Dan, does
> libvirt make use of it?
Yes, but it should be safe to drop it. Currently, if the user specifies
a CPU with the 'svm' flag present in libvirt guest XML, then we will
pass args '-cpu ....+svm -enable-nesting'. So if we drop --enable-nesting,
then libvirt will simply omit it and everything should still work because
we have still got +svm set.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-31 8:44 ` Daniel P. Berrange
@ 2011-05-31 8:58 ` Avi Kivity
2011-05-31 9:06 ` Roedel, Joerg
2011-05-31 9:15 ` Paolo Bonzini
0 siblings, 2 replies; 18+ messages in thread
From: Avi Kivity @ 2011-05-31 8:58 UTC (permalink / raw)
To: Daniel P. Berrange
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper, Jan Kiszka,
qemu-devel@nongnu.org, Roedel, Joerg
On 05/31/2011 11:44 AM, Daniel P. Berrange wrote:
> > I think it's safe to drop -enable-nesting immediately. Dan, does
> > libvirt make use of it?
>
> Yes, but it should be safe to drop it. Currently, if the user specifies
> a CPU with the 'svm' flag present in libvirt guest XML, then we will
> pass args '-cpu ....+svm -enable-nesting'. So if we drop --enable-nesting,
> then libvirt will simply omit it and everything should still work because
> we have still got +svm set.
But qemu will complain about an option it can't parse.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-31 8:58 ` Avi Kivity
@ 2011-05-31 9:06 ` Roedel, Joerg
2011-05-31 9:15 ` Paolo Bonzini
1 sibling, 0 replies; 18+ messages in thread
From: Roedel, Joerg @ 2011-05-31 9:06 UTC (permalink / raw)
To: Avi Kivity
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper, Jan Kiszka,
qemu-devel@nongnu.org
On Tue, May 31, 2011 at 04:58:16AM -0400, Avi Kivity wrote:
> On 05/31/2011 11:44 AM, Daniel P. Berrange wrote:
> > > I think it's safe to drop -enable-nesting immediately. Dan, does
> > > libvirt make use of it?
> >
> > Yes, but it should be safe to drop it. Currently, if the user specifies
> > a CPU with the 'svm' flag present in libvirt guest XML, then we will
> > pass args '-cpu ....+svm -enable-nesting'. So if we drop --enable-nesting,
> > then libvirt will simply omit it and everything should still work because
> > we have still got +svm set.
>
> But qemu will complain about an option it can't parse.
The best choice is probably to keep the option and make it a nop for the
lifetime of qemu-kvm. Optionally qemu-kvm can print a warning about the
deprecated option.
Joerg
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-31 8:58 ` Avi Kivity
2011-05-31 9:06 ` Roedel, Joerg
@ 2011-05-31 9:15 ` Paolo Bonzini
2011-05-31 9:16 ` Avi Kivity
1 sibling, 1 reply; 18+ messages in thread
From: Paolo Bonzini @ 2011-05-31 9:15 UTC (permalink / raw)
To: Avi Kivity
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper, Jan Kiszka,
qemu-devel@nongnu.org, Roedel, Joerg
On 05/31/2011 10:58 AM, Avi Kivity wrote:
>
> But qemu will complain about an option it can't parse.
The presence of -enable-nesting is inferred from the help text.
Paolo
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-31 9:15 ` Paolo Bonzini
@ 2011-05-31 9:16 ` Avi Kivity
0 siblings, 0 replies; 18+ messages in thread
From: Avi Kivity @ 2011-05-31 9:16 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Anthony Liguori, Nadav Har'El, kvm, john cooper, Jan Kiszka,
qemu-devel@nongnu.org, Roedel, Joerg
On 05/31/2011 12:15 PM, Paolo Bonzini wrote:
> On 05/31/2011 10:58 AM, Avi Kivity wrote:
>>
>> But qemu will complain about an option it can't parse.
>
> The presence of -enable-nesting is inferred from the help text.
Okay, so it can be safely dropped.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:04 ` [Qemu-devel] drop -enable-nesting Jan Kiszka
2011-05-30 15:10 ` Roedel, Joerg
@ 2011-05-30 15:16 ` Nadav Har'El
2011-05-30 15:59 ` Jan Kiszka
1 sibling, 1 reply; 18+ messages in thread
From: Nadav Har'El @ 2011-05-30 15:16 UTC (permalink / raw)
To: Jan Kiszka
Cc: john cooper, Roedel, Joerg, Anthony Liguori,
qemu-devel@nongnu.org, kvm
On Mon, May 30, 2011, Jan Kiszka wrote about "Re: drop -enable-nesting":
> > "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
> > in the guest, depending on what was available in the host (because KVM now
> > supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
>
> Why? Once nesting is stable (I think SVM already is), there is no reason
> for an explicit enable. And you can always mask it out via -cpu.
As far as I understand (and this was previously discussed on the QEMU mailing
list), the default emulated CPU does not include the "vmx" capability, and you
need to enable it with something like "-cpu qemu64,+vmx" (or "-cpu host").
I am not sure if it does enable the "svm" capability. If it does, it isn't
useful when KVM is enabled and the underlying host has VMX, not SVM.
Nadav.
--
Nadav Har'El | Monday, May 30 2011, 27 Iyyar 5771
nyh@math.technion.ac.il |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |Why do we drive on a parkway and park on
http://nadav.harel.org.il |a driveway?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] drop -enable-nesting
2011-05-30 15:16 ` Nadav Har'El
@ 2011-05-30 15:59 ` Jan Kiszka
0 siblings, 0 replies; 18+ messages in thread
From: Jan Kiszka @ 2011-05-30 15:59 UTC (permalink / raw)
To: Nadav Har'El
Cc: john cooper, Roedel, Joerg, Anthony Liguori,
qemu-devel@nongnu.org, kvm
On 2011-05-30 17:16, Nadav Har'El wrote:
> On Mon, May 30, 2011, Jan Kiszka wrote about "Re: drop -enable-nesting":
>>> "-enable-nesting" could remain as a synonym for enabling either VMX or SVM
>>> in the guest, depending on what was available in the host (because KVM now
>>> supports both nested SVM and nested VMX, but not SVM-on-VMX or vice versa).
>>
>> Why? Once nesting is stable (I think SVM already is), there is no reason
>> for an explicit enable. And you can always mask it out via -cpu.
>
> As far as I understand (and this was previously discussed on the QEMU mailing
> list), the default emulated CPU does not include the "vmx" capability, and you
> need to enable it with something like "-cpu qemu64,+vmx" (or "-cpu host").
qemu64 is an artificial AMD model. Adding VMX to it may have interesting
effects on the guests. Better use host or a recent Intel model.
>
> I am not sure if it does enable the "svm" capability. If it does, it isn't
> useful when KVM is enabled and the underlying host has VMX, not SVM.
That's what KVM is supposed to filter based on the host's capabilities.
I bet it does already.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2011-05-31 9:16 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-23 21:46 [Qemu-devel] [PATCH 3/7] cpu model bug fixes and definition corrections: Add kvm emulated x2apic flag to config defined cpu models john cooper
2011-05-28 8:39 ` Jan Kiszka
2011-05-30 8:18 ` Roedel, Joerg
2011-05-30 14:04 ` [Qemu-devel] drop -enable-nesting (was: [PATCH 3/7] cpu model bug fixes and definition corrections...) Jan Kiszka
2011-05-30 14:38 ` Nadav Har'El
2011-05-30 15:04 ` [Qemu-devel] drop -enable-nesting Jan Kiszka
2011-05-30 15:10 ` Roedel, Joerg
2011-05-30 15:15 ` Jan Kiszka
2011-05-30 15:19 ` Avi Kivity
2011-05-30 15:27 ` Jan Kiszka
2011-05-30 15:42 ` Jan Kiszka
2011-05-31 8:44 ` Daniel P. Berrange
2011-05-31 8:58 ` Avi Kivity
2011-05-31 9:06 ` Roedel, Joerg
2011-05-31 9:15 ` Paolo Bonzini
2011-05-31 9:16 ` Avi Kivity
2011-05-30 15:16 ` Nadav Har'El
2011-05-30 15:59 ` Jan Kiszka
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).