Enable bit 15 (USE_PLATFORM_CLOCK) of FADT flags field so that older Windows guests do not make use of the TSC for timestamping.
From the ACPI manual:
"A value of one indicates that OSPM should use a platform provided timer to drive any monotonically non-decreasing counters, such as OSPM performance counter services. Which particular platform timer will be used is OSPM specific, however, it is recommended that the timer used is based on the following algorithm: If the HPET is exposed to OSPM, OSPM should use the HPET. Otherwise, OSPM will use the ACPI power management timer. A value of one indicates that the platform is known to have a correctly implemented ACPI power management timer."
Problems using the TSC include:
1) Migration to a host with different frequency. 2) Unsynchronized TSCs in SMP hosts (KVM does not guarantee synchronization). 3) Processors which do not increment TSC on low power states.
Signed-off-by: Marcelo Tosatti mtosatti@redhat.com
diff --git a/src/acpi.c b/src/acpi.c index 0559443..fd5c7ea 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -336,8 +336,9 @@ build_fadt(int bdf) fadt->plvl3_lat = cpu_to_le16(0xfff); // C3 state not supported fadt->gpe0_blk = cpu_to_le32(0xafe0); fadt->gpe0_blk_len = 4; - /* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC */ - fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6)); + /* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC + USE_PLATFORM_CLOCK */ + fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6) | + (1 << 15));
build_header((void*)fadt, FACP_SIGNATURE, sizeof(*fadt), 1);
On Tue, Jul 17, 2012 at 02:18:00PM -0300, Marcelo Tosatti wrote:
Enable bit 15 (USE_PLATFORM_CLOCK) of FADT flags field so that older Windows guests do not make use of the TSC for timestamping.
From the ACPI manual:
"A value of one indicates that OSPM should use a platform provided timer to drive any monotonically non-decreasing counters, such as OSPM performance counter services. Which particular platform timer will be used is OSPM specific, however, it is recommended that the timer used is based on the following algorithm: If the HPET is exposed to OSPM, OSPM should use the HPET. Otherwise, OSPM will use the ACPI power management timer. A value of one indicates that the platform is known to have a correctly implemented ACPI power management timer."
Problems using the TSC include:
- Migration to a host with different frequency.
- Unsynchronized TSCs in SMP hosts (KVM does not guarantee
synchronization). 3) Processors which do not increment TSC on low power states.
Signed-off-by: Marcelo Tosatti mtosatti@redhat.com
Looks good to me.
diff --git a/src/acpi.c b/src/acpi.c index 0559443..fd5c7ea 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -336,8 +336,9 @@ build_fadt(int bdf) fadt->plvl3_lat = cpu_to_le16(0xfff); // C3 state not supported fadt->gpe0_blk = cpu_to_le32(0xafe0); fadt->gpe0_blk_len = 4;
- /* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC */
- fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6));
/* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC + USE_PLATFORM_CLOCK */
fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6) |
(1 << 15));
build_header((void*)fadt, FACP_SIGNATURE, sizeof(*fadt), 1);
-- Gleb.
On Tue, Jul 17, 2012 at 02:18:00PM -0300, Marcelo Tosatti wrote:
Enable bit 15 (USE_PLATFORM_CLOCK) of FADT flags field so that older Windows guests do not make use of the TSC for timestamping.
I fixed up and committed this patch. But after I committed it, I realized it reverted Gleb's "Drop FIX_RTC flag from FADT" patch (c7be281b). Gleb, if you can you confirm c7be281b is still valid I'll put it back in.
-Kevin
On Thu, Jul 19, 2012 at 08:44:07PM -0400, Kevin O'Connor wrote:
On Tue, Jul 17, 2012 at 02:18:00PM -0300, Marcelo Tosatti wrote:
Enable bit 15 (USE_PLATFORM_CLOCK) of FADT flags field so that older Windows guests do not make use of the TSC for timestamping.
I fixed up and committed this patch. But after I committed it, I realized it reverted Gleb's "Drop FIX_RTC flag from FADT" patch (c7be281b). Gleb, if you can you confirm c7be281b is still valid I'll put it back in.
It also reverts 20fcf9b. They are both still valid. Marcelo what source tree the patch was against?
-- Gleb.
On Fri, Jul 20, 2012 at 07:49:03AM +0300, Gleb Natapov wrote:
On Thu, Jul 19, 2012 at 08:44:07PM -0400, Kevin O'Connor wrote:
On Tue, Jul 17, 2012 at 02:18:00PM -0300, Marcelo Tosatti wrote:
Enable bit 15 (USE_PLATFORM_CLOCK) of FADT flags field so that older Windows guests do not make use of the TSC for timestamping.
I fixed up and committed this patch. But after I committed it, I realized it reverted Gleb's "Drop FIX_RTC flag from FADT" patch (c7be281b). Gleb, if you can you confirm c7be281b is still valid I'll put it back in.
It also reverts 20fcf9b.
20fcf9b = addition of RTC_S4 (bit 7).
The patch i sent to add bit 15 does not touch that:
- /* WBINVD + PROC_C1 + SLP_BUTTON + RTC_S4 */ - fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 7)); + /* WBINVD + PROC_C1 + SLP_BUTTON + RTC_S4 + USE_PLATFORM_CLOCK */ + fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 7) | + (1 << 15));
They are both still valid. Marcelo what source tree the patch was against?
commit 12c991e1da182a0e6e2028f130ded512102c8842 Author: Ian Campbell ian.campbell@citrix.com Date: Thu Jun 28 11:08:33 2012 +0100
On Fri, Jul 20, 2012 at 07:24:27AM -0300, Marcelo Tosatti wrote:
On Fri, Jul 20, 2012 at 07:49:03AM +0300, Gleb Natapov wrote:
On Thu, Jul 19, 2012 at 08:44:07PM -0400, Kevin O'Connor wrote:
On Tue, Jul 17, 2012 at 02:18:00PM -0300, Marcelo Tosatti wrote:
Enable bit 15 (USE_PLATFORM_CLOCK) of FADT flags field so that older Windows guests do not make use of the TSC for timestamping.
I fixed up and committed this patch. But after I committed it, I realized it reverted Gleb's "Drop FIX_RTC flag from FADT" patch (c7be281b). Gleb, if you can you confirm c7be281b is still valid I'll put it back in.
It also reverts 20fcf9b.
20fcf9b = addition of RTC_S4 (bit 7).
The patch i sent to add bit 15 does not touch that:
- /* WBINVD + PROC_C1 + SLP_BUTTON + RTC_S4 */
- fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 7));
- /* WBINVD + PROC_C1 + SLP_BUTTON + RTC_S4 + USE_PLATFORM_CLOCK */
- fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 7) |
(1 << 15));
Actually the patch is: - /* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC */ - fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6)); + /* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC + USE_PLATFORM_CLOCK */ + fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6) | + (1 << 15));
Somehow (1 << 7) became (1 << 6).
-- Gleb.