6

I would like to disable c-states on my computer.

I disabled c-state on BIOS but I don't obtain any result. However, I found an explanation : "Most newer Linux distributions, on systems with Intel processors, use the “intel_idle” driver (probably compiled into your kernel and not a separate module) to use C-states. This driver uses knowledge of the various CPUs to control C-states without input from system firmware (BIOS). This driver will mostly ignore any other BIOS setting and kernel parameters"

I found two solutions to solve this problem but I don't know how to apply:

1) " so if you want control over C-states, you should use kernel parameter “intel_idle.max_cstate=0” to disable this driver."

I don't know neither how I can check the value (of intel_idle.max_cstate ) and neither how I can change its value.

2) "To dynamically control C-states, open the file /dev/cpu_dma_latency and write the maximum allowable latency to it. This will prevent C-states with transition latencies higher than the specified value from being used, as long as the file /dev/cpu_dma_latency is kept open. Writing a maximum allowable latency of 0 will keep the processors in C0"

I can't read the file cpu_dma_latency.

Thanks for your help.

Computer: Intel Xeon CPU E5-2620 Gnome 2.28.2 Linux 2.6.32-358

Paquito
  • 123
  • 1
  • 1
  • 5
  • how can i configure RHEL 7 to be always in C0? – Oleg Vazhnev Dec 12 '14 at 17:29
  • Of note that [since](https://github.com/torvalds/linux/commit/e6d4f08a677654385869ba0c39d7c9ceec47e5c5) Linux 5.6, HEDT and server cpus will actually abide to the ACPI tables configured and reported by the firmware. – mirh Dec 23 '22 at 16:06

1 Answers1

6

To alter the value at boot time, you can modify the GRUB configuration or edit it on the fly -- the method to modify that varies by distribution. This is the Ubuntu documentation to change kernel parameters either for a single boot, or permanently. For a RHEL-derived distribution, I don't see docs that are quite as clear, but you directly modify /boot/grub/grub.conf to include the parameter on the "kernel" lines for each bootable stanza.

For the second part of the question, many device files are read-only or write-only. You could use a small perl script like this (untested and not very clean, but should work) to keep the file open:

#!/usr/bin/perl

use FileHandle;
my $fd = open (">/dev/cpu_dma_latency");
print $fd "0";
print "Press CTRL-C to end.\n";

while (1) {
    sleep 5;
}

Redhat has a C snippet in a KB article here as well and more description of the parameter.

buysse
  • 76
  • 2
  • Thanks. I don't manage to work the perl program but I insert the c program from [RedHat](https://access.redhat.com/site/articles/65410) and all core stay at C0 state as expected. – Paquito Mar 26 '14 at 09:37
  • 1
    @Paquito how do you verify that all cores in C0? – Oleg Vazhnev Dec 13 '14 at 11:55
  • make sure you are not using a poll method to keep your cores at C0 as this will bork your hyperthreading – David McGowan May 01 '18 at 22:24