Checking c-states in in truenas

aerospyke

Dabbler
Joined
Sep 2, 2021
Messages
25
Hi all,

Anyone know what tools are available to us in truenas scale to check and tweak power based on c-states? I know of others but can't (shouldn't) install apps in truenas shell so wondering what we can use?
 

HoneyBadger

actually does care
Administrator
Moderator
iXsystems
Joined
Feb 6, 2014
Messages
5,112
I believe turbostat from an SSH session should give you the information you're after:

Code:
Package CPU     TSC_MHz IRQ     SMI     POLL    C1      POLL%   C1%     CPU%c1  CPU%c3  CPU%c6  CPU%c7  PkgWatt CorWatt GFXWatt
-       -       3294    9887    0       0       7085    0.00    87.72   100.00  0.00    0.00    0.00    3109985367938970624.00  1457882615222519296.00  2383903944673861120.00
0       0       3292    5086    0       0       3543    0.00    88.06   100.00  0.00    0.00    0.00    2960990168530026496.00  692405858633057664.00   1689646052226406144.00
2       1       3292    4801    0       0       3542    0.00    87.32   100.00  0.00    0.00    0.00    146694045092146496.00   764943758416345472.00   692949033009128320.00


What sort of "tweaks" are you looking to enact here? Power savings generally result from component selection.
 

aerospyke

Dabbler
Joined
Sep 2, 2021
Messages
25
I believe turbostat from an SSH session should give you the information you're after:

Code:
Package CPU     TSC_MHz IRQ     SMI     POLL    C1      POLL%   C1%     CPU%c1  CPU%c3  CPU%c6  CPU%c7  PkgWatt CorWatt GFXWatt
-       -       3294    9887    0       0       7085    0.00    87.72   100.00  0.00    0.00    0.00    3109985367938970624.00  1457882615222519296.00  2383903944673861120.00
0       0       3292    5086    0       0       3543    0.00    88.06   100.00  0.00    0.00    0.00    2960990168530026496.00  692405858633057664.00   1689646052226406144.00
2       1       3292    4801    0       0       3542    0.00    87.32   100.00  0.00    0.00    0.00    146694045092146496.00   764943758416345472.00   692949033009128320.00


What sort of "tweaks" are you looking to enact here? Power savings generally result from component selection.
I don't know, it is more to ensure my component selection is good, I have hte correct BIOS settings etc.

Turbostat isn't installed on my scale machine, that's one of the things I wanted to run but I can't install it.... isn't it HIGHLY discouraged to install anything on these appliances?
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
Try sysctl -a | grep cx_; I don't know if i7z or powertop are included but it's worth a try.
 
Last edited:

aerospyke

Dabbler
Joined
Sep 2, 2021
Messages
25
thanks, turns out I forgot my linux etiquette, i wasn't sudo'ing when running turbostat, so it wasn't finding the command, but sudo turbostat worked. I have 86-95% of all cores in C6, with a minimal number in either C3 of C1E, so not too much more to do from here. Thanks
 

RavenNAS

Dabbler
Joined
Mar 7, 2022
Messages
34
I found this thread insightful, thank you! I'm running a AMD ryzen 5 3600 and the lowest C stat turbostat reports available is C2.... my cores are in that 98% of the time and I'm pulling 20watts. I will have to try to unlock more C states in bios. I heard that using UEFI passes on power control to the OS, anyone hear of that?
 

LarsR

Guru
Joined
Oct 23, 2020
Messages
719
As far as i can remember, ryzen only has These 2 c-states. It's the same for my 3700x... i havent found any bios setting to increase the c-states and i've enabled all Power saving options in my BIOS i could find.
 

mantheman

Cadet
Joined
Jul 9, 2022
Messages
2
I am using i3-6100, is are the C-States enabled? till where is it enabled?

000226.jpg
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
Last edited:

Haldi

Cadet
Joined
Feb 28, 2024
Messages
8
Powertop has better display of CStates
(AMD 5600)
Code:
PowerTOP 2.14     Overview   Idle stats   Frequency stats   Device stats   Tunables   WakeUp


           Pkg(OS)  |            Core(OS) |            CPU(OS) 0   CPU(OS) 6
