英特爾(R) 速度精選技術使用者指南

英特爾(R) 速度精選技術 (Intel(R) SST) 提供了一系列強大的新功能,可對 CPU 效能進行更精細的控制。藉助 Intel(R) SST,一個伺服器可以針對各種不同的工作負載要求進行電源和效能配置。

請參閱以下連結,瞭解該技術概述

在一些較新的伺服器平臺中,這些功能得到了進一步增強,可以在無需透過 BIOS 設定選項預配置的情況下動態列舉和控制這些功能。這種動態配置是透過郵箱命令傳送到硬體來完成的。列舉和配置這些功能的一種方法是使用英特爾速度精選工具。

本文件解釋瞭如何使用英特爾速度精選工具來列舉和控制 Intel(R) SST 功能。本文件提供了示例命令,並解釋了這些命令如何改變被測系統的功耗和效能配置檔案。客戶可以以該工具為例,在其生產軟體中複製該工具中實現的訊息傳遞。

intel-speed-select 配置工具

大多數 Linux 發行版軟體包可能包含“intel-speed-select”工具。如果未包含,可以透過從 kernel.org 下載 Linux 核心樹來構建它。下載後,無需構建完整的核心即可構建該工具。

在核心樹中,執行以下命令

# cd tools/power/x86/intel-speed-select/
# make
# make install

獲取幫助

要獲取該工具的幫助,請執行以下命令

# intel-speed-select --help

頂層幫助描述了引數和功能。請注意,該工具具有多級幫助結構。例如,要獲取功能“perf-profile”的幫助

# intel-speed-select perf-profile --help

要獲取命令的幫助,還提供了另一級幫助。例如,對於 info 命令“info”

# intel-speed-select perf-profile info --help

平臺功能摘要

要檢查當前平臺和驅動功能,請執行

#intel-speed-select --info

例如,在一個測試系統上

# intel-speed-select --info
Intel(R) Speed Select Technology
Executing on CPU model: X
Platform: API version : 1
Platform: Driver version : 1
Platform: mbox supported : 1
Platform: mmio supported : 1
Intel(R) SST-PP (feature perf-profile) is supported
TDP level change control is unlocked, max level: 4
Intel(R) SST-TF (feature turbo-freq) is supported
Intel(R) SST-BF (feature base-freq) is not supported
Intel(R) SST-CP (feature core-power) is supported

英特爾(R) 速度精選技術 - 效能配置檔案 (Intel(R) SST-PP)

此功能允許根據工作負載效能要求動態配置伺服器。這有助於使用者在部署過程中不必靜態選擇特定的伺服器配置。此英特爾(R) 速度精選技術 - 效能配置檔案 (Intel(R) SST-PP) 功能引入了一種機制,允許每個系統擁有多個最佳化效能配置檔案。每個配置檔案定義了一組需要線上的 CPU,而其餘 CPU 則離線,以維持一個保證的基頻。一旦使用者發出命令使用特定的效能配置檔案並滿足 CPU 線上/離線要求,使用者就可以期望基頻動態地發生變化。使用英特爾速度精選工具時,此功能稱為“perf-profile”。

效能級別數量

一個系統上可以有多個性能配置檔案。要獲取配置檔案數量,請執行以下命令

# intel-speed-select perf-profile get-config-levels
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
       get-config-levels:4
package-1
 die-0
   cpu-14
       get-config-levels:4

在此被測系統上,除了基本效能配置檔案(即效能級別 0)之外,還有 4 個性能配置檔案。

鎖定/解鎖狀態

即使存在多個性能配置檔案,它們也可能被鎖定。如果它們被鎖定,使用者將無法發出命令更改效能狀態。可能存在 BIOS 設定來解鎖或諮詢您的系統供應商。

要檢查系統是否被鎖定,請執行以下命令

# intel-speed-select perf-profile get-lock-status
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
       get-lock-status:0
package-1
 die-0
   cpu-14
       get-lock-status:0

在這種情況下,鎖定狀態為 0,這意味著系統已解鎖。

效能級別的屬性

要獲取特定效能級別的屬性(例如,以下級別 0 的屬性),請執行以下命令

