diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-11-25 14:05:28 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-11-25 14:05:28 +0000 |
commit | 08a0b4ab0d193b8fbb9270b7ab26f527535ba69c (patch) | |
tree | cdef74bb4aeb86dfa80bcac7637500b547780731 /xen/include/asm-x86/msr.h | |
parent | 83371c34bc5a2eed015a5d034cd82ec243659d85 (diff) | |
download | xen-08a0b4ab0d193b8fbb9270b7ab26f527535ba69c.tar.gz xen-08a0b4ab0d193b8fbb9270b7ab26f527535ba69c.tar.bz2 xen-08a0b4ab0d193b8fbb9270b7ab26f527535ba69c.zip |
Replace tsc_native config option with tsc_mode config option
(NOTE: pvrdtscp mode not finished yet, but all other
modes have been tested so sooner seemed better than
later to submit this fairly major patch so we can get
more mileage on it before next release.)
New tsc_mode config option supercedes tsc_native and
offers a more intelligent default and an additional
option for intelligent apps running on PV domains
("pvrdtscp").
For PV domains, default mode will determine if the initial
host has a "safe"** TSC (meaning it is always synchronized
across all physical CPUs). If so, all domains will
execute all rdtsc instructions natively; if not,
all domains will emulate all rdtsc instructions but
providing the TSC hertz rate of the initial machine.
After being restored or live-migrated, all PV domains will
emulate all rdtsc instructions. Hence, this default mode
guarantees correctness while providing native performance
in most conditions.
For PV domains, tsc_mode==1 will always emulate rdtsc
and tsc_mode==2 will never emulate rdtsc. For tsc_mode==3,
rdtsc will never be emulated, but information is provided
through pvcpuid instructions and rdtscp instructions
so that an app can obtain "safe" pvclock-like TSC information
across save/restore and live migration. (Will be completed in
a follow-on patch.)
For HVM domains, the default mode and "always emulate"
mode do the same as tsc_native==0; the other two modes
do the same as tsc_native==1. (HVM domains since 3.4
have implemented a tsc_mode=default-like functionality,
but also can preserve native TSC across save/restore
and live-migration IFF the initial and target machines
have a common TSC cycle rate.)
** All newer AMD machines, and Nehalem and future Intel
machines have "Invariant TSC"; many newer Intel machines
have "Constant TSC" and do not support deep-C sleep states;
these and all single-processor machines are "safe".
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Diffstat (limited to 'xen/include/asm-x86/msr.h')
-rw-r--r-- | xen/include/asm-x86/msr.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h index 56bb080f52..a65f080569 100644 --- a/xen/include/asm-x86/msr.h +++ b/xen/include/asm-x86/msr.h @@ -84,6 +84,8 @@ static inline void wrmsrl(unsigned int msr, __u64 val) #define write_tsc(val) wrmsrl(MSR_IA32_TSC, val) +#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0) + #define rdpmc(counter,low,high) \ __asm__ __volatile__("rdpmc" \ : "=a" (low), "=d" (high) \ |