Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329915
b: refs/heads/master
c: 879238f
h: refs/heads/master
i:
  329913: a8bad53
  329911: fcf2269
v: v3
  • Loading branch information
Stefan Fritsch authored and Marcelo Tosatti committed Sep 17, 2012
1 parent f6daa47 commit 18b2734
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9fc77441e5e1bf80b794cc546d2243ee9f4afb75
refs/heads/master: 879238fecc051d95037ae76332916209a7770709
32 changes: 20 additions & 12 deletions trunk/Documentation/virtual/kvm/msr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ MSR_KVM_WALL_CLOCK_NEW: 0x4b564d00
time information and check that they are both equal and even.
An odd version indicates an in-progress update.

sec: number of seconds for wallclock.
sec: number of seconds for wallclock at time of boot.

nsec: number of nanoseconds for wallclock.
nsec: number of nanoseconds for wallclock at time of boot.

In order to get the current wallclock time, the system_time from
MSR_KVM_SYSTEM_TIME_NEW needs to be added.

Note that although MSRs are per-CPU entities, the effect of this
particular MSR is global.
Expand Down Expand Up @@ -82,20 +85,25 @@ MSR_KVM_SYSTEM_TIME_NEW: 0x4b564d01
time at the time this structure was last updated. Unit is
nanoseconds.

tsc_to_system_mul: a function of the tsc frequency. One has
to multiply any tsc-related quantity by this value to get
a value in nanoseconds, besides dividing by 2^tsc_shift
tsc_to_system_mul: multiplier to be used when converting
tsc-related quantity to nanoseconds

tsc_shift: cycle to nanosecond divider, as a power of two, to
allow for shift rights. One has to shift right any tsc-related
quantity by this value to get a value in nanoseconds, besides
multiplying by tsc_to_system_mul.
tsc_shift: shift to be used when converting tsc-related
quantity to nanoseconds. This shift will ensure that
multiplication with tsc_to_system_mul does not overflow.
A positive value denotes a left shift, a negative value
a right shift.

With this information, guests can derive per-CPU time by
doing:
The conversion from tsc to nanoseconds involves an additional
right shift by 32 bits. With this information, guests can
derive per-CPU time by doing:

time = (current_tsc - tsc_timestamp)
time = (time * tsc_to_system_mul) >> tsc_shift
if (tsc_shift >= 0)
time <<= tsc_shift;
else
time >>= -tsc_shift;
time = (time * tsc_to_system_mul) >> 32
time = time + system_time

flags: bits in this field indicate extended capabilities
Expand Down

0 comments on commit 18b2734

Please sign in to comment.