Piker-Alpha / ssdtPRGen.sh

Script to generate a SSDT for Power Management
713 stars 156 forks source link

Two SB E5-2687W not using P-States #36

Open nikezzz0 opened 10 years ago

nikezzz0 commented 10 years ago

Hey here again

ssdtPRGGen.sh log:

Override value: (-x) XCPM mode, now set to: 1! Override value: (-c) CPU type, now using: Ivy Bridge!

System information: Mac OS X 10.9.3 (13D65) Brandstring 'Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz'

Generating ssdt.dsl for a 'Hackintosh Z9PE-D8 WS' with board-id [Mac-F60DEB81FF30ACF6] Ivy Bridge Core E5-2687W v2 processor [0x206D7] setup [0x0501] With a maximum TDP of 150 Watt, as specified by Intel Number logical CPU's: 32 (Core Frequency: 3400 MHz) Number of Turbo States: 6 (3500-4000 MHz) Number of P-States: 29 (1200-4000 MHz) Injected C-States for C000 (C1,C3,C6) Injected C-States for C001 (C1,C3,C6) Warning: 'cpu-type' may be set improperly (0x0501 instead of 0x0701) Warning: board-id [Mac-F60DEB81FF30ACF6] and model [Hackintosh Do you want to continue (y/n)? y

Intel ACPI Component Architecture ASL Optimizing Compiler version 20130117-64 [Jan 19 2013] Copyright (c) 2000 - 2013 Intel Corporation

ASL Input: /Users/niklasoestergaard/Desktop/ssdt.dsl - 768 lines, 22833 bytes, 220 keywords AML Output: /Users/niklasoestergaard/Desktop/ssdt.aml - 5774 bytes, 102 named objects, 118 executable opcodes

Compilation complete. 0 Errors, 0 Warnings, 0 Remarks, 0 Optimizations

Do you want to copy /Users/niklasoestergaard/Desktop/ssdt.aml to /Extra/ssdt.aml? (y/n)? n Do you want to open ssdt.dsl (y/n)? n

Where do I get the AppleIntelCPUPowerManagementInfo.kext log?

Piker-Alpha commented 10 years ago

You can get/compile the source by running:

curl -o RevoBoot.zip https://codeload.github.com/Piker-Alpha/RevoBoot/zip/clang unzip RevoBoot.zip mv RevoBoot-clang RevoBoot cd RevoBoot/i386/libsaio/cpu/tools/PMinfo open AppleIntelCPUPowerManagementInfo.xcodeproj press/hold cmd + b (to compile AppleIntelCPUPowerManagementInfo.kext) cd /Users/${USER}/Library/Developer/Xcode/DerivedData/AppleIntelCPUPowerManagementInfo-*/Build/Products/Debug sudo chmod -R 755 AppleIntelCPUPowerManagementInfo.kext sudo chown -R root:wheel AppleIntelCPUPowerManagementInfo.kext sudo kextload AppleIntelCPUPowerManagementInfo.kext

Run this to get the output:

sudo dmesg cat /var/log/system.log

nikezzz0 commented 10 years ago

This is what sudo dmesg brings up:

CPUSensors: CPU family 0x6, model 0x2d, stepping 0x7, cores 8, threads 16, TJmax 92 AppleIntelCPUPowerManagement: Turbo Ratios 33344557 AppleIntelCPUPowerManagement: (built 20:35:09 Oct 17 2013) initialization complete AppleIntelCPUPowerManagementClient: ready IOPPF: AppleIntelCPUPowerManagement mode [AGPM Controller] unknownPlatform

AICPUPMI: v3.3 Copyright \M-B\M-) 2012-2014 Pike R. Alpha. All rights reserved AICPUPMI: logMSRs............................: 1 AICPUPMI: logIGPU............................: 0 AICPUPMI: logCStates.........................: 1 AICPUPMI: logIPGStyle........................: 1 AICPUPMI: MWAIT C-States.....................: 135456 AICPUPMI: MSR_CORE_THREAD_COUNT......(0x35) : 0x80010 AICPUPMI: MSR_PLATFORM_INFO..........(0xCE) : 0xC0064011F00 AICPUPMI: MSR_PMG_CST_CONFIG_CONTROL.(0xE2) : 0x1E000403 AICPUPMI: MSR_PMG_IO_CAPTURE_BASE....(0xE4) : 0x10414 AICPUPMI: IA32_MPERF.................(0xE7) : 0x771019E AICPUPMI: IA32_APERF.................(0xE8) : 0x8779749 AICPUPMI: MSR_FLEX_RATIO.............(0x194) : 0x0 AICPUPMI: MSR_IA32_PERF_STATUS.......(0x198) : 0x27DF00002200 AICPUPMI: MSR_IA32_PERF_CONTROL......(0x199) : 0x2200 AICPUPMI: IA32_CLOCK_MODULATION......(0x19A) : 0x0 AICPUPMI: IA32_THERM_STATUS..........(0x19C) : 0x88360000 AICPUPMI: IA32_MISC_ENABLES..........(0x1A0) : 0x850089 AICPUPMI: MSR_MISC_PWR_MGMT..........(0x1AA) : 0x400001 AICPUPMI: MSR_TURBO_RATIO_LIMIT......(0x1AD) : 0x2222222323242426 AICPUPMI: IA32_ENERGY_PERF_BIAS......(0x1B0) : 0x0 AICPUPMI: MSR_POWER_CTL..............(0x1FC) : 0x2504005B AICPUPMI: MSR_RAPL_POWER_UNIT........(0x606) : 0xA1003 AICPUPMI: MSR_PKG_POWER_LIMIT........(0x610) : 0x685A0005A84B0 AICPUPMI: MSR_PKG_ENERGY_STATUS......(0x611) : 0xAB4CF892 AICPUPMI: MSR_PKGC3_IRTL.............(0x60a) : 0x0 AICPUPMI: MSR_PKGC6_IRTL.............(0x60b) : 0x0 AICPUPMI: MSR_PKGC7_IRTL.............(0x60c) : 0x0 AICPUPMI: MSR_PP0_CURRENT_CONFIG.....(0x601) : 0x141494800007F8 AICPUPMI: MSR_PP0_POWER_LIMIT........(0x638) : 0x0 AICPUPMI: MSR_PP0_ENERGY_STATUS......(0x639) : 0xD837BF9B AICPUPMI: MSR_PP0_POLICY.............(0x63a) : 0x0 AICPUPMI: MSR_PKG_C2_RESIDENCY.......(0x60d) : 0x1C67CA125E8 AICPUPMI: MSR_PKG_C3_RESIDENCY.......(0x3f8) : 0x243CE5E7BA AICPUPMI: MSR_PKG_C6_RESIDENCY.......(0x3f9) : 0x15B7D60E6BF AICPUPMI: MSR_PKG_C7_RESIDENCY.......(0x3fa) : 0x0 AICPUPMI: CPU Low Frequency Mode.............: 1200 MHz AICPUPMI: CPU Maximum non-Turbo Frequency....: 3100 MHz AICPUPMI: CPU Maximum Turbo Frequency........: 3800 MHz AICPUPMI: CPU P-States [ (12) 28 34 ] AICPUPMI: CPU P-States [ 12 23 24 26 27 28 29 30 31 32 33 34 35 (36) 37 ] AICPUPMI: CPU C3-Cores [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ] AICPUPMI: CPU C6-Cores [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ]

Do you also need what cat /var/log/system.log brings up?

Piker-Alpha commented 10 years ago

First. I pruned the log data to what we need here and that tells me several things. But before we continue, please change logIPGStyle to false in AppleIntelCPUPowerManagementInfo.kext/C*/Info.plist For this you first unload the kext with: sudo kextunload AppleIntelCPUPowerManagementInfo.kext and then you load the kext again with: sudo kextload AppleIntelCPUPowerManagementInfo.kext

Then copy the last line with P-States. It looks like something like this: AICPUPMI: CPU P-States [ 12 23 24 26 27 28 29 30 31 32 33 34 35 (36) 37 ]

There will be fewer numbers, but I need to know which. No other log data is required at this point.

nikezzz0 commented 10 years ago

If I do this:

sudo kextunload AppleIntelCPUPowerManagementInfo.kext and then you load the kext again with: sudo kextload AppleIntelCPUPowerManagementInfo.kext

Last P-States line gives me:

AICPUPMI: CPU P-States [ 12 22 23 24 25 26 27 28 29 30 31 32 (34) 35 36 38 ]

But I didn't change anything in the Info.plist or do these 2 commands set logIPGStyle to false automatically. I don't know where to change the .plist because the kext is downloaded by the Terminal or should I change it somewhere in xcode?

Piker-Alpha commented 10 years ago

You can find the kext with help of one of the previously given commands:

cd /Users/${USER}/Library/Developer/Xcode/DerivedData/AppleIntelCPUPowerManagementInfo-*/Build/Products/Debug/

Then you enter:

sudo kextunload AppleIntelCPUPowerManagementInfo.kext sudo nano AppleIntelCPUPowerManagementInfo.kext/C*/Info.plist sudo kextload AppleIntelCPUPowerManagementInfo.kext sudo dmesg

nikezzz0 commented 10 years ago

ok thx it gives me this:

AICPUPMI: CPU Low Frequency Mode.............: 1200 MHz AICPUPMI: CPU Maximum non-Turbo Frequency....: 3100 MHz AICPUPMI: CPU Maximum Turbo Frequency........: 3800 MHz AICPUPMI: CPU P-States [ (12) 34 ] AICPUPMI: CPU P-States [ 12 34 (36) ]

Piker-Alpha commented 10 years ago

Ok. You ran ./ssdtPRGen.sh with the -c and -x override arguments, and that made it select the wrong processor with the wrong frequencies (clock frequency of 3.4GHz instead of 3.1GHz and turbo frequencies up to 4GHz). Please try again with just ./ssdtPRgen.sh and report back.

nikezzz0 commented 10 years ago

Ok did it without flags: it's giving me this warning:

Sandy Bridge Core E5-2687W processor [0x206D7] setup [0x0501] With a maximum TDP of 150 Watt, as specified by Intel Number logical CPU's: 32 (Core Frequency: 3100 MHz) Number of Turbo States: 7 (3200-3800 MHz) Number of P-States: 27 (1200-3800 MHz) Injected C-States for C000 (C1,C3,C6,C7) Warning: 'cpu-type' may be set improperly (0x0501 instead of 0x0601)

and after restart my GeekBench Scores are half as before (like only 1 processor is installed)

Piker-Alpha commented 10 years ago

Please. Do not forgot to add this line or I have to guess:

AICPUPMI: CPU P-States [ 12 34 (36) ]

Also. Keep in mind that the clock frequency is now correct i.e. 300 MHz lower, and turbo is also 200 MHz lower. And assuming that your board-id is still 'Mac-F60DEB81FF30ACF6' in which case you can try this:

./ssdtPRGen.sh -c 2

What this does is that ssdtPRGen.sh will be forced to select the MacPro61 C-States, under the Haswell configuration, in the script, but that is not important.

nikezzz0 commented 10 years ago

With -c 2 I get this:

Override value: (-c) CPU type, now using: Haswell!

System information: Mac OS X 10.9.3 (13D65) Brandstring 'Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz'

Error: Unknown processor model ... Aborting ... Done

EDIT: Do you think I should change SMBIOS to MacPro 5.1?

Piker-Alpha commented 10 years ago

Oops. Sorry. Try this one: ./ssdtPRGen.sh -c 2 -p E5-2687W

No. Let's stick to what you where using with higher Geekbench score. You can always change at a later time.

nikezzz0 commented 10 years ago

Ok now I have normal Geekbench again and HWMonitor shows that it's getting down to base clock which is multiplier 31. But no lower like 12 in Linux or Windows. Should I show you the PowermanagementInfo log again?

nikezzz0 commented 10 years ago

This is what I get now:

