Skip to content

Commit

Permalink
Replace "apply" with "undervolt"
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsunyan committed Jan 31, 2019
1 parent eb92393 commit 9b23b9c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 25 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# intel-undervolt

intel-undervolt is a tool for undervolting Haswell and newer Intel CPUs using MSR.
This tool is based on the content of [this article](https://github.com/mihic/linux-intel-undervolt).
intel-undervolt is a tool for undervolting and throttling limits alteration for Intel CPUs.

This tool also allow to alter power limits and temperature limit using MSR and MCHBAR registers.
Undervolting works on Haswell and newer CPUs and based on the content of
[this article](https://github.com/mihic/linux-intel-undervolt).

## Disclaimer

Expand All @@ -19,27 +19,27 @@ Run `systemctl daemon-reload` to reload unit files.

You can configure parameters in `/etc/intel-undervolt.conf` file.

### Voltage Planes
### Undervolting

By default it contains all voltage planes like in ThrottleStop utility for Windows.
By default it contains all voltage domains like in ThrottleStop utility for Windows.

The following syntax is used in the file: `apply ${index} ${display_name} ${undervolt_value}`.
For example, you can write `apply 2 'CPU Cache' -25.84` in order to undervolt CPU cache by 25.84 mV.
The following syntax is used in the file: `undervolt ${index} ${display_name} ${undervolt_value}`.
For example, you can write `undervolt 2 'CPU Cache' -25.84` to undervolt CPU cache by 25.84 mV.

### Power Limits

`power package ${short_term} ${long_term}` can be used in order to alter short term and long term
package power limits. For example, `power package 35 25`.
`power package ${short_term} ${long_term}` can be used to alter short term and long term package
power limits. For example, `power package 35 25`.

You can also specify a time window for each limit in seconds. For instance,
`power package 35/5 25/60` for 5 seconds and 60 seconds respectively.

### Temperature Limit

`tjoffset ${temperature_offset}` can be used in order to alter temperature limit. This value
is subtracted from max temperature level. For example, `tjoffset -20`. If max temperature level
is set to 100, the resulting limit will be set to `100 - 20 = 80°C`. Note that offsets
higher than 15°C are allowed only on Skylake and newer.
`tjoffset ${temperature_offset}` can be used to alter temperature limit. This value is subtracted
from max temperature level. For example, `tjoffset -20`. If max temperature is equal to 100°C, the
resulting limit will be set to `100 - 20 = 80°C`. Note that offsets higher than 15°C are allowed
only on Skylake and newer.

## Usage

Expand Down
23 changes: 18 additions & 5 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ config_t * load_config(config_t * old_config, bool * nl) {
sprintf(fdarg, "%d", fd[1]);
execlp("/bin/bash", "/bin/bash", "-c", "readonly fd=$1;"
"function pz { printf '%s\\0' \"$@\" >&$fd; };"
"function apply { pz apply \"$1\" \"$2\" \"$3\"; };"
"function apply { pz apply; pz undervolt \"$1\" \"$2\" \"$3\"; };"
"function undervolt { pz undervolt \"$1\" \"$2\" \"$3\"; };"
"function tdp { pz tdp; pz power package \"$1\" \"$2\"; };"
"function power { pz power \"$1\" \"$2\" \"$3\"; };"
"function tjoffset { pz tjoffset \"$1\"; };"
Expand All @@ -123,6 +124,8 @@ config_t * load_config(config_t * old_config, bool * nl) {
ssize_t linen = 0;
bool error = false;
char * tmp = NULL;
bool apply_deprecation = false;
bool tdp_deprecation = false;

#define iuv_read_line() (getdelim(&line, &linen, '\0', file) >= 0)

Expand All @@ -143,7 +146,7 @@ config_t * load_config(config_t * old_config, bool * nl) {
#define iuv_read_line_error() iuv_read_line_error_action({})

while (iuv_read_line()) {
if (!strcmp(line, "apply")) {
if (!strcmp(line, "undervolt")) {
iuv_read_line_error();
tmp = NULL;
int index = (int) strtol(line, &tmp, 10);
Expand Down Expand Up @@ -209,10 +212,20 @@ config_t * load_config(config_t * old_config, bool * nl) {
iuv_print_break("Invalid interval: %s\n", line);
}
config->interval = interval;
} else if (!strcmp(line, "apply")) {
if (!apply_deprecation) {
NEW_LINE(nl, nll);
fprintf(stderr, "Warning: 'apply' option is deprecated, "
"use 'undervolt' instead\n");
}
apply_deprecation = true;
} else if (!strcmp(line, "tdp")) {
NEW_LINE(nl, nll);
fprintf(stderr, "Warning: 'tdp' option is deprecated, "
"use 'power package' instead\n");
if (!tdp_deprecation) {
NEW_LINE(nl, nll);
fprintf(stderr, "Warning: 'tdp' option is deprecated, "
"use 'power package' instead\n");
}
tdp_deprecation = true;
} else {
iuv_print_break("Configuration error\n");
}
Expand Down
14 changes: 7 additions & 7 deletions intel-undervolt.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# CPU Undervolting
# Usage: apply ${index} ${display_name} ${undervolt_value}
# Example: apply 2 'CPU Cache' -25.84
# Usage: undervolt ${index} ${display_name} ${undervolt_value}
# Example: undervolt 2 'CPU Cache' -25.84

apply 0 'CPU' 0
apply 1 'GPU' 0
apply 2 'CPU Cache' 0
apply 3 'System Agent' 0
apply 4 'Analog I/O' 0
undervolt 0 'CPU' 0
undervolt 1 'GPU' 0
undervolt 2 'CPU Cache' 0
undervolt 3 'System Agent' 0
undervolt 4 'Analog I/O' 0

# Power Limits Alteration
# Usage: power ${domain} ${short_power_value} ${long_power_value}
Expand Down

0 comments on commit 9b23b9c

Please sign in to comment.