Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set intel_idle.max_cstate=0 to disable c-states?

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

like image 380
Paquito Avatar asked Mar 18 '14 14:03

Paquito


People also ask

How do I turn off CPU C States?

From the System Utilities screen, select System Configuration > BIOS/Platform Configuration (RBSU) > Power and Performance Options > C-State Efficiency Mode. Select one of the following: Enable. Disable.

Should I enable or disable C states?

C state is used for power saving and when you overclock you use the maximum power of the CPU, constantly. So you would not want to use c state. Disable both, also manual vcore always, adaptive might do some adjustments you don't want to happen. First off an overclocked processor does not use maximum power constantly.

What is C states control in BIOS?

C-States are power-saving features built into the processors. They basically shut down or inactive circuit components when they're not needed, then repower them when demand is anticipated. Full explanation here.

How to disable Intel IDLE driver with C-state?

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.

What are CPU C-States and how to disable them?

What are CPU "C-states" and how to disable them if needed? To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf. On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

What is Intel_idle Max_cstate=0?

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered: In order to save energy when the CPU is idle, the CPU can be commanded to enter a low-power mode.

How to limit a CPU to a certain C-state in Linux?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf. Here we limit the system to only C-State 1:


1 Answers

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.

like image 159
buysse Avatar answered Oct 10 '22 14:10

buysse