[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86 hvm: Change default setting of guest CPUID RDTSCP bit



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1263371614 0
# Node ID 13d4e78ede977ee92c4a4adf78a92b31ec52c00e
# Parent  6512068aa0db7747df4f180b03d269afb7da5bb0
x86 hvm: Change default setting of guest CPUID RDTSCP bit

Expose RDTSCP CPUID to guest only when tsc_mode == TSC_MODE_DEFAULT
and host_tsc_is_safe() returns 1.

Signed-off-by: Dongxiao Xu <dongxiao.xu@xxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c     |    6 ++++--
 xen/arch/x86/time.c        |    2 +-
 xen/include/asm-x86/time.h |    1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff -r 6512068aa0db -r 13d4e78ede97 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Wed Jan 13 08:18:38 2010 +0000
+++ b/xen/arch/x86/hvm/hvm.c    Wed Jan 13 08:33:34 2010 +0000
@@ -1955,8 +1955,10 @@ void hvm_cpuid(unsigned int input, unsig
         }
         break;
     case 0x80000001:
-        /* Don't expose RDTSCP feature when in PVRDTSCP mode. */
-        if ( v->domain->arch.tsc_mode == TSC_MODE_PVRDTSCP )
+        /* We expose RDTSCP feature to guest only when
+           tsc_mode == TSC_MODE_DEFAULT and host_tsc_is_safe() returns 1 */
+        if ( v->domain->arch.tsc_mode != TSC_MODE_DEFAULT ||
+             !host_tsc_is_safe() )
             *edx &= ~bitmaskof(X86_FEATURE_RDTSCP);
         break;
     }
diff -r 6512068aa0db -r 13d4e78ede97 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Wed Jan 13 08:18:38 2010 +0000
+++ b/xen/arch/x86/time.c       Wed Jan 13 08:33:34 2010 +0000
@@ -1628,7 +1628,7 @@ void pv_soft_rdtsc(struct vcpu *v, struc
              (d->arch.tsc_mode == TSC_MODE_PVRDTSCP) ? d->arch.incarnation : 0;
 }
 
-static int host_tsc_is_safe(void)
+int host_tsc_is_safe(void)
 {
     if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
         return 1;
diff -r 6512068aa0db -r 13d4e78ede97 xen/include/asm-x86/time.h
--- a/xen/include/asm-x86/time.h        Wed Jan 13 08:18:38 2010 +0000
+++ b/xen/include/asm-x86/time.h        Wed Jan 13 08:33:34 2010 +0000
@@ -70,6 +70,7 @@ void tsc_get_info(struct domain *d, uint
 
 void force_update_vcpu_system_time(struct vcpu *v);
 
+int host_tsc_is_safe(void);
 void cpuid_time_leaf(uint32_t sub_idx, unsigned int *eax, unsigned int *ebx,
                       unsigned int *ecx, unsigned int *edx);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.