# intel-speed-select perf-profile info -l 0
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     perf-profile-level-0
       cpu-count:28
       enable-cpu-mask:000003ff,f0003fff
       enable-cpu-list:0,1,2,3,4,5,6,7,8,9,10,11,12,13,28,29,30,31,32,33,34,35,36,37,38,39,40,41
       thermal-design-power-ratio:26
       base-frequency(MHz):2600
       speed-select-turbo-freq:disabled
       speed-select-base-freq:disabled
       ...
       ...

此處使用 -l 選項指定效能級別。

如果省略 -l 選項,則此命令將列印所有效能級別的資訊。上述命令正在列印效能級別 0 的屬性。

對於此效能配置檔案,透過“enable-cpu-mask/enable-cpu-list”顯示的最大 CPU 列表可以是“線上”。當滿足該條件時,可以維持 2600 MHz 的基頻。要了解更多資訊,請執行“intel-speed-select perf-profile info”以獲取效能級別 4 的資訊

# intel-speed-select perf-profile info -l 4
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     perf-profile-level-4
       cpu-count:28
       enable-cpu-mask:000000fa,f0000faf
       enable-cpu-list:0,1,2,3,5,7,8,9,10,11,28,29,30,31,33,35,36,37,38,39
       thermal-design-power-ratio:28
       base-frequency(MHz):2800
       speed-select-turbo-freq:disabled
       speed-select-base-freq:unsupported
       ...
       ...

“enable-cpu-mask/enable-cpu-list”中的 CPU 數量較少。因此,如果使用者只保持這些 CPU 線上,其餘 CPU“離線”,則基頻將從效能級別 0 的 2.6 GHz 增加到 2.8 GHz。

獲取當前效能級別

要獲取當前效能級別,請執行

# intel-speed-select perf-profile get-config-current-level
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
       get-config-current_level:0

首先驗證 cpufreq sysfs 顯示的 base_frequency 是否正確

# cat /sys/devices/system/cpu/cpu0/cpufreq/base_frequency
2600000

這與“perf-profile info”命令為效能級別 0 顯示的 base-frequency (MHz) 欄位值匹配(cpufreq 頻率以 KHz 為單位)。

要檢查平均頻率是否等於 100% 繁忙工作負載的基頻,請停用睿頻加速

# echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo

然後在所有 CPU 上執行繁忙工作負載,例如

#stress -c 64

要驗證基頻,請執行 turbostat

#turbostat -c 0-13 --show Package,Core,CPU,Bzy_MHz -i 1

 Package       Core    CPU     Bzy_MHz
               -       -       2600
 0             0       0       2600
 0             1       1       2600
 0             2       2       2600
 0             3       3       2600
 0             4       4       2600
 .             .       .       .

更改效能級別

要將效能級別更改為 4,請執行

# intel-speed-select -d perf-profile set-config-level -l 4 -o
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     perf-profile
       set_tdp_level:success

在上述命令中,“-o”是可選的。如果指定,它還將使不在此效能級別 enable_cpu_mask 中的 CPU 離線。

現在如果檢查 base_frequency

#cat /sys/devices/system/cpu/cpu0/cpufreq/base_frequency
2800000

這表明基頻已從效能級別 0 的 2600 MHz 增加到效能級別 4 的 2800 MHz。因此,任何可以使用較少 CPU 的工作負載,與效能級別 0 相比,都可以看到 200 MHz 的提升。

透過 BMC 介面更改效能級別

可以使用帶外 (OOB) 代理(透過某些遠端管理控制檯,透過 BMC“基板管理控制器”介面)更改 SST-PP 級別。此模式從 Sapphire Rapids 處理器一代開始支援。支援此模式的核心和工具更改已新增到 Linux 核心版本 5.18 中。要啟用此功能,需要核心配置“CONFIG_INTEL_HFI_THERMAL”。支援此功能的工具最低版本為“v1.12”,它是 Linux 核心版本 5.18 的一部分。

為了支援此類配置,此工具可用作守護程式。新增命令列選項 --oob

# intel-speed-select --oob
Intel(R) Speed Select Technology
Executing on CPU model:143[0x8f]
OOB mode is enabled and will run as daemon

在此模式下,工具將根據新的效能級別使 CPU 線上/離線。

檢查是否存在其他 Intel(R) SST 功能

每個效能配置檔案還指定是否支援另外兩個 Intel(R) SST 功能(英特爾(R) 速度精選技術 - 基頻 (Intel(R) SST-BF) 和英特爾(R) 速度精選技術 - 睿頻加速頻率 (Intel SST-TF))。

例如,從上面“perf-profile info”的輸出中,對於級別 0 和級別 4

對於級別 0:

speed-select-turbo-freq:disabled speed-select-base-freq:disabled

對於級別 4:

speed-select-turbo-freq:disabled speed-select-base-freq:unsupported

鑑於這些結果,級別 4 中的“speed-select-base-freq” (Intel(R) SST-BF) 從“disabled”變為“unsupported”,而效能級別 0 則不同。

這意味著在效能級別 4 中,“speed-select-base-freq”功能不受支援。然而,在效能級別 0 中,此功能“受支援”,但當前處於“停用”狀態,這意味著使用者尚未啟用此功能。而“speed-select-turbo-freq” (Intel(R) SST-TF) 在兩個效能級別都受支援,但使用者目前尚未啟用。

Intel(R) SST-BF 和 Intel(R) SST-TF 功能建立在名為英特爾(R) 速度精選技術 - 核心功耗 (Intel(R) SST-CP) 的基礎技術之上。當平臺支援 Intel(R) SST-BF 或 Intel(R) SST-TF 時,平臺韌體會啟用此功能。

英特爾(R) 速度精選技術 - 核心功耗 (Intel(R) SST-CP)

英特爾(R) 速度精選技術 - 核心功耗 (Intel(R) SST-CP) 是一個介面,允許使用者定義每個核心的優先順序。這定義了一種在功耗受限情況下在核心之間分配功耗的機制。這定義了一種服務類別 (CLOS) 配置。

使用者可以配置最多 4 種服務類別配置。每個 CLOS 組配置允許定義引數,這些引數會影響頻率如何受限以及功耗如何分配。每個 CPU 核心可以繫結到一個服務類別,從而具有關聯的優先順序。粒度在核心級別,而不是在每個 CPU 級別。

啟用基於 CLOS 的優先順序劃分

要使用基於 CLOS 的優先順序劃分功能,必須通知韌體啟用並使用優先順序型別。存在一個預設的每平臺優先順序型別,可以透過可選的命令列引數進行更改。

要啟用和檢查選項,請執行

# intel-speed-select core-power enable --help
Intel(R) Speed Select Technology
Executing on CPU model: X
Enable core-power for a package/die
       Clos Enable: Specify priority type with [--priority|-p]
                0: Proportional, 1: Ordered

有兩種優先順序型別

  • 有序

有序節流的優先順序是根據分配的 CLOS 組的索引定義的。其中 CLOS0 獲得最高優先順序(最後節流)。

優先順序順序為:CLOS0 > CLOS1 > CLOS2 > CLOS3。

  • 比例

當使用比例優先順序時,存在一個附加引數 frequency_weight,可以為每個 CLOS 組指定。比例優先順序的目標是為每個核心提供請求的最小值,然後根據定義的權重按比例分配所有剩餘(盈餘/赤字)預算。此比例優先順序可以使用“core-power config”命令進行配置。

要使用平臺預設優先順序型別啟用,請執行

# intel-speed-select core-power enable
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     core-power
       enable:success
package-1
 die-0
   cpu-6
     core-power
       enable:success

此啟用的範圍是每個封裝或當一個封裝包含多個晶片時的晶片範圍。要檢查 CLOS 是否已啟用並獲取優先順序型別,可以使用“core-power info”命令。例如,要檢查 CPU 0 上 core-power 功能的狀態,請執行

# intel-speed-select -c 0 core-power info
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     core-power
       support-status:supported
       enable-status:enabled
       clos-enable-status:enabled
       priority-type:proportional
package-1
 die-0
   cpu-24
     core-power
       support-status:supported
       enable-status:enabled
       clos-enable-status:enabled
       priority-type:proportional

配置 CLOS 組

每個 CLOS 組都有自己的屬性,包括 min、max、freq_weight 和 desired。這些引數可以使用“core-power config”命令進行配置。如果使用者跳過設定除 clos id(強制)之外的引數,則將使用預設值。要檢查 core-power 配置選項,請執行

