1

I've been running ubuntu 20.04.4 LTS on an old motherboard with intel i5 3570k. This CPU has a limitted number of C States available and as such power consumption was mediocre. I have now updated to a new motherboard with i7 11700k installed and when using powertop to check how my ubuntu distribution does I noticed that available C States has decreased which probably means that there is more room for power saving. I checked ubuntu launched from usb drive and all the C States were available. This is how powertop sees the C States at the moment:

It states that only C1, C2 and C3 states are available using ACPI. What do I need to do to start making use of all the other c states?

I was asked to provide the output of grep cpu:

/sys/devices/system/cpu/cpu0/cpuidle/state0/name:POLL
/sys/devices/system/cpu/cpu0/cpuidle/state1/name:C1_ACPI
/sys/devices/system/cpu/cpu0/cpuidle/state2/name:C2_ACPI
/sys/devices/system/cpu/cpu0/cpuidle/state3/name:C3_ACPI
1
  • Could you edit your question to include the output of grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name? This will list the available C-States for your CPU as per the installed kernel and the limitations imposed by the UEFI configuration. With this info, it may be possible to offer a solution.
    – matigo
    Nov 10, 2022 at 14:16

1 Answer 1

1

On a per processor family basis, Intel decides if they want to override the default ACPI idle state structure used by linux kernels. This is done in the kernel source tree under drivers/idle/intel_idle.c. An example override for my Comet Lake processor:

doug@s19:~/temp-k-git/linux$ git diff
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 3273360f30f7..770660d777c4 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1155,6 +1155,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
        X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L,          &idle_cpu_skl),
        X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE,            &idle_cpu_skl),
        X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X,           &idle_cpu_skx),
+       X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE,           &idle_cpu_skl),
        X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X,           &idle_cpu_icx),
        X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL,        &idle_cpu_knl),
        X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM,        &idle_cpu_knl),

By default the idle states are:

$ grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name
/sys/devices/system/cpu/cpu0/cpuidle/state0/name:POLL
/sys/devices/system/cpu/cpu0/cpuidle/state1/name:C1_ACPI
/sys/devices/system/cpu/cpu0/cpuidle/state2/name:C2_ACPI
/sys/devices/system/cpu/cpu0/cpuidle/state3/name:C3_ACPI

$ grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/desc
/sys/devices/system/cpu/cpu0/cpuidle/state0/desc:CPUIDLE CORE POLL IDLE
/sys/devices/system/cpu/cpu0/cpuidle/state1/desc:ACPI FFH MWAIT 0x0
/sys/devices/system/cpu/cpu0/cpuidle/state2/desc:ACPI FFH MWAIT 0x30
/sys/devices/system/cpu/cpu0/cpuidle/state3/desc:ACPI FFH MWAIT 0x60

Via the above override the idle states are:

$ grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name
/sys/devices/system/cpu/cpu0/cpuidle/state0/name:POLL
/sys/devices/system/cpu/cpu0/cpuidle/state1/name:C1
/sys/devices/system/cpu/cpu0/cpuidle/state2/name:C1E
/sys/devices/system/cpu/cpu0/cpuidle/state3/name:C3
/sys/devices/system/cpu/cpu0/cpuidle/state4/name:C6
/sys/devices/system/cpu/cpu0/cpuidle/state5/name:C7s
/sys/devices/system/cpu/cpu0/cpuidle/state6/name:C8
/sys/devices/system/cpu/cpu0/cpuidle/state7/name:C9
/sys/devices/system/cpu/cpu0/cpuidle/state8/name:C10

$ grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/desc
/sys/devices/system/cpu/cpu0/cpuidle/state0/desc:CPUIDLE CORE POLL IDLE
/sys/devices/system/cpu/cpu0/cpuidle/state1/desc:MWAIT 0x00
/sys/devices/system/cpu/cpu0/cpuidle/state2/desc:MWAIT 0x01
/sys/devices/system/cpu/cpu0/cpuidle/state3/desc:MWAIT 0x10
/sys/devices/system/cpu/cpu0/cpuidle/state4/desc:MWAIT 0x20
/sys/devices/system/cpu/cpu0/cpuidle/state5/desc:MWAIT 0x33
/sys/devices/system/cpu/cpu0/cpuidle/state6/desc:MWAIT 0x40
/sys/devices/system/cpu/cpu0/cpuidle/state7/desc:MWAIT 0x50
/sys/devices/system/cpu/cpu0/cpuidle/state8/desc:MWAIT 0x60

This statement:

I noticed that available C States has decreased which probably means that there is more room for power saving.

Is incorrect, there isn't room for power saving just in currently available states. Observe the deepest state is the same. You might achieve some power savings via selection of the idle governor as a function of your particular workflow requirements:

$ grep . /sys/devices/system/cpu/cpuidle/*
/sys/devices/system/cpu/cpuidle/available_governors:ladder menu teo
/sys/devices/system/cpu/cpuidle/current_driver:intel_idle
/sys/devices/system/cpu/cpuidle/current_governor:teo
/sys/devices/system/cpu/cpuidle/current_governor_ro:teo
/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us:0
/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us:0
2
  • If I understand correctly there is no point in correcting the cpu states that are available in default linux? Nov 10, 2022 at 16:03
  • There is no point in changing them. "Correcting" is not the right term to use. Nov 10, 2022 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .