Windows 8 RTC Bug analyzed and fixed!
Category : Articles
Published by Christian Ney on 22.08.13
As soon as the Windows 8 RTC issue appeared, we started our own investigation and found out, that only Intel setups were affected. But still there were quite a few questions unanswered like for example: which timer is Windows 8 actually using, are there really no issues on AMD and why is the issue fixed, when you move to an Intel when you installed Windows 8 using an AMD platform? Credit also goes to Franck D. from CPUID, who was kind enough to provide us with a tool to read out different timers and their frequency.



 Article in English  Artikel in Deutsch  Article en français  Articolo in italiano




Background information

ACPI Timer: Also known as PM Timer is an external hardware timer that has a fixed frequency of 3.579545 MHz.

HPET Timer: HPET stands for High Precision Event Timer, it is an external hardware timer that has a fixed frequency of 14.31818 MHz

RTC Timer: RTC stands for Real-Time Clock. It is a software timer that reads an hardware timer to count. It is being used by Windows and most softwares as the reference clock to measure time.

TSC Timer: TSC stands for TimeStampCounter. It is an hardware based timer that has a variable frequency. Its frequency was equal to the processor's frequency and that was a problem as it would be affected by spread-spectrum and power management features lowering the processor's clock speed implemented on newer processors. This was eventually solved in later processor designs by making the TSC clock independent of the processor frequency.

QPC Timer: or QueryPerformanceCounter is a native Windows API that access a high resolution timer and is used to calculate elapsed time. In other words a software timer that reads an hardware timer too. It was originally designed to use the TSC Timer but then modified to use a fixed frequency timer such as ACPI or HPET.

DMI Frequency: Better known as bus frequency is the BCLK on Intel platforms and HTT on AMD platforms. It's a fixed frequency that can be changed in the BIOS or on the fly in Windows.



Page 1 - Introduction
Page 2 - Windows 8 testing on Intel
Page 3 - Windows 8 testing on AMD
Page 4 - Windows 8 installed on AMD testing on Intel
Page 5 - Is AMD really problem-free
Page 6 - What about Windows 7
Page 7 - Conclusion
[pagebreak]

Windows 8 testing on Intel

First we had to try again the tool to see if it behaves the same as before and if the new information it provides are right.



Without changing the bus frequency in windows everything is normal, all timers are displaying the same time.

Now after changing the bus frequency, in this case downclocking from 100 MHz to 95 MHz:



Here is something new, before we knew the RTC was affected but now we can see that the QPC Timer too is affected and displays the same time as the RTC Timer after 180s.

For the next test we booted at 95 MHz directly from the BIOS to show you that the issue only happens when changing the bus frequency in windows 8:



Here all timers display the same time like at 100 MHz which is normal but there is something that changed. The QPC Timer's frequency is of 3.25 MHz now and previously it was 3.42 MHz. This is a very interesting information since it shows that changing the bus frequency has an effect on the frequency of this timer. Furthermore we see the following: 100 MHz / 3.42 MHz = 95 MHz / 3.25 MHz = ~ 29.24. So it looks like the QPC is using the DMI frequency as timer source or a timer that makes use of the DMI frequency.

Before switching to the AMD platform here is a resume of what we learned from the Haswell testing:



Page 1 - Introduction
Page 2 - Windows 8 testing on Intel
Page 3 - Windows 8 testing on AMD
Page 4 - Windows 8 installed on AMD testing on Intel
Page 5 - Is AMD really problem-free
Page 6 - What about Windows 7
Page 7 - Conclusion
[pagebreak]

Windows 8 testing on AMD

Now lets do a fresh Windows 8 install on an AMD platform and see what happens:



Everything seems to be fine here obviously. No bus frequency changes were made, all timers have the right frequency and time.

We rebooted the system and downclocked the bus frequency from 200 to 180 in Windows 8 using an overclocking tool.



As you can see downclocking didn't affect the RTC timer nor the QPC timer on AMD, everything is fine. But, if you look closer you see the QPC timer has changed since, now at 14.32 MHz (same frequency as the HPET, meaning it uses the HPET as source), previously at 4.12 MHz (DMI?). We will come back on this strange change on a later stage.

