How to find the CPU freq with freq scaling disabled in the kernel

Hi,

I have disabled CPU freq scaling in the Linux kernel due to some work I am doing on the Jetson AGX Xavier. My questions are

  1. What will be the max cpu freq? WIll it be 2.1GHz or something different?

  2. Since the cpu freq scaling is disabled, all the cpu freq related info in procfs is not available. Is there a way to get the current cpu freq? Either by reading some register values etc.

Any comments will be very helpful.

Thanks
Anup

hello anup.pemmaiah,

how about read it by tegrastats?
please check developer guide, tegrastats Utility for details.
thanks

Hello Jerry,

Thank you for pointing it out. I tried and it does not print the CPU freq

$ tegrastats
RAM 2767/15676MB (lfb 21x4MB) SWAP 0/7838MB (cached 0MB) CPU [0%,0%,0%,0%,0%,0%,0%,0%] EMC_FREQ 0% GR3D_FREQ 0% AO@45.5C GPU@45.5C Tboard@45C Tdiode@48.25C AUX@45C CPU@45.5C thermal@45C PMIC@100C GPU 0/0 CPU 466/466 SOC 2800/2800 CV 0/0 VDDRQ 155/155 SYS5V 2440/2440
RAM 2767/15676MB (lfb 21x4MB) SWAP 0/7838MB (cached 0MB) CPU [0%,0%,0%,0%,0%,0%,0%,0%] EMC_FREQ 0% GR3D_FREQ 0% AO@46C GPU@45.5C Tboard@45C Tdiode@48.25C AUX@45C CPU@45.5C thermal@45.3C PMIC@100C GPU 0/0 CPU 466/466 SOC 2800/2800 CV 0/0 VDDRQ 155/155 SYS5V 2440/2440

OR

under load, I see CPU load statistics percentage but not cpu freq

RAM 2836/15676MB (lfb 19x4MB) SWAP 0/7838MB (cached 0MB) CPU [3%,3%,3%,2%,2%,2%,7%,14%] EMC_FREQ 0% GR3D_FREQ 0% AO@46.5C GPU@46C Tboard@46C Tdiode@48.75C AUX@45.5C CPU@46.5C thermal@46.1C PMIC@100C GPU 0/0 CPU 777/777 SOC 2800/2800 CV 0/0 VDDRQ 155/155 SYS5V 2480/2480
RAM 2836/15676MB (lfb 19x4MB) SWAP 0/7838MB (cached 0MB) CPU [3%,4%,2%,3%,3%,3%,11%,12%] EMC_FREQ 0% GR3D_FREQ 0% AO@46.5C GPU@46.5C Tboard@46C Tdiode@49C AUX@46C CPU@46.5C thermal@45.8C PMIC@100C GPU 0/0 CPU 777/777 SOC 2800/2800 CV 0/0 VDDRQ 155/155 SYS5V 2440/2460

Anup

hello anup.pemmaiah,

please tried to read the system node for CPU frequency directly,
for example,

sudo -i
cat /sys/kernel/debug/tegra_cpufreq/cpu0/freq

Hi Jerry,

There is no dir /sys/kernel/debug/tegra_cpufreq/. I assume it does not get populated if I disabled CPU freq scaling.

Anup

Can you tell how have to disabled in kernel?
You can disable scaling by just setting the governor as performance.
Currently its schedutil.
Governor will also get set to performance if you run jetson_clocks application

cat /sys/devices/system/cpu/cpu<0…7>/cpufreq/cpuinfo_cur_freq

or through CPU cluster clocks in BPMP
cat /sys/kernel/debug/bpmp/debug/clk/nafll_cluster<0…3>>/rate
above can be volatile.

Hi bbasu

I disabled the cpu frequency scaling in the kernel menuconfig as follows

Arrow keys navigate the menu. selects submenus —> (or empty submenus ----). Highlighted │
│ letters are hotkeys. Pressing includes, excludes, modularizes features. Press │
│ to exit, <?> for Help, </> for Search. Legend: [*] built-in excluded module │
│ < > module capable │
│ ┌────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ CPU Frequency scaling

On my system I see the following

cat /sys/kernel/debug/bpmp/debug/clk/nafll_cluster0/rate

998400000

Does this mean, the cpu’s are running at around 998MHz? The Jestson AGX Xavier cpu’s should be at 2.1GHz. Just curious if I disable cpu freq scaling, why are the CPU’s at 998MHz?

Thanks
Anup

Because 998Mhz is cpu not frequency set by bootloader. After that, since there is no cpuscaling by kernel, it remains there. As I said earlier, just keep performance governor enabled. You will see 2.1

We are doing sensitive real time work, and do not want the CPU freq changing once the system is up and that is the reason we disable CPU freq scaling. If I set to performance governor, it will scale to max freq for sure, but it will also vary between max and min freq based on the work load and the policy. One way to mitigate this might be to set max and min freq the same. Do you have any other suggestions to get max performance without freq changing or speed stepping?

Thanks
Anup

This assumption is not correct. Cpu Freq will be at max. Can you give some data that is changing?
You can also achieve by using userspace governor.

I enabled performance governor. Now, I have the following three values cur_freq, max_freq and min_freq

$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
2265000

$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
2265600

$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
115200

I have the following questions

  1. Is Nvidia guaranteeing its customers that when performance governor is selected, the CPU will always be at max_freq and never goes to the min_freq under any circumstances?

  2. If the answer to my first question is NO, would like to know under what circumstances will the freq change when performance governor is selected.

Thanks
Anup

  1. Yes. That’s the generic performance governer behaviour

Thank you for the confirmation.