Menu

Home

Michael

Welcome to Powerlimit!

Follow these instructions to get Powerlimit working.

Prerequisites

Powerlimit uses the kernel module msr. So make sure that this module get loaded.

You can load the module once with:

$ modprobe msr

Or add msr to file /etc/modules or add a file with it to /etc/modules-load.d.

How to compile

Download the single source file powerlimit.c and compile it with:

$ gcc -static powerlimit.c -lm -s -o powerlimit

This will produce a statically linked executable. If you prefer a dynamically linked executable, simply omit the -static parameter.

Execute Powerlimit

To a description of all option of Powerlimit, execute:

$ ./powerlimit help

This command will produce the following output:

Usage: powerlimit info | [option=value]...
The following options are available:

  pkg=[E|D],[WATT#],[SECONDS#],[E|D],[E|D],[WATT#],[SECONDS#],[E|D],[L|U]
    Set Package Power Limit #1 (Long Term) and #2 (Short Term):
    E|D       Enabled/Disablede Power Limit #1
    WATT#     Package Power Limit #1 (Watts)
    SECONDS#  Time Window for Power Limit #1 (Seconds)
    E|D       Enabled/Disablede Package Clamping Limitation #1
    E|D       Enabled/Disablede Power Limit #2
    WATT#     Package Power Limit #2 (Watts)
    SECONDS#  Time Window for Power Limit #2 (Seconds)
    E|D       Enabled/Disablede Package Clamping Limitation #2
    L|U       Lock/Unlock Package Power Limits

  pp0=[E|D],[WATT#],[SECONDS#],[E|D],[L|U]
    Set PP0 (Cores) Power Limit

  pp1=[E|D],[WATT#],[SECONDS#],[E|D],[L|U]
    Set PP1 (Graphics) Power Limit

  dram=[E|D],[WATT#],[SECONDS#],[E|D],[L|U]
    Set DRAM Power Limit

  volt=[CORE#],[GPU#],[CACHE#],[UNCORE#],[ANALOG_IO#],[DIGITAL_IO]
    Set Voltage Offsets (Millivolts)

  temp=TEMP_OFFSET#
    Set Temperature Target Offset (Kelvins)

All other option except help require you to run Powerlimit as root.

For example to enable all power limits with clamping, you can execute:

$ ./powerlimit pkg=E,,,E,E,,,E,

Starting Powerlimit as a systemd service

To start as a service create a file /etc/systemd/system/powerlimit.service with the following content:

[Unit]
Description=Powerlimit Service
After=sleep.target suspend.target hibernate.target getty.target
Requires=systemd-modules-load.target
[Service]
ExecStart=/path/to/powerlimit options...
[Install]
WantedBy=multi-user.target
WantedBy=sleep.target

Finally enable the service with:
$ systemctl enable powerlimit.service

Project Members: