cocafe / msr-utility

Little CLI utility to control Model Specific Registers (MSRs) on Windows via WinRing0 driver, 64+ cores supported
73 stars 11 forks source link

Per-core multiplayer set #3

Open T-Troll opened 1 year ago

T-Troll commented 1 year ago

Have a nice day,

At your examples, you can set total CPU boost multiplier limit (e.g. 12-27). Is it possible to set it per-core, like ThrottleStop do?

I just have some idea about it.

cocafe commented 1 year ago

Nope, it seems like Intel does not have such options like AMD ryzen does.

Turbo multiplier based on activated core count can be set by these msr registers. But it may be processor specified, please check Intel SDM MSR section for more information.

But if you want something like limiting multiplier of one or more exactly cores like in AMD bios, as far as I know, there is likely no such options for Intel. ( I only have 12th gen mobile, 10th gen mobile, and Xeon E5V4. I'm on AMD ryzen 7000 now :P )

T-Troll commented 1 year ago

Thank you for reply!

Turbo multiplier based on activated core count

Exactly this! In fact, i want to make some auto overclock/downclock based on system sensors temperature.

Can you please direct me what registers i need to use or reference spec/datasheet for this?

cocafe commented 1 year ago

You may find some info from Intel SDM for you processor (if the MSR is public).

Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 4: Model-specific Registers.

For Xeon E5V4, the turbo bin register is 0x1ad, 0x1ae and 0x1af. These registers are described in Vol.4 page 264. The MSB (64th bit) of 0x1af must be set 1 to apply new turbo bin settings.

And firstly, you may wanna check the overclock bit ( bit 20 of MSR 0x194 ) is 1 or not, if this bit is 1 then it's locked, nothing (undervolt, turbo bin, etc) can be changed without a modded bios or unlock it in bios variable via something like RUBIOS. ( If everything in ThrottleStop is grey out, this bit is likely locked or processor is not supported to change turbo bin )

In fact, to limit power consumption, you can limit the PL1 and PL2 further, that will limit turbo speed and save the power, well, that is what exactly crappy Intel DPTF does on high temperature ( it sucks and throttles your CPU and GPU based on various conditions ).

T-Troll commented 1 year ago

Thanks a lot. it's what i looking for!

No, it's about downclock in case of overheat risk and upclock back for better spike processing (modern notebooks thin, but awful Cooling System as a result). But, anyway, thanks for warning!

About DPTF... Yes, it's really weird stuff.... I hack upper filter, so now i can control it from console, but still can't make IPC (lower filter interface) working correctly. I mostly use it for system monitoring.

cocafe commented 1 year ago

For downclock, you can set MSR 0x1a0 bit 6 to 1 to disable turbo. I use this to save power and avoid heating on 12900H.

Here are some info about 0x1a0 and 0x1fc I found on the internet:

#define IA32_MISC_ENABLE        0x1a0   // thread scope
#define  FAST_STRINGS_ENABLE_BIT    BIT(0)
#define  TM1_TM2_EMTTM_ENABLE_BIT   BIT(3)  // Automatic Thermal Control Circuit Enable (R/W)
#define  MISC_TURBO_DISABLE     BIT(6)      
#define  PERF_MONITORING        BIT(7)
#define  SPEED_STEP_ENABLE_BIT      BIT(16)
#define  MONITOR_MWAIT_SUPPORT      BIT(18) // should not change on the fly
#define  BURST_MODE_DISABLE             BIT(38)

#define MSR_POWER_CTL                           0x1fc
#define PCH_NEG_DISABLE                         (1 << 30) // PKG C-state Lat. Neg.
#define PCH_NEG_DISABLE_SHIFT                   30
#define LTR_SW_DISABLE                          (1 << 29)  // LTR_IIO_DISABLE, LTR: Snoop Related
#define LTR_SW_DISABLE_SHIFT                    29 // ???
#define LTR_SW_INPUT_DISABLE                    28 // LTR_SW_DISABLE, LTR Software Input, Disable = Ignore SW LTR input.
#define PROCHOT_LOCK                            (1 << 27)
#define PROCHOT_LOCK_SHIFT                      27
#define PROCHOT_RESPONSE                        (1 << 26)
#define PROCHOT_RESPONSE_SHIFT                  26
#define PWR_PERF_TUNING_CFG_MODE                (1 << 25) // if set 0, turbo is disabled 
#define PWR_PERF_TUNING_CFG_MODE_SHIFT          25
#define PWR_PERF_TUNING_ENABLE_DYN_SWITCHING    (1 << 24) // Enable/Disable dynamic switching feature in the power performance tuning algorithm.
#define PWR_PERF_TUNING_ENABLE_DYN_SHIFT        24        // Power/Performance Switch
#define PWR_PERF_TUNING_DISABLE_EEP_CTRL        (1 << 23) // DYNAMIC_P_STATE_CTRL, EE-P Control
#define PWR_PERF_TUNING_DISABLE_EEP_SHIFT       23
#define PWR_PERF_TUNING_DISABLE_SAPM_CTRL       (1 << 22) // DISABLE THIS DROPS BENCHAMRKS PTS
#define PWR_PERF_TUNING_DISABLE_SAPM_SHIFT      22
#define DIS_PROCHOT_OUT                         (1 << 21)
#define DIS_PROCHOT_OUT_SHIFT                   21
#define DIS_RACE_TO_HALT_OPTIMIZATION           (1 << 20)
#define DIS_RACE_TO_HALT_OPTIMIZATION_SHIFT     20         // Gen 6~12, SDM
#define EE_TURBO_DISABLE                        (1 << 19)
#define EE_TURBO_DISABLE_SHIFT                  19
#define ENERGY_EFFICIENT_PSTATE_ENABLE          (1 << 18)
#define ENERGY_EFFICIENT_PSTATE_ENABLE_SHIFT    18
#define PHOLD_SR_DISABLE                        (1 << 17)
#define PHOLD_SR_DISABLE_SHIFT                  17
#define PHOLD_CST_PREVENTION_INIT               (1 << 16)
#define PHOLD_CST_PREVENTION_INIT_SHIFT         16
#define FAST_BRK_INT_EN                         (1 << 4) // Disable = Use 'fast' VID swing rate
#define FAST_BRK_INT_EN_SHIFT                   4
#define FAST_BRK_SNP_EN                         (1 << 3) // Disable = Use 'fast' VID swing rate
#define FAST_BRK_SNP_EN_SHIFT                   3
#define SAPM_IMC_C2_POLICY_EN                   (1 << 2)
#define SAPM_IMC_C2_POLICY_SHIFT                2
#define C1E_ENABLE                              (1 << 1)
#define C1E_ENABLE_SHIFT                        1
#define ENABLE_BIDIR_PROCHOT_EN                 (1 << 0)
#define ENABLE_BIDIR_PROCHOT_EN_SHIFT           0
T-Troll commented 1 year ago

Thanks!

But i mean not common bus overclock, but multipliers limits altering - this works better for modern CPUs. I will not play with PLs and disabling turbo, manufacturer do it for me already (up to 90W(!) non turbo limit for 45W CPU into BIOS).

cocafe commented 1 year ago

Nope, this will disable turbo speed, not BCLK overclocking or something, for example, if your processor is 1.2~2.3GHz, and turbo up to 3.0GHz, this will disable turbo, aka, limit the processor up to 2.3GHz, aka, multiplier limiting.

T-Troll commented 1 year ago

Seems like it's hard to explain...

Ok, just open ThrottleStop, FIVR and check Turbo Ratio Limits block. I need to alter this values (and it is nice to know max. possible), that's all. As you say, it's named "Turbo multiplier based on activated core count". This work well to fine-tune heat VS cooling.

cocafe commented 1 year ago

'key, just do want you want :P

If it's not grey out in ThrottleStop, then it's possible to change via MSR register.

T-Troll commented 1 year ago

Yes, it's not grayed, i use TS for alter it now, but want to do it smart way. So i will study the manual you share for this. Thanks a lot for help, i'll drop you a message, then implement it into my project (now it can only control fans and PLs as well as monitor system sensors)!

cocafe commented 1 year ago

It could be a bit annoyed, if you are interested in more closed info, you can check those bios leaks, for example, alderlake bios leaks ICE_TEA_BIOS-master.zip, there are many public and closed info which can have some fun, like hidden usage of msr mailbox 0x150 :P

T-Troll commented 1 year ago

I don't dig so deep into CPU before.

Maybe because any ACPI BIOS is a one big low-level exploit, so you can do anything into the system using it. BTW, i plan to interact with msr using ACPI calls, not a separate driver like you (just because i develop kernel driver for it already). I can share a lot of fairy tales about it... As well as about DPTF.

cocafe commented 1 year ago

Thanks for info, will study your project later :D