概要
在有些情况下客户需要验证CPU是否能以最大频率运行,但通过压力测试,可能总是无法将CPU压测至最大频率。
本文对此简单介绍。
结论
首先汇总出将CPU压测至最大频率的结论:
1、UEFI下不可将pstate禁用,最好设置为由硬件管理,比如:Autonomous
2、UEFI下不可将cstate禁用,禁用cstate将强制所有cpu核心运行在c1状态下,对于机器整体而言性能会提升,
但对于某个单独进程而言(一个进程仅使用一个cpu),相反会影响性能,见如下redhat的说明:
- Do not lock cpu to C0 state or POLL state which is equivalent to
idle=poll
. Locking all CPUs to C0 has negative consequences, such as higher power consumption and increased generation of heat, among others. Locking all CPUs to C0 might void CPU warranty. Please check with the respective hardware vendor. - Depending on the situation, locking your cpu into C0 might actually decrease performance. Imagine a single threaded program, maxing out a single cpu core. Without lock to C0, many cpus dies have a thermal budget, and with the single core under load while the other cores mostly idle, that single core can run at a higher frequency (boost). With all cores locked on C0, the thermal budged is not allowing that, so the single core where the process is running is not running with higher speed, leading to decreased performance. More details are in kbase Why Intel Turbo Boost Technology does not achieve maximum turbo frequencies.
3、CPU的最大睿频频率为Intel CPU所能达到的最大单核频率,注意为单核,所以如果压测所有CPU,将达不到目的。
通常压测所有CPU不会将CPU运行至最大睿频频率,如下为Intel对此的说明:
测试结果
测试的CPU型号
Intel(R) Xeon(R) Gold 6130T CPU @ 2.10GHz
Intel对于此CPU的链接说明:https://www.intel.cn/content/www/cn/zh/products/sku/123545/intel-xeon-gold-6130t-processor-22m-cache-2-10-ghz/specifications.html
该CPU最大睿频频率为:3.70 GHz
测试配置一
Processors.TurboMode=Enable
Processors.CPUPstateControl=Autonomous
Processors.CStates=Autonomous
压测一个cpu核心
可看到cpu17频率运行在3696,已经非常接近3.7GHz。
localhost# ./cpuburn -n=1 -u=0
Burning 1 CPUs/cores
压测所有cpu
可看到所有cpu运行在turbo的一个频率2.8GHz,无法运行在最大睿频频率。
localhost# ./cpuburn -u=0
Burning 64 CPUs/cores
测试配置二
Processors.TurboMode=Enable
Processors.CPUPstateControl=None
Processors.CStates=Disable
压测一个cpu核心
当pstate以及cstate禁用后,所有CPU会运行在C1状态,同时所有CPU运行在一个turbo 频率但不会是最大睿频频率。
localhost# ./cpuburn -n 2
Burning 2 CPUs/cores
压测所有cpu。
测试配置三
Processors.TurboMode=Enable
Processors.CPUPstateControl=Legacy
Processors.CStates=Disable
压测一个cpu核心
当pstate设置为Legacy时,CPU的频率由OS进行控制,而非UEFI。
压测所有cpu核心。
测试配置四
Processors.TurboMode=Enable
Processors.CPUPstateControl=Legacy
Processors.CStates=Autonomous
同时在UEFI中限制CPU为一个核心,如下:
压测cpu
可以看到cpu运行了最大的频率3700MHz。