# intel-speed-select core-power config --help
Intel(R) Speed Select Technology
Executing on CPU model: X
Set core-power configuration for one of the four clos ids
       Specify targeted clos id with [--clos|-c]
       Specify clos Proportional Priority [--weight|-w]
       Specify clos min in MHz with [--min|-n]
       Specify clos max in MHz with [--max|-m]

例如

# intel-speed-select core-power config -c 0
Intel(R) Speed Select Technology
Executing on CPU model: X
clos epp is not specified, default: 0
clos frequency weight is not specified, default: 0
clos min is not specified, default: 0 MHz
clos max is not specified, default: 25500 MHz
clos desired is not specified, default: 0
package-0
 die-0
   cpu-0
     core-power
       config:success
package-1
 die-0
   cpu-6
     core-power
       config:success

使用者可以選擇更改預設值。例如,使用者可以更改“min”並設定基頻以始終獲得保證的基頻。

獲取當前 CLOS 配置

要檢查當前配置,可以使用“core-power get-config”。例如,要獲取 CLOS 0 的配置

# intel-speed-select core-power get-config -c 0
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     core-power
       clos:0
       epp:0
       clos-proportional-priority:0
       clos-min:0 MHz
       clos-max:Max Turbo frequency
       clos-desired:0 MHz
package-1
 die-0
   cpu-24
     core-power
       clos:0
       epp:0
       clos-proportional-priority:0
       clos-min:0 MHz
       clos-max:Max Turbo frequency
       clos-desired:0 MHz

將 CPU 與 CLOS 組關聯

要將 CPU 與 CLOS 組關聯,可以使用“core-power assoc”命令

# intel-speed-select core-power assoc --help
Intel(R) Speed Select Technology
Executing on CPU model: X
Associate a clos id to a CPU
       Specify targeted clos id with [--clos|-c]

例如,要將 CPU 10 與 CLOS 組 3 關聯,請執行

# intel-speed-select -c 10 core-power assoc -c 3
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-10
     core-power
       assoc:success

一旦關聯了一個 CPU,其兄弟 CPU 也會與一個 CLOS 組關聯。關聯後,避免更改 Linux “cpufreq”子系統縮放頻率限制。

要檢查 CPU 的現有關聯,可以使用“core-power get-assoc”命令。例如,要獲取 CPU 10 的關聯,請執行

# intel-speed-select -c 10 core-power get-assoc
Intel(R) Speed Select Technology
Executing on CPU model: X
package-1
 die-0
   cpu-10
     get-assoc
       clos:3

這表明 CPU 10 是 CLOS 組 3 的一部分。

停用基於 CLOS 的優先順序劃分

要停用,請執行

# intel-speed-select core-power disable

某些功能(如 Intel(R) SST-TF)只能在啟用基於 CLOS 的優先順序劃分時才能啟用。因此,在 Intel(R) SST-TF 啟用時停用它可能會導致 Intel(R) SST-TF 失敗。如果 Intel(R) SST-TF 已經啟用,這將導致“disable”命令顯示錯誤。反過來,要停用,必須首先停用 Intel(R) SST-TF 功能。

英特爾(R) 速度精選技術 - 基頻 (Intel(R) SST-BF)

英特爾(R) 速度精選技術 - 基頻 (Intel(R) SST-BF) 功能允許使用者控制基頻。如果一些關鍵工作負載執行緒需要持續的高保證效能,那麼可以使用此功能在特定 CPU 集(高優先順序 CPU)上以更高的基頻執行執行緒,而代價是其他 CPU 上的基頻較低(低優先順序 CPU)。此功能不需要低優先順序 CPU 離線。

對 Intel(R) SST-BF 的支援取決於英特爾(R) 速度精選技術 - 效能配置檔案 (Intel(R) SST-PP) 效能級別的配置。可能只有某些效能級別支援 Intel(R) SST-BF。也可能只有基本效能級別(級別 = 0)支援 Intel SST-BF。因此,首先選擇所需的效能級別以啟用此功能。

在此被測系統上,Intel(R) SST-BF 在基本效能級別 0 上受支援,但當前已停用。例如,對於級別 0

# intel-speed-select -c 0 perf-profile info -l 0
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     perf-profile-level-0
       ...

       speed-select-base-freq:disabled
       ...

