xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] svm: Do not intercept RDTCS(P) when TSC scaling is supported by hardware
@ 2012-04-20  2:21 Boris Ostrovsky
  2012-04-20  3:57 ` Huang2, Wei
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Boris Ostrovsky @ 2012-04-20  2:21 UTC (permalink / raw)
  To: JBeulich, keir; +Cc: boris.ostrovsky, wei.huang2, xen-devel

# HG changeset patch
# User Boris Ostrovsky <boris.ostrovsky@amd.com>
# Date 1334875170 14400
# Node ID 55bf11ebce87ceb73fb2c372dcef170ec0bb4a18
# Parent  7c777cb8f705411b77c551f34ba88bdc09e38ab8
svm: Do not intercept RDTCS(P) when TSC scaling is supported by hardware

When running in TSC_MODE_ALWAYS_EMULATE mode on processors that support
TSC scaling we don't need to intercept RDTSC/RDTSCP instructions.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
Tested-by: Wei Huang <wei.huang2@amd.com>

diff -r 7c777cb8f705 -r 55bf11ebce87 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Wed Apr 18 16:49:55 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 19 18:39:30 2012 -0400
@@ -724,12 +724,18 @@ static void svm_set_rdtsc_exiting(struct
 {
     struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
     u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
+    u32 general2_intercepts = vmcb_get_general2_intercepts(vmcb);
 
     general1_intercepts &= ~GENERAL1_INTERCEPT_RDTSC;
-    if ( enable )
+    general2_intercepts &= ~GENERAL2_INTERCEPT_RDTSCP;
+
+    if ( enable && !cpu_has_tsc_ratio ) {
         general1_intercepts |= GENERAL1_INTERCEPT_RDTSC;
+        general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP;
+    }
 
     vmcb_set_general1_intercepts(vmcb, general1_intercepts);
+    vmcb_set_general2_intercepts(vmcb, general2_intercepts);
 }
 
 static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf)

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

end of thread, other threads:[~2012-04-25 20:07 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-20  2:21 [PATCH] svm: Do not intercept RDTCS(P) when TSC scaling is supported by hardware Boris Ostrovsky
2012-04-20  3:57 ` Huang2, Wei
2012-04-20  8:05 ` Keir Fraser
2012-04-20  8:14   ` Keir Fraser
2012-04-20 15:06     ` Huang2, Wei
2012-04-20 16:56       ` Keir Fraser
2012-04-20 15:02   ` Dan Magenheimer
2012-04-20 16:20     ` Wei Huang
2012-04-20 17:25       ` Dan Magenheimer
2012-04-20  8:15 ` Jan Beulich
2012-04-20  8:45   ` Keir Fraser
2012-04-20 15:27     ` Boris Ostrovsky
2012-04-25  9:27 ` Jan Beulich
2012-04-25 15:01   ` Dan Magenheimer
2012-04-25 15:51     ` Jan Beulich
2012-04-25 16:05       ` Dan Magenheimer
2012-04-25 16:04         ` Wei Huang
2012-04-25 17:14           ` Keir Fraser
2012-04-25 20:07             ` Boris Ostrovsky

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