Like with Intel, we booted at lower bus frequency from the BIOS to see what happens:



All timers display the same time and the same frequencies as before, everything normal.

As the QPC seems to use the HPET timer (because of the same frequency) we wanted to see what happens if you disable the latter in the BIOS:



Obviously the HPET timer can't be read anymore so the tool doesn't display anything for the HPET Timer. Furthermore as the QPC Timer is unable to use the HPET it changed source and is now using the ACPI Timer which can be seen thanks to the displayed frequency which is the same as the ACPI Timer (3.58 MHz).

Okay now what happens when you enable HPET in BIOS again?



The QPC Timer frequency changed to 14.32 MHz again meaning it makes use of the HPET again.

Before further testing, here is a resume of what we learned from the AMD testing:



Page 1 - Introduction
Page 2 - Windows 8 testing on Intel
Page 3 - Windows 8 testing on AMD
Page 4 - Windows 8 installed on AMD testing on Intel
Page 5 - Is AMD really problem-free
Page 6 - What about Windows 7
Page 7 - Conclusion
[pagebreak]

Windows 8 installed on AMD testing on Intel

We took the drive where we installed Windows 8 on the AMD platform and plugged it to the Intel platform to see what happens.



Very interesting, now the QPC's frequency is 14.32 MHz, in other words the QPC is now using the HPET as timer source. In this case, as we saw previously changing the bus frequency from Windows isn't affecting anymore. All timers display the same time.
AMD just cured Intel!

Why, How? It's coming, be patient!

We wanted to change the name of the Windows 8 install in the boot menu so we opened bcdedit to do so and we noticed that one parameter was present on the AMD installation and not on the Intel one. This parameter is called "useplatformclock" and is set to "Yes" on the AMD installation and missing on the Intel's.

Lets change it to No and see what happens.



And here we go, the "Windows 8 RTC Bug" is back, look at the QPC Timer, its frequency tells us it's using back the DMI frequency. We are getting somewhere.

Resume:



Page 1 - Introduction
Page 2 - Windows 8 testing on Intel
Page 3 - Windows 8 testing on AMD
Page 4 - Windows 8 installed on AMD testing on Intel
Page 5 - Is AMD really problem-free
Page 6 - What about Windows 7
Page 7 - Conclusion
[pagebreak]

Is AMD really problem-free

During the previous test we made an interesting discovery which leads us the the next step, can you affect an AMD system then?
Yes



How to do it: Run cmd as admin and paste the following line:
bcdedit /set {current} useplatformclock No
or
bcdedit /deletevalue {current} useplatformclock

But, it affects the AMD platform only on the next boot because after that, Windows 8 automatically set/add back the "useplatformclock" parameter in the BCD and set it to "Yes". Some kind of autofix that isn't present when you install Windows 8 on an Intel platform.



Page 1 - Introduction
Page 2 - Windows 8 testing on Intel
Page 3 - Windows 8 testing on AMD
Page 4 - Windows 8 installed on AMD testing on Intel
Page 5 - Is AMD really problem-free
Page 6 - What about Windows 7
Page 7 - Conclusion
[pagebreak]

What about Windows 7

We decided to install Windows 7 on Intel to see if you can affect it the same way. By default, the "useplatformclock" parameter is also not present in the BCD, after downclocking from Windows here is what happens:



That's it, we know now what's happening, this screenshot tells us the following:
What happens if you add the "useplatformclock" parameter to Windows' 7 BCD and set it to Yes:



The QPC is now using the HPET and is not affected by bus frequency change anymore.



Page 1 - Introduction
Page 2 - Windows 8 testing on Intel
Page 3 - Windows 8 testing on AMD
Page 4 - Windows 8 installed on AMD testing on Intel
Page 5 - Is AMD really problem-free
Page 6 - What about Windows 7
Page 7 - Conclusion
[pagebreak]

Conclusion





Page 1 - Introduction
Page 2 - Windows 8 testing on Intel
Page 3 - Windows 8 testing on AMD
Page 4 - Windows 8 installed on AMD testing on Intel
Page 5 - Is AMD really problem-free
Page 6 - What about Windows 7
Page 7 - Conclusion