Skip to contentSkip to conversation

i386: Disable TOPOEXT by default on "-cpu host"

PATCH In review Eduardo Habkost 3 participants 3 messages Aug 9, 2018 – Aug 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386: Disable TOPOEXT by default on "-cpu host"

Enabling TOPOEXT is always allowed, but it can't be enabled blindly by "-cpu host" because it may make guests crash if the rest of the cache topology information isn't provided or isn't consistent.

This addresses the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=1613277

---
 target/i386/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)
target/i386/cpu.c +6 -0
index 723e02221e..3ac627978f 100644
@@ -849,6 +849,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid_eax = 0x80000001, .cpuid_reg = R_ECX,
         .tcg_features = TCG_EXT3_FEATURES,
+        /*
+         * TOPOEXT is always allowed but can't be enabled blindly by
+         * "-cpu host", as it requires consistent cache topology info
+         * to be provided so it doesn't confuse guests.
+         */
+        .no_autoenable_flags = CPUID_EXT3_TOPOEXT,
     },
     [FEAT_C000_0001_EDX] = {
         .feat_names = {
Signature · 1 line
2.18.0.rc1.1.g3f1ff2140
Tested-by on v1 1/1
#1 lore raw
Quoted 20 lines · Eduardo Habkost

Enabling TOPOEXT is always allowed, but it can't be enabled blindly by "-cpu host" because it may make guests crash if the rest of the cache topology information isn't provided or isn't consistent.

This addresses the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=1613277

---
 target/i386/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)
target/i386/cpu.c +0 -0
index 723e02221e..3ac627978f 100644
@@ -849,6 +849,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid_eax = 0x80000001, .cpuid_reg = R_ECX,

target/i386/cpu.c static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { · line 860

Quoted 10 lines
target/i386/cpu.c +6 -0
         .tcg_features = TCG_EXT3_FEATURES,
+        /*
+         * TOPOEXT is always allowed but can't be enabled blindly by
+         * "-cpu host", as it requires consistent cache topology info
+         * to be provided so it doesn't confuse guests.
+         */
+        .no_autoenable_flags = CPUID_EXT3_TOPOEXT,
     },
     [FEAT_C000_0001_EDX] = {
         .feat_names = {

Can confirm that this fixes the problem observed on the original AMD Phenom machine, using qemu from git (@6ad908053) + your patch. Therefore:

Thanks,

Rich.

Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
Reviewed-by
#2 lore raw

Looks good. Did some basic testing.

Quoted 59 lines

-----Original Message-----
From: Richard W.M. Jones <[email protected]>
Sent: Friday, August 10, 2018 2:41 AM
To: Eduardo Habkost <[email protected]>
Cc: [email protected]; Paolo Bonzini <[email protected]>; Richard Henderson <[email protected]>; Moger, Babu <[email protected]>
Subject: Re: [PATCH] i386: Disable TOPOEXT by default on "-cpu host"

target/i386/cpu.c static FeatureWordInfo

Quoted 18 lines · Eduardo Habkost

Enabling TOPOEXT is always allowed, but it can't be enabled blindly by "-cpu host" because it may make guests crash if the rest of the cache topology information isn't provided or isn't consistent.

This addresses the bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=1613277

---
 target/i386/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)
target/i386/cpu.c +0 -0
index 723e02221e..3ac627978f 100644
@@ -849,6 +849,12 @@ static FeatureWordInfo

feature_word_info[FEATURE_WORDS] = {

target/i386/cpu.c static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { · line 860

Quoted 12 lines
target/i386/cpu.c +6 -0
         },
         .cpuid_eax = 0x80000001, .cpuid_reg = R_ECX,
         .tcg_features = TCG_EXT3_FEATURES,
+        /*
+         * TOPOEXT is always allowed but can't be enabled blindly by
+         * "-cpu host", as it requires consistent cache topology info
+         * to be provided so it doesn't confuse guests.
+         */
+        .no_autoenable_flags = CPUID_EXT3_TOPOEXT,
     },
     [FEAT_C000_0001_EDX] = {
         .feat_names = {

Can confirm that this fixes the problem observed on the original AMD Phenom machine, using qemu from git (@6ad908053) + your patch. Therefore:

Thanks,

Rich.

--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v