AICPUPMI: CPU P-States [ (31) 34 ] AICPUPMI: CPU P-States [ (12) 31 34 ] AICPUPMI: CPU P-States [ 12 31 34 (38) ]

But it never reaches 12 even if there are no apps launched

Piker-Alpha commented 10 years ago

Ok. Now you know how to generate a working SSDT with the right frequencies. I also see 12 in the list of reached P-States, so it did step down at some point. Please install the Intel Power Gadget v3, in case you haven't already, and see if it steps down. It must, because when you look at the Core and PKG C-States, you'll notice that the CPU was idle. Otherwise it won't trigger low power states.

Are you using a patched copy of AppleIntelCPUPowerManagement.kext?

Time to change the model identifier (Hackintosh Z9PE-D8 WS) and fix this error: [AGPM Controller] unknownPlatform

nikezzz0 commented 10 years ago

Sorry can't install Intel Power Gadget v3 it says:

Intel® Power Gadget does not currently support systems with more than one CPU package.

Yes I'm using the one from rampagedev's DMG - should I use the vanilla one?

Piker-Alpha commented 10 years ago

Crap. I forgot that it supports one processor only. Sorry. Lets see. Can you open AppleIntelCPUPowerManagementInfo.cpp and add this snippet on line 122

if (logicalCoreNumber >= 16) { IOLog ("logicalCoreNumber: %d\n", logicalCoreNumber); }

Compile the kext and let it run for a while. Then check /var/log/system.log for this string. Do you see any?

And no. The modified kext from the DMG appears to be working.

nikezzz0 commented 10 years ago

Ok got it working - the logical core numbers go from 16 to 31 - never reaches 32 (which should be base clock?)

Should I send you a .txt file from the output?

Piker-Alpha commented 10 years ago

Perfect. This tells me that it runs on all logical cores (0-31) but we are missing some data. Please change the following line in the source code (3 times):

for (currentBit = 0; currentBit <= 16; currentBit++)

into:

for (currentBit = 0; currentBit <= 32; currentBit++)

You can also undo the other changes now. Then recompile the kext and tell me if: AICPUPMI: CPU C[3/6]-Cores goes from 0 to 32 now (or 31). Thanks.

p.s. MSRPKG[C2/C3/C6]_RESIDENCY is also still none-zero?

nikezzz0 commented 10 years ago

So MSR_PKG_X is not zero except C7

AICPUPMI: MSR_PKG_C2_RESIDENCY.......(0x60d) : 0x2F9AE05E93 AICPUPMI: MSR_PKG_C3_RESIDENCY.......(0x3f8) : 0xD431720 AICPUPMI: MSR_PKG_C6_RESIDENCY.......(0x3f9) : 0x9F9B7A007 AICPUPMI: MSR_PKG_C7_RESIDENCY.......(0x3fa) : 0x0

And AICPUPMI: CPU CX goes from 0 to 31

AICPUPMI: CPU P-States [ (12) 34 ] AICPUPMI: CPU P-States [ 12 (31) 34 ] AICPUPMI: CPU C3-Cores [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 ] AICPUPMI: CPU C6-Cores [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 ]

Piker-Alpha commented 10 years ago

So only a few numbers are missing from the Cn lists, but running it a bit longer should also add these. Looks perfectly fine to me.

MSR_PKG_C7_RESIDENCY should not be shown for your processors, because it will only get triggered on systems with a IGPU. And even then only sporadically.

The other values are also fine. Your processors are indeed stepping down (idle) otherwise the low-power states (the C-States) would have been zero.

The fact that you see little to none turbo states is caused by this MSR setting: MSR_TURBO_RATIO_LIMIT (0x1AD): 0x22 22 22 23 23 24 24 26 That's: 34 34 34 35 35 36 36 37

You can probably get a few more (none turbo) P-States by using the resource plist of the Macmini5,3. Possibly even more by changing some other MSRs, either in the BIOS or in the boot loader. See also: https://pikeralpha.wordpress.com/2014/05/26/major-breakthrough-for-power-management/

In short. wonder if HWMonitor has issues with your dual-processor setup, because it looks perfectly fine so far.