On Sun, Feb 13, 2011 at 10:19:19AM -0500, Avi Kivity wrote:
On 02/09/2011 07:29 PM, Joerg Roedel wrote:Yes, it is a real multiplier. But writes to the TSC-MSR will change the
Hi Avi, Marcelo,Questions:
here is the patch-set to implement the TSC-scaling feature of upcoming
AMD CPUs. When this feature is supported the CPU provides a new MSR
which holds a multiplier for the hardware TSC which is applied on the
value rdtsc[p] and reads of MSR 0x10. This feature can be used to
emulate a given tsc frequency for the guest.
Patch 1 is not directly related to this patch-set because it only fixes
a bug which prevented me from testing these patches. In fact it fixes
the same bug Andre sent a patch for. But after the discussion about his
patch he told me to just post my patch and thus here it is.
- the tsc multiplier really is a multiplier, right? Not an addend that
is added every cycle.
unscaled TSC value.
SoRight. And if you exchange the two wrmsr calls it will still give you
wrmsr(TSC, 1e9)
wrmsr(TSC_MULT, 2.0000)
t = rdtsc()
will return about 2e9, not 1e9 + 2*(time to execute the code snippet) ?
the same result.
- what's the cost of wrmsr(TSC_MULT)?Hard to tell by now because I only have numbers for pre-production
hardware.
There are really two ways to implement this feature. One is fullyThe motivation here is mostly the flexibility. Scale the TSC for the
generic, like you did. The other is to implement it at the host level -
have a sysfs file and/or kernel parameter for the desired tsc frequency,
write it once, and forget about it. Trust management to set the host
tsc frequency to the same value on all hosts in a migration cluster.
whole migration cluster only makes sense if all hosts there support the
feature. But the most likely scenario is that existing migration
clusters will be extended by new machines and guests will be migrated
there. And these guests should be able to see the same TSC frequency on
the new host as the had on the old one. The older machines in the
cluster may even have different TSC frequencys. With this flexible
implementation those scenarios are possible. A host-wide setting for the
scaling will make the feature useless in those (common) scenarios.