在啟用 Intel(R) SST-BF 並測量其對工作負載效能的影響之前,請執行一些工作負載並測量效能,以獲取用於比較的基準效能。

在這裡,使用者需要更高的保證效能。因此,很可能停用了睿頻加速。要停用睿頻加速,請執行

#echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo

根據“intel-speed-select perf-profile info -l 0”的輸出,保證頻率的基頻為 2600 MHz。

測量基準效能以進行比較

為了進行比較,選擇一個多執行緒工作負載,其中每個執行緒都可以在單獨的 CPU 上排程。“Hackbench pipe”測試是說明如何使用 Intel(R) SST-BF 提高效能的一個很好的例子。

下面,工作負載正在測量平均排程器喚醒延遲,因此數字越小表示效能越好

# taskset -c 3,4 perf bench -r 100 sched pipe
# Running 'sched/pipe' benchmark:
# Executed 1000000 pipe operations between two processes
    Total time: 6.102 [sec]
      6.102445 usecs/op
        163868 ops/sec

在執行上述測試時,如果我們檢視 turbostat 輸出,它將顯示 2 個 CPU 正在忙碌並達到最大頻率(這將是基頻,因為睿頻加速已停用)。turbostat 輸出

#turbostat -c 0-13 --show Package,Core,CPU,Bzy_MHz -i 1
Package        Core    CPU     Bzy_MHz
0              0       0       1000
0              1       1       1005
0              2       2       1000
0              3       3       2600
0              4       4       2600
0              5       5       1000
0              6       6       1000
0              7       7       1005
0              8       8       1005
0              9       9       1000
0              10      10      1000
0              11      11      995
0              12      12      1000
0              13      13      1000

從上述 turbostat 輸出中,CPU 3 和 4 都非常繁忙,並達到了 2600 MHz 的完全保證頻率。

Intel(R) SST-BF 功能

要獲取當前效能級別 0 的 Intel(R) SST-BF 功能,請執行

# intel-speed-select base-freq info -l 0
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     speed-select-base-freq
       high-priority-base-frequency(MHz):3000
       high-priority-cpu-mask:00000216,00002160
       high-priority-cpu-list:5,6,8,13,33,34,36,41
       low-priority-base-frequency(MHz):2400
       tjunction-temperature(C):125
       thermal-design-power(W):205

上述功能表明,該系統上的一些 CPU 可以提供 3000 MHz 的基頻,而此效能級別下的標準基頻則較低。然而,這些 CPU 是固定的,它們透過 high-priority-cpu-list/high-priority-cpu-mask 呈現。但如果選擇此 Intel(R) SST-BF 功能,則低優先順序 CPU(不在 high-priority-cpu-list 中)只能提供高達 2400 MHz 的頻率。因此,如果可以接受這種低優先順序 CPU 的剪裁,那麼使用者可以啟用 Intel SST-BF 功能,特別是對於上述“sched pipe”工作負載,因為只使用了兩個 CPU,它們可以排程到高優先順序 CPU 上,並獲得 400 MHz 的提升。

啟用 Intel(R) SST-BF

要啟用 Intel(R) SST-BF 功能,請執行

# intel-speed-select base-freq enable -a
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     base-freq
       enable:success
package-1
 die-0
   cpu-14
     base-freq
       enable:success

在這種情況下,-a 選項是可選的。這不僅啟用了 Intel(R) SST-BF,而且還使用英特爾(R) 速度精選技術 - 核心功耗 (Intel(R) SST-CP) 功能調整了核心的優先順序。此選項將每個英特爾(R) 速度精選技術 - 效能配置檔案 (Intel(R) SST-PP) 類的最低效能設定為最高效能,以便硬體為每個 CPU 提供儘可能高的效能。

如果未使用 -a 選項,則在啟用 Intel(R) SST-BF 之前需要執行以下步驟

  • 發現 Intel(R) SST-BF 並記下低優先順序和高優先順序基頻

  • 記下高優先順序 CPU 列表

  • 使用 core-power 功能集啟用 CLOS

  • 配置 CLOS 引數。使用 CLOS.min 設定為最低效能

  • 將所需的 CPU 訂閱到 CLOS 組

