TX2 minimum CPU and GPU frequency

Hi,
I am trying to use the API that Jetson has provided to control the CPU and GPU frequency of TX2 to work at a static frequency.
$ sudo echo <cpu_freq> > /sys/devices/system/cpu/cpu/cpufreq/scaling_min_freq

$ sudo echo <cpu_freq> > /sys/devices/system/cpu/cpu/cpufreq/scaling_max_freq

$ sudo echo <gpu_freq> > /sys/devices/17000000.gp10b/devfreq/17000000.gp10b/min_freq

$ sudo echo <gpu_freq> > /sys/devices/17000000.gp10b/devfreq/17000000.gp10b/max_freq

However, when I tested it, the CPU and GPU frequency seems cannot be set to all arbitrary values. For example, I can find a lot of material related to the maximum CPU and GPU frequency, but there’s no too much information related to the minimum CPU and GPU frequency. I see this question and know that the minimum GPU frequency is 114MHZ.
https://forums.developer.nvidia.com/t/what-is-the-minimum-gpus-clock-frequency-for-all-the-nvpmodel-modes/157934
Is that the real minimum value we can set through the API that I showed before?

Also, I tried to set the CPU frequency by myself and found the minimum value I can get is 345600 kHz
And after I set the CPU frequency to a static value and check the results using ‘nvpmodel -q --verbose’, I found that the maximum CPU frequency is not always what I have set. For example, if I try to set both the minimum and maximum value to be 500000KHz, I got the minimum frequency = 500000KHz, but the maximum frequency is 652800KHz.

One more thing is that if we try to change the static frequency to another static value, the order is important.
For example: if I try to increase the GPU frequency from 1000MHz to 1200MHz, then I need to increase the maximum frequency first and then the minimum frequency.
If I try to decrease the GPU frequency from 1200MHz to 1000MHz, then I need to decrease the minimum frequency first and then the maximum frequency.
Is this normal and we need to handle the order by ourselves?

The last point: Currently I have to use sudo to change the CPU&GPU frequency, is it possible that we get rid of sudo privilege?

Looking forward to your reply!

Thanks

hello pengchengwang92 ,

may I know what’s the use-case to configure both CPU’s minimum and maximum frequency as the same value?

may I also know what’s the use-case?
it would be safe to keep sudo privilege for changing CPU&GPU frequencies.

For the first question, I would like to let the CPU and GPU module works at a static value, so I can figure out the relationship between CPU&GPU frequency VS My application latency.
For the second one, it is similar, I hope to integrate the API to change the CPU&GPU frequency in my own application, but I don’t want my application to run in “sudo” environment.

hello pengchengwang92,

how about enable jetson_clocks to configure it as maximum CPU and GPU clocks for evaluation.
may I know what’s the background of your application to change CPU&GPU frequency, how about tweak the scheduling priority of processes by nice, and renice commands.
thanks

Thanks for the information!
But I would like to config CPU&GPU to work at different levels of frequency and then measure the latency of my own application.
After I know the relationship between CPU&GPU frequency VS My application latency. I would like to design a simple scheduler to change the CPU&GPU frequency according to my application’s latency requirement.
And actually, I don’t need to change the priority of processes.

Thanks

set the cpufreq governor for cpu0 and cpu1 as userspace
echo userspace > cpu0/cpufreq//scaling_governor
echo userspace > cpu1/cpufreq//scaling_governor

set the min and max scaling freq as same what you want to set
read back the cpufreq using
cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq

this node measures cpu freq using ptm counter. the numbers will vary but not in the range of hundreds of hz

paste your output. if its not working
also you can see the script jetson_clocks to check the nodes
you can run tegrastats to see the freq at one place