POLL        0.0%    | POLL        0.0%    | POLL        0.0%    0.0 ms  0.0%    0.0 ms
C1          0.8%    | C1          0.8%    | C1          1.1%    1.1 ms  0.5%    0.4 ms
C2         97.6%    | C2         96.8%    | C2         96.8%    8.7 ms 96.6%    7.4 ms

                    |            Core(OS) |            CPU(OS) 1   CPU(OS) 7
                    | POLL        0.0%    | POLL        0.0%    0.0 ms  0.0%    0.0 ms
                    | C1          0.1%    | C1          0.2%    0.1 ms  0.0%    0.1 ms
                    | C2         98.3%    | C2         99.0%    4.0 ms 97.5%    9.8 ms

                    |            Core(OS) |            CPU(OS) 2   CPU(OS) 8
                    | POLL        0.0%    | POLL        0.0%    0.0 ms  0.0%    0.0 ms
                    | C1          0.8%    | C1          1.1%    0.2 ms  0.4%    1.0 ms
                    | C2         98.5%    | C2         98.0%    4.4 ms 98.9%    4.0 ms

                    |            Core(OS) |            CPU(OS) 3   CPU(OS) 9
                    | POLL        0.1%    | POLL        0.1%    0.0 ms  0.0%    0.0 ms
                    | C1          0.7%    | C1          1.3%    0.6 ms  0.2%    0.1 ms
                    | C2         97.0%    | C2         97.0%    4.0 ms 97.0%    4.9 ms

                    |            Core(OS) |            CPU(OS) 4   CPU(OS) 10
                    | POLL        0.0%    | POLL        0.0%    0.0 ms  0.0%    0.0 ms
                    | C1          1.7%    | C1          1.2%    0.7 ms  2.1%    0.5 ms
                    | C2         96.4%    | C2         98.3%    7.4 ms 94.4%    3.1 ms

                    |            Core(OS) |            CPU(OS) 5   CPU(OS) 11
                    | POLL        0.0%    | POLL        0.0%    0.0 ms  0.0%    0.0 ms
                    | C1          0.6%    | C1          0.0%    0.0 ms  1.3%    0.4 ms
                    | C2         97.5%    | C2         97.3%    7.9 ms 97.6%    2.1 ms



compared to Turbostats.

Code:
root@NAS[~]# turbostat
turbostat version 2022.10.04 - Len Brown <lenb@kernel.org>
Kernel command line: BOOT_IMAGE=/ROOT/24.04-BETA.1@/boot/vmlinuz-6.6.10-production+truenas root=ZFS=boot-pool/ROOT/24.04-BETA.1 ro libata.allow_tpm=1 amd_iommu=on iommu=pt kvm_amd.npt=1 kvm_amd.avic=1 intel_iommu=on zfsforce=1 nvme_core.multipath=N amd_pstate=guided
CPUID(0): AuthenticAMD 0x10 CPUID levels
CPUID(1): family:model:stepping 0x19:21:2 (25:33:2) microcode 0x0
CPUID(0x80000000): max_extended_levels: 0x80000023
CPUID(1): SSE3 MONITOR - - - TSC MSR - HT -
CPUID(6): APERF, No-TURBO, No-DTS, No-PTM, No-HWP, No-HWPnotify, No-HWPwindow, No-HWPepp, No-HWPpkg, No-EPB
CPUID(7): No-SGX No-Hybrid
RAPL: 234 sec. Joule Counter Range, at 280 Watts
/dev/cpu_dma_latency: 2000000000 usec (default)
current_driver: acpi_idle
current_governor: menu
current_governor_ro: menu
cpu0: POLL: CPUIDLE CORE POLL IDLE
cpu0: C1: ACPI FFH MWAIT 0x0
cpu0: C2: ACPI IOPORT 0x414
cpu0: cpufreq driver: amd-pstate
cpu0: cpufreq governor: schedutil
cpufreq boost: 1
cpu0: MSR_RAPL_PWR_UNIT: 0x000a1003 (0.125000 Watts, 0.000015 Joules, 0.000977 sec.)
Core    CPU     Avg_MHz Busy%   Bzy_MHz TSC_MHz IPC     IRQ     POLL    C1      C2      POLL%   C1%     C2%     CorWatt PkgWatt
-       -       30      0.78    3827    3493    0.67    24339   4177    2159    11635   0.02    0.85    98.39   1.40    19.25
0       0       21      0.57    3710    3493    0.56    1362    4       48      828     0.00    0.25    99.21   0.19    19.25
0       6       29      0.72    4015    3493    0.82    1465    335     117     583     0.02    0.89    98.40
1       1       24      0.63    3735    3493    0.67    1729    2       143     1120    0.00    0.63    98.76   0.25
1       7       45      1.13    3954    3493    0.77    2638    282     249     1401    0.02    0.66    98.23
2       2       21      0.55    3817    3493    0.62    1514    242     255     685     0.01    1.87    97.59   0.26
2       8       38      0.99    3804    3493    0.57    3010    691     313     1314    0.06    1.06    97.98
3       3       21      0.56    3708    3493    0.44    1451    0       165     864     0.00    0.72    98.74   0.23
3       9       34      0.90    3755    3493    0.64    2590    680     215     1026    0.04    1.02    98.10
4       4       19      0.51    3830    3493    0.79    1490    325     130     651     0.02    0.71    98.80   0.25
4       10      41      1.09    3730    3493    0.61    3034    391     226     1633    0.02    1.17    97.77
5       5       30      0.72    4109    3493    0.82    743     14      99      420     0.00    0.40    98.89   0.22
5       11      38      1.01    3733    3493    0.70    3313    1211    199     1110    0.07    0.80    98.22


And if you switch to amd-pstate driver (Kernel 6.6 required) instead of acpi you get way more frequency scaling in the same cStates...

 
Top