在此配置下,如果透過將工作負載固定到高優先順序 CPU(本例中為 CPU 5 和 6)來執行相同的工作負載

#taskset -c 5,6 perf bench -r 100 sched pipe
# Running 'sched/pipe' benchmark:
# Executed 1000000 pipe operations between two processes
    Total time: 5.627 [sec]
      5.627922 usecs/op
        177685 ops/sec

這樣,透過啟用 Intel(R) SST-BF,此基準測試的效能提高了 7.79%(延遲降低)。從 turbostat 輸出可以看出,高優先順序 CPU 達到了 3000 MHz,而 2600 MHz。turbostat 輸出

#turbostat -c 0-13 --show Package,Core,CPU,Bzy_MHz -i 1
Package        Core    CPU     Bzy_MHz
0              0       0       2151
0              1       1       2166
0              2       2       2175
0              3       3       2175
0              4       4       2175
0              5       5       3000
0              6       6       3000
0              7       7       2180
0              8       8       2662
0              9       9       2176
0              10      10      2175
0              11      11      2176
0              12      12      2176
0              13      13      2661

停用 Intel(R) SST-BF

要停用 Intel(R) SST-BF 功能,請執行

# intel-speed-select base-freq disable -a

英特爾(R) 速度精選技術 - 睿頻加速頻率 (Intel(R) SST-TF)

此功能能夠根據優先順序為核心設定不同的“所有核心睿頻加速比限制”。透過使用此功能,可以將一些核心配置為獲得更高的睿頻加速頻率,方法是將其指定為高優先順序,而低優先順序核心則以較低或不帶睿頻加速頻率為代價。

因此,此功能僅在系統忙於利用所有 CPU 但使用者希望獲得在某些 CPU 上獲得高效能的可配置選項時才有用。

對英特爾(R) 速度精選技術 - 睿頻加速頻率 (Intel(R) SST-TF) 的支援取決於英特爾(R) 速度精選技術 - 效能配置檔案 (Intel SST-PP) 效能級別的配置。可能只有某些效能級別支援 Intel(R) SST-TF。也可能只有基本效能級別(級別 = 0)支援 Intel(R) SST-TF。因此,首先選擇所需的效能級別以啟用此功能。

在此被測系統上,Intel(R) SST-TF 在基本效能級別 0 上受支援,但當前已停用

# intel-speed-select -c 0 perf-profile info -l 0
Intel(R) Speed Select Technology
package-0
 die-0
   cpu-0
     perf-profile-level-0
       ...
       ...
       speed-select-turbo-freq:disabled
       ...
       ...

要檢查是否可以使用 Intel(R) SST-TF 功能提高效能,請獲取啟用 Intel(R) SST-TF 後的睿頻加速頻率屬性,並與該系統的基本睿頻加速功能進行比較。

獲取基本睿頻加速功能

要獲取效能級別 0 的基本睿頻加速功能,請執行

# intel-speed-select perf-profile info -l 0
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     perf-profile-level-0
       ...
       ...
       turbo-ratio-limits-sse
         bucket-0
           core-count:2
           max-turbo-frequency(MHz):3200
         bucket-1
           core-count:4
           max-turbo-frequency(MHz):3100
         bucket-2
           core-count:6
           max-turbo-frequency(MHz):3100
         bucket-3
           core-count:8
           max-turbo-frequency(MHz):3100
         bucket-4
           core-count:10
           max-turbo-frequency(MHz):3100
         bucket-5
           core-count:12
           max-turbo-frequency(MHz):3100
         bucket-6
           core-count:14
           max-turbo-frequency(MHz):3100
         bucket-7
           core-count:16
           max-turbo-frequency(MHz):3100

根據上述資料,當所有 CPU 都忙時,可以達到 3100 MHz 的最大頻率。如果 CPU 0 - 11 上有一些繁忙的工作負載(例如 stress),並且 CPU 12 和 13 上,執行“hackbench pipe”工作負載

# taskset -c 12,13 perf bench -r 100 sched pipe
# Running 'sched/pipe' benchmark:
# Executed 1000000 pipe operations between two processes
    Total time: 5.705 [sec]
      5.705488 usecs/op
        175269 ops/sec

turbostat 輸出

