Two Ways Your DPDK Cores End Up at the Wrong Frequency¶
When you tune a DPDK application, most of the advice is about where things run: which cores, which NUMA node, how much memory. Much less is said about how fast those cores are actually running. We ran into two separate frequency problems, both silent, both easy to miss, and both worth checking before you spend time on anything more exotic.
Isolated cores may not scale their frequency¶
Isolating cores with isolcpus is one of the first things people recommend for DPDK tuning.
The reasoning is sound: it keeps the scheduler from placing other tasks on the cores your poll mode drivers are spinning on,
which helps keep latency and jitter down.
It also has a side effect that's easy to overlook. On most CPUs, once cores are isolated, the kernel stops adjusting their frequency. In our measurements, the isolated cores sat at the nominal 3.2 GHz under load and never moved. When we set the frequency explicitly through DPDK's RTE power library, the same cores went to 4.4 GHz, the maximum boost of our CPU. That's a 38% higher clock speed we had been getting none of, without realizing it.
Nothing about this announces itself. The application runs, the cores report as fully busy (a poll mode driver is always busy, whether or not it's doing useful work), and nothing logs a warning. You only notice if you go looking at the frequency.
How to check¶
Measure while the system is under realistic load, because an idle reading tells you very little. Two simple options:
# Actual busy frequency per core, as measured by the hardware counters
sudo turbostat --quiet --interval 1
# The frequency the kernel believes the core is running at
cat /sys/devices/system/cpu/cpu<N>/cpufreq/scaling_cur_freq
If turbostat shows your isolated cores pinned at the nominal frequency while the CPU is capable of boosting well beyond it,
you're in the situation we were in.
Which frequency driver actually booted¶
The second problem showed up when we tried to fix the first one on AMD machines.
In the AMD Linux world, more than one CPU frequency driver can come up at boot, and which one you get isn't always obvious.
Some distributions use a legacy driver acpi_cpufreq by default that doesn't allow manually setting the boost frequency.
How to check¶
On AMD systems, a value of acpi-cpufreq means you're on the legacy driver.
The amd-pstate family of drivers is the modern alternative.
The fix¶
Boot with the AMD P-state EPP driver instead, which does allow manual frequency control. On kernels that support it, this is selected with a kernel command line parameter:
After rebooting, check scaling_driver again to confirm the driver you wanted is the one that loaded.
The amd_pstate parameter takes a mode, and the modes differ in who decides the actual frequency:
active(the EPP driver,amd-pstate-epp): the kernel gives the CPU's firmware a hint, the energy performance preference, and the hardware picks the frequency within the minimum and maximum limits you set. Only theperformanceandpowersavegovernors are available.passive(amd-pstate): a regular cpufreq governor chooses a target performance level and the driver passes it to the hardware, the same model as other cpufreq drivers. The usual governors work.guided: the kernel sets a minimum and maximum, and the firmware chooses freely inside that range. It sits between the other two.
In active mode you steer the frequency with the limits (scaling_min_freq and scaling_max_freq) and the preference hint, rather than by pinning one exact value.
How the two problems stack¶
The two issues compound each other. If your cores are isolated, you can't count on the kernel to raise their frequency, so you need to set it yourself. If you're also on a driver that ignores manual overrides, that attempt fails quietly, and you're left running at nominal speed while believing you've tuned it.
The order we'd suggest:
- Check which frequency driver is loaded, and switch to one that allows manual control if needed.
- Check the actual frequency of your isolated cores under load.
- If they're stuck at nominal, set the frequency explicitly, for example through the RTE power library.
- Measure again, under load, to confirm the change took effect.
Takeaway¶
If you run DPDK on isolated cores, check their actual frequency under load. If you're on AMD, check which driver is loaded before you start changing anything. Neither check takes more than a minute, and in our case the difference was a clock speed 38% higher than what we'd been running at.