-
Notifications
You must be signed in to change notification settings - Fork 48
ART Frequency, CPU Frequency and Clock Drift #448
Copy link
Copy link
Closed
acidanthera/OcSupportPkg
#13Labels
Description
OCCPU is misreporting my CPU's frequency. I believe it's also causing the macOS system clock to run fast:
00:226 00:113 OCCPU: Found Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz
00:345 00:118 OCCPU: Signature 50654 Stepping 4 Model 55 Family 6 Type 0 ExtModel 5 ExtFamily 0
00:461 00:116 OCCPU: Detected Apple Processor Type: 0F -> 0F01
00:575 00:114 OCCPU: Ratio Min 12 Max 30 Current 36 Turbo 37 36 36 36
00:695 00:119 OCCPU: ART Frequency 2880000000 2880MHz 24000000 * 240 / 2 = 2880000000
00:821 00:126 OCCPU: TSC Frequency 2992972839 2992MHz
00:944 00:122 OCCPU: CPU Frequency 2880000000 2880MHz
01:068 00:123 OCCPU: FSB Frequency 96000000 96MHz
01:206 00:138 OCCPU: Pkg 1 Cores 12 Threads 24
Looking at OcCpu.c, the following lines look suspect to me:
AsmCpuid (CPUID_TIME_STAMP_COUNTER, &CpuidEax, &CpuidEbx, NULL, NULL);
if (CpuidEax > 0 && CpuidEbx > 0) {
Cpu->CPUFrequency = MultU64x32 (BASE_ART_CLOCK_SOURCE, (UINT32) DivU64x32 (CpuidEbx, CpuidEax));
Should that be storing to Cpu->ARTFrequency instead? I tested by making this change and setting Cpu->CPUFrequency from Cpu->TSCFrequency. About this Mac now reports the correct frequency (3Ghz instead of 2.88Ghz). Also, the clock no longer drifts whereas it used to run a few seconds per minute faster than real-time.
Reactions are currently unavailable