#turbostat -c 0-13 --show Package,Core,CPU,Bzy_MHz -i 1
Package        Core    CPU     Bzy_MHz
0              0       0       3000
0              1       1       3000
0              2       2       3000
0              3       3       3000
0              4       4       3000
0              5       5       3100
0              6       6       3100
0              7       7       3000
0              8       8       3100
0              9       9       3000
0              10      10      3000
0              11      11      3000
0              12      12      3100
0              13      13      3100

根據 turbostat 輸出,效能受到 3100 MHz 頻率上限的限制。要檢查 CPU 12 和 CPU 13 的 hackbench 效能是否可以提高,首先檢查此效能級別下 Intel(R) SST-TF 功能的功能。

獲取 Intel(R) SST-TF 功能

要獲取功能,可以使用“turbo-freq info”命令

# intel-speed-select turbo-freq info -l 0
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-0
     speed-select-turbo-freq
         bucket-0
           high-priority-cores-count:2
           high-priority-max-frequency(MHz):3200
           high-priority-max-avx2-frequency(MHz):3200
           high-priority-max-avx512-frequency(MHz):3100
         bucket-1
           high-priority-cores-count:4
           high-priority-max-frequency(MHz):3100
           high-priority-max-avx2-frequency(MHz):3000
           high-priority-max-avx512-frequency(MHz):2900
         bucket-2
           high-priority-cores-count:6
           high-priority-max-frequency(MHz):3100
           high-priority-max-avx2-frequency(MHz):3000
           high-priority-max-avx512-frequency(MHz):2900
         speed-select-turbo-freq-clip-frequencies
           low-priority-max-frequency(MHz):2600
           low-priority-max-avx2-frequency(MHz):2400
           low-priority-max-avx512-frequency(MHz):2100

根據上述輸出,有一個 Intel(R) SST-TF 桶,其中有兩個高優先順序核心。如果只設置兩個高優先順序核心,則這些核心上的最大睿頻加速頻率可以增加到 3200 MHz。這比所有核心的基本睿頻加速功能高出 100 MHz。

反過來,對於 hackbench 工作負載,可以將兩個 CPU 設定為高優先順序,其餘設定為低優先順序。一個副作用是,一旦啟用,低優先順序核心將被限制在 2600 MHz 的較低頻率。

啟用 Intel(R) SST-TF

要啟用 Intel(R) SST-TF,請執行

# intel-speed-select -c 12,13 turbo-freq enable -a
Intel(R) Speed Select Technology
Executing on CPU model: X
package-0
 die-0
   cpu-12
     turbo-freq
       enable:success
package-0
 die-0
   cpu-13
     turbo-freq
       enable:success
package--1
 die-0
   cpu-63
     turbo-freq --auto
       enable:success

在這種情況下,“-a”選項是可選的。如果設定,它會啟用 Intel(R) SST-TF 功能,並使用英特爾速度精選技術 - 核心功耗 (Intel(R) SST-CP) 功能將 CPU 設定為高優先順序和低優先順序。使用“-c”引數傳遞的 CPU 編號被標記為高優先順序,包括其兄弟。

如果未使用 -a 選項,則在啟用 Intel(R) SST-TF 之前需要執行以下步驟

  • 發現 Intel(R) SST-TF 並記下高優先順序核心和最大頻率的桶

  • 使用 core-power 功能集啟用 CLOS - 配置 CLOS 引數

  • 將所需的 CPU 訂閱到 CLOS 組,確保高優先順序核心設定為最大頻率

如果執行相同的 hackbench 工作負載,將 hackbench 執行緒排程到高優先順序 CPU 上

#taskset -c 12,13 perf bench -r 100 sched pipe
# Running 'sched/pipe' benchmark:
# Executed 1000000 pipe operations between two processes
    Total time: 5.510 [sec]
      5.510165 usecs/op
        180826 ops/sec

這在繁忙的系統上將效能提高了約 3.3%。在這裡,turbostat 輸出將顯示 CPU 12 和 CPU 13 獲得了 100 MHz 的提升。turbostat 輸出

#turbostat -c 0-13 --show Package,Core,CPU,Bzy_MHz -i 1
Package        Core    CPU     Bzy_MHz
...
0              12      12      3200
0              13      13      3200