qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [QEMU PATCH] target-i386: Disable rdtscp on Opteron_G* CPU models
@ 2015-11-13 19:07 Eduardo Habkost
  2015-11-16  9:44 ` Paolo Bonzini
  2015-11-17 14:42 ` Eduardo Habkost
  0 siblings, 2 replies; 4+ messages in thread
From: Eduardo Habkost @ 2015-11-13 19:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Paolo Bonzini, Richard Henderson

KVM can't virtualize rdtscp on AMD CPUs yet, so there's no point
in enabling it by default on AMD CPU models, as all we are
getting are confused users because of the "host doesn't support
requested feature" warnings.

Disable rdtscp on Opteron_G* models, but keep compatibility on
pc-*-2.4 and older (just in case there are people are doing funny
stuff using AMD CPU models on Intel hosts).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/i386/pc.h | 17 +++++++++++++++++
 target-i386/cpu.c    | 12 ++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 4bbc0ff..854c330 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -347,8 +347,25 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = "qemu32" "-" TYPE_X86_CPU,\
             .property = "popcnt",\
             .value    = "on",\
+        },{\
+            .driver   = "Opteron_G2" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
+        },{\
+            .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
+        },{\
+            .driver   = "Opteron_G4" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
+        },{\
+            .driver   = "Opteron_G5" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
         },
 
+
 #define PC_COMPAT_2_3 \
         PC_COMPAT_2_4 \
         HW_COMPAT_2_3 \
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index e5f1c5b..11e5e39 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1244,8 +1244,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_DE | CPUID_FP87,
         .features[FEAT_1_ECX] =
             CPUID_EXT_CX16 | CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_FXSR |
+            CPUID_EXT2_LM | CPUID_EXT2_FXSR |
             CPUID_EXT2_MMX | CPUID_EXT2_NX | CPUID_EXT2_PSE36 |
             CPUID_EXT2_PAT | CPUID_EXT2_CMOV | CPUID_EXT2_MCA |
             CPUID_EXT2_PGE | CPUID_EXT2_MTRR | CPUID_EXT2_SYSCALL |
@@ -1273,8 +1274,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .features[FEAT_1_ECX] =
             CPUID_EXT_POPCNT | CPUID_EXT_CX16 | CPUID_EXT_MONITOR |
             CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_FXSR |
+            CPUID_EXT2_LM | CPUID_EXT2_FXSR |
             CPUID_EXT2_MMX | CPUID_EXT2_NX | CPUID_EXT2_PSE36 |
             CPUID_EXT2_PAT | CPUID_EXT2_CMOV | CPUID_EXT2_MCA |
             CPUID_EXT2_PGE | CPUID_EXT2_MTRR | CPUID_EXT2_SYSCALL |
@@ -1305,8 +1307,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT_POPCNT | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
             CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ |
             CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP |
+            CPUID_EXT2_LM |
             CPUID_EXT2_PDPE1GB | CPUID_EXT2_FXSR | CPUID_EXT2_MMX |
             CPUID_EXT2_NX | CPUID_EXT2_PSE36 | CPUID_EXT2_PAT |
             CPUID_EXT2_CMOV | CPUID_EXT2_MCA | CPUID_EXT2_PGE |
@@ -1340,8 +1343,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT_AES | CPUID_EXT_POPCNT | CPUID_EXT_SSE42 |
             CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_FMA |
             CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP |
+            CPUID_EXT2_LM |
             CPUID_EXT2_PDPE1GB | CPUID_EXT2_FXSR | CPUID_EXT2_MMX |
             CPUID_EXT2_NX | CPUID_EXT2_PSE36 | CPUID_EXT2_PAT |
             CPUID_EXT2_CMOV | CPUID_EXT2_MCA | CPUID_EXT2_PGE |
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [QEMU PATCH] target-i386: Disable rdtscp on Opteron_G* CPU models
  2015-11-13 19:07 [Qemu-devel] [QEMU PATCH] target-i386: Disable rdtscp on Opteron_G* CPU models Eduardo Habkost
@ 2015-11-16  9:44 ` Paolo Bonzini
  2015-11-16 13:19   ` Eduardo Habkost
  2015-11-17 14:42 ` Eduardo Habkost
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2015-11-16  9:44 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: libvir-list, Richard Henderson



On 13/11/2015 20:07, Eduardo Habkost wrote:
> KVM can't virtualize rdtscp on AMD CPUs yet, so there's no point
> in enabling it by default on AMD CPU models, as all we are
> getting are confused users because of the "host doesn't support
> requested feature" warnings.
> 
> Disable rdtscp on Opteron_G* models, but keep compatibility on
> pc-*-2.4 and older (just in case there are people are doing funny
> stuff using AMD CPU models on Intel hosts).
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Can we do it only on KVM and not on TCG?

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [QEMU PATCH] target-i386: Disable rdtscp on Opteron_G* CPU models
  2015-11-16  9:44 ` Paolo Bonzini
@ 2015-11-16 13:19   ` Eduardo Habkost
  0 siblings, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2015-11-16 13:19 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: libvir-list, qemu-devel, Richard Henderson

On Mon, Nov 16, 2015 at 10:44:59AM +0100, Paolo Bonzini wrote:
> 
> 
> On 13/11/2015 20:07, Eduardo Habkost wrote:
> > KVM can't virtualize rdtscp on AMD CPUs yet, so there's no point
> > in enabling it by default on AMD CPU models, as all we are
> > getting are confused users because of the "host doesn't support
> > requested feature" warnings.
> > 
> > Disable rdtscp on Opteron_G* models, but keep compatibility on
> > pc-*-2.4 and older (just in case there are people are doing funny
> > stuff using AMD CPU models on Intel hosts).
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> 
> Can we do it only on KVM and not on TCG?

We can, but I would like to avoid it, if possible. It would
require more complex compat code (the "Add optional class name to
kvm_default_props¨ patch I sent some time ago), and people who
need rdtscp will be able to use Opteron_G*-rdtscp soon.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [QEMU PATCH] target-i386: Disable rdtscp on Opteron_G* CPU models
  2015-11-13 19:07 [Qemu-devel] [QEMU PATCH] target-i386: Disable rdtscp on Opteron_G* CPU models Eduardo Habkost
  2015-11-16  9:44 ` Paolo Bonzini
@ 2015-11-17 14:42 ` Eduardo Habkost
  1 sibling, 0 replies; 4+ messages in thread
From: Eduardo Habkost @ 2015-11-17 14:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: libvir-list, Paolo Bonzini, Richard Henderson

On Fri, Nov 13, 2015 at 05:07:13PM -0200, Eduardo Habkost wrote:
> KVM can't virtualize rdtscp on AMD CPUs yet, so there's no point
> in enabling it by default on AMD CPU models, as all we are
> getting are confused users because of the "host doesn't support
> requested feature" warnings.
> 
> Disable rdtscp on Opteron_G* models, but keep compatibility on
> pc-*-2.4 and older (just in case there are people are doing funny
> stuff using AMD CPU models on Intel hosts).
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Applied to x86 tree.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-17 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-13 19:07 [Qemu-devel] [QEMU PATCH] target-i386: Disable rdtscp on Opteron_G* CPU models Eduardo Habkost
2015-11-16  9:44 ` Paolo Bonzini
2015-11-16 13:19   ` Eduardo Habkost
2015-11-17 14:42 ` Eduardo Habkost

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).