Running the MacCPUID program (http://software.intel.com/en-us/articles/download-maccpuid) provides the user with information on whether turboboost is enabled on the machine. It can detect this in real time; if I turn turboboost off with this kernel extension (https://github.com/nanoant/DisableTurboBoost.kext), it detects that it is turned off. My question is: how does an APPLICATION do this - I thought that the model-specific registers required to access this feature were only accessible in kernel mode?
The program is a kernel extension and has to run at ring0 to read/write the MSRs.
The 'disable turbo mode' method used by the program is not the correct way to disable Turbo mode and can crash some systems.
From the Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3 (3A, 3B & 3C): System Programming Guide
section 18.104.22.168 OS Control of Opportunistic Processor Performance Operation (Vol. 3B page 14-5 of the May 2012 version)
System software can temporarily disengage opportunistic processor performance operation by setting bit 32 of the IA32_PERF_CTL MSR (0199H), using a readmodify-write sequence on the MSR. The opportunistic processor performance operation can be re-engaged by clearing bit 32 in IA32_PERF_CTL MSR, using a readmodify-write sequence. The DISENAGE bit in IA32_PERF_CTL is not reflected in bit 32 of the IA32_PERF_STATUS MSR (0198H), and it is not shared between logical processors in a physical package.
Thank you for your response. By "the program", do you mean the kernel extension that I posted? If so, is it true that MacCPUID.app also works via a kernel extension? I am looking for any way around using ring0 code to get Turbo Mode information; it would just be nice to be able to plot the variability of timings for some particular task when turbo mode is on or off, without having to go through the kernel.
By program I meant the 'DisableTurboBoost.kext' stuff.
macCPUID (if it just reads CPUID) doesn't require ring0 privilege.
I can't think of anything that doesn't require ring0 access except for disabling turbo in the bios.