本文将记录Time-Stamp Counter Virtualization相关内容。

Usage

The product means the result obtained by multiplying two or more quantities together.

TSC offsetting

Timestamp-counter offsetting (TSC offsetting) is an existing feature that allows VMM software to specify a value (the TSC offset) that is added to the TSC when it is read by guest software. A VMM can use this feature to provide guest software with the illusion that it is operating at a time later or earlier than that represented by the current TSC value.

TSC scaling

With TSC offsetting, guest software perceives a TSC that is offset from the real hardware, but which advances at the same rate. That may be adequate for usages in which the offset is used to account for execution time before virtual machine was created. But it might not suffice if the VMM migrates a virtual machine between platforms on which the TSC moves at different rates.

TSC scaling provides VMM software with a mechanism by which is it can adjust the TSC rate perceived by guest software. When TSC scaling and TSC offsetting are both enabled, reads from the TSC in VMX nonroot operation multiply the actual TSC value by a new TSC multiplier, add the TSC offset to the product, and return the sum to guest software.

With both TSC offsetting and TSC scaling, a VMM that migrates a virtual machine from one platform to another can configure the TSC offset and the TSC multiplier on the new platform so that the TSC (as perceived by the guest) appears to proceed from the same value that it had before the migration and at the same rate.


参考资料:

  1. Timestamp-Counter Scaling (TSC scaling) for Virtualization