CPU Overclocking on Ubuntu 24.04

One of my workstations has a Intel Core i7-8086K Special Edition CPU. Its a 40th-anniversary limited edition 6-core/12-thread Coffee-Lake processor launched in 2018 to commemorate the original Intel 8086 processor. The i7-8086K features a base clock speed of 4.0GHz and a boost speed of 5.0GHz.

As this processor was not a standard mass-produced model, its a bit collectible in some strange circles. It was also the first Intel processor to hit 5.0GHz out of the box. Technically the i7-8086K is a “cherry-picked” or higher-binned version of the popular Intel Core i7-8700K. Because these chips were selected from the best-performing parts of the wafer, they typically require less voltage to run at high speeds. At the time enthusiasts were willing to pay a premium as these chips are much more likely to reach stable overclocks of 5.1 GHz to 5.3 GHz across all cores.

Nowadays the Intel Core i7-8086K Special Edition CPU still maintains a “legacy premium” price, even on eBay where they are still over $100 per.

So lets overclock it a bit.


Installing CPU Frequency Tools in Ubuntu

Lets start by installing the tools to allow us to modify the cpu governor and inspect CPU frequencies

sudo apt install linux-tools-common linux-tools-$(uname -r) cpufrequtils

Set CPU Governor to Performance

The performance governor prevents Linux from aggressively downclocking the CPU.

sudo cpupower frequency-set -g performance

Set Overclock on Boot Via Systemd

We want our overclock to be persistent across reboots, so we will create a systemd service that will run at boot-time.

vim /etc/systemd/system/cpupower.service

Copy/Paste the contents below in to the file we are creating above.

[Unit]
Description=CPU performance governor
[Service]
Type=oneshot
ExecStart=/usr/bin/cpupower frequency-set -g performance
[Install]
WantedBy=multi-user.target

Now we need to enable and start the service.

sudo systemctl enable --now cpupower

Confirm Overclock

First we will run a quick frequency check. Here the CPU(s) scaling MHz indicates the percentage of the CPU’s maximum possible frequency that the system is currently running at (on average across cores). Meaning that the CPU is currently operating at ~42% of its maximum clock frequency across all CPUs.

lscpu | grep MHz
CPU(s) scaling MHz: 42%
CPU max MHz: 5100.0000
CPU min MHz: 800.0000

Via the cpupower command we can we that we currently have one boosted core running at 5.07Ghz.

root@raptor:/etc/chrony# cpupower frequency-info
analyzing CPU 7:
driver: intel_pstate
CPUs which run at the same hardware frequency: 7
CPUs which need to have their frequency coordinated by software: 7
energy performance preference: performance
hardware limits: 800 MHz - 5.10 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 800 MHz and 5.10 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency: 5.07 GHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes

We can run the watch command against /proc/cpu info and watch frequencies change real-time.

Terminal output displaying CPU frequencies in MHz, showing varying values for multiple CPU cores.

Generate Load to Drive Up Frequencies

In a second ssh window we will now install and run stress-ng to generate some load, while we continue to run our watch command above.

sudo apt install stress-ng

Once installed we run it as shown below

Where:

  • –cpu 0 = use all online CPUs
  • matrixprod is a decent compute-heavy load

In our watch window we can see we have all cores above 4.0GHz

Terminal output showing CPU frequency readings in MHz, displaying values around 4399 to 4400 MHz.

Checking CPU Temps

My Intel Core i7-8086K Special Edition CPU has a pretty average cpu cooler/fan. Nothing fancy with heat-pipes and multiple fans, however I do have 8x 120mm case fans moving a lot of air through my case, while projecting nice purple glow. So lets check our CPU temps, first at rest and then under load.

So we start by installing lm-sensors, and then detect available sensors. Sensors-detect will ask you a handful of questions, but you can usually stick with the defaults.

sudo apt install lm-sensors
sudo sensors-detect

And now we check temps at rest

~# sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +34.0°C (high = +82.0°C, crit = +100.0°C)
Core 0: +33.0°C (high = +82.0°C, crit = +100.0°C)
Core 1: +33.0°C (high = +82.0°C, crit = +100.0°C)
Core 2: +34.0°C (high = +82.0°C, crit = +100.0°C)
Core 3: +36.0°C (high = +82.0°C, crit = +100.0°C)
Core 4: +33.0°C (high = +82.0°C, crit = +100.0°C)
Core 5: +33.0°C (high = +82.0°C, crit = +100.0°C)

So lets kick off stress-ng to generate some load, which we ‘watch’ the output of the sensors command in another terminal window.

stress-ng --cpu 0 --cpu-method matrixprod --timeout 60s --metrics-brief

And we can see that we get a bit toasty. While these temperatures are high, they are not dangerous to see during a stress test. What we do know is that we do not have a lot of thermal headroom.

Screenshot of system temperature readings from a tool showing CPU core temperatures with values in Celsius, indicating critical and high temperature thresholds.

Stress-ng is built to generate worst-case thermal load when running, so I really and not concerned to see these temps when its running.

Just to be sure, lets run turbostat and see if we see any throttling.

sudo turbostat --interval 1

Turbostat produces a lot of output, the table below will give you an idea of what you are looking at.

ColumnWhat it ShowsWhat You Want to See
PkgTmpCPU package temperatureIdeally <90 °C during sustained load
CoreTmpPer-core temperatureSimilar to package temp; watch for cores hitting 95 °C+
Avg_MHzAverage CPU frequency during the intervalShould rise close to the overclock max under load
Bzy_MHzActual frequency while the core is busyShould approach the configured turbo (≈5 GHz)
Busy%CPU utilization per coreNear 100% during stress-ng
PkgWattTotal CPU package powerUseful to understand thermal load
CorWattPower used by coresIndicates how much compute load is occurring

For thermal events or power throttling we look for the following.

ColumnMeaning
ThermThrotThermal throttling events
Pkg%pc2 / pc3 / pc6Package idle states (should drop during stress)
Core%pc3 / pc6Core idle states

If cpu performance/speed was throttled we would expect to see ThermThrot events.

If you want a cleaner, and more succinct output from turbostat, try the one-liner below.

sudo turbostat --interval 1 --quiet --show CPU,Busy%,Bzy_MHz,Avg_MHz,PkgTmp,CoreTmp,ThermThrot

While we are not seeing any throttling events, we do see that across all CPU cores we have a BZY_MHz of 4400 MHz (not 5000MHz). Since our test workload is running across all cores/threads (12 logical CPUs in this case), the processor switches the the all-core turbo limit of 4.4GHz which is lower than the single core turbo frequency of ~5.0GHz. This is good news and shows we are stable across all cores, but does not allow us to hit the max turbo frequency for this cpu.

So lets try that.

Lets run a load on exactly one core.

stress-ng --cpu 1 --taskset 0 --timeout 60

In another terminal window we run our watch command, where we can see that we are in fact able to hit almost 5.1Ghz.

sudo turbostat --interval 1 --show CPU,Bzy_MHz,PkgTmp
CPU Bzy_MHz PkgTmp
- 5098 53
0 5099 53

Cool, over 5.0GHz.

Not that I am looking to push it any further above 5.0GHz, but if I was, a better cpu cooler would be the way to go (and possibly some tweaking in the bios). That being said, at our current speeds as we never got hot enough to see any throttling. May look for a glowing purple one anyway.

Leave a Reply