linux - permision denied when change gpu clock rate in TX1 -
i have nvidia tx1 development kit i've installed ubuntu 16.04 using jetpack-l4t-3.1-linux-x64.run (in full installation mode) on it. installation procedure based on following link: " http://docs.nvidia.com/jetpack-l4t/2_1/content/developertools/mobile/jetpack/jetpack_l4t/2.0/jetpack_l4t_install.htm "
i wanted test gpu performance our application since clock set minimum value 76800000 hz. can't enough performance out of it. i've read in link: " changing gpu clock rate on linux system (nvidia jetson tx1) " change value of gpu clock rate, permission denied happens linux! there hope changing clock speed of gpu on board ?
it worth mentioning instead of having path changing clock rate /sys/kernel/debug/clock/override.gbus/rate have path: /sys/kernel/debug/clk/override.gbus/clk_rate
so can see don't have clock folder or rate file ! can see different options gpu clock rate in file: /sys/kernel/debug/clk/gbus/clk_possible_rates
thanks
the solution should not in path changing clock.
just run following bash file sudo.
#!/bin/bash # copyright (c) 2015-2017, nvidia corporation. rights reserved. # # redistribution , use in source , binary forms, or without # modification, permitted provided following conditions # met: # * redistributions of source code must retain above copyright # notice, list of conditions , following disclaimer. # * redistributions in binary form must reproduce above copyright # notice, list of conditions , following disclaimer in # documentation and/or other materials provided distribution. # * neither name of nvidia corporation nor names of # contributors may used endorse or promote products derived # software without specific prior written permission. # # software provided copyright holders ``as is'' , # express or implied warranties, including, not limited to, # implied warranties of merchantability , fitness particular # purpose disclaimed. in no event shall copyright owner or # contributors liable direct, indirect, incidental, special, # exemplary, or consequential damages (including, not limited to, # procurement of substitute goods or services; loss of use, data, or # profits; or business interruption) caused , on theory # of liability, whether in contract, strict liability, or tort # (including negligence or otherwise) arising in way out of use # of software, if advised of possibility of such damage. conf_file=${home}/l4t_dfs.conf red='\e[0;31m' green='\e[0;32m' blue='\e[0;34m' bred='\e[1;31m' bgreen='\e[1;32m' bblue='\e[1;34m' nc='\e[0m' # no color usage() { if [ "$1" != "" ]; echo -e ${red}"$1"${nc} fi cat >& 2 <<eof maximize jetson performance setting static max frequency cpu, gpu , emc clocks. usage: jetson_clocks.sh [options] options, --show display current settings --store [file] store current settings file (default: \${home}/l4t_dfs.conf) --restore [file] restore saved settings file (default: \${home}/l4t_dfs.conf) run jetson_clocks.sh without option set static max frequency cpu, gpu , emc clocks. eof exit 0 } restore() { conf in `cat "${conf_file}"`; file=`echo $conf | cut -f1 -d :` data=`echo $conf | cut -f2 -d :` case "${file}" in /sys/devices/system/cpu/cpu*/online |\ /sys/kernel/debug/clk/override*/state) if [ `cat $file` -ne $data ]; echo "${data}" > "${file}" fi ;; /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq |\ /sys/kernel/debug/tegra_cpufreq/*_cluster/cc3/enable) echo "${data}" > "${file}" 2>/dev/null ;; *) echo "${data}" > "${file}" ret=$? if [ ${ret} -ne 0 ]; echo "error: failed restore $file" fi ;; esac done } store() { file in $@; if [ -e "${file}" ]; echo "${file}:`cat ${file}`" >> "${conf_file}" fi done } do_fan() { # jetson-tk1 cpu fan on. if [ "${machine}" = "jetson-tk1" ] ; return fi if [ ! -w /sys/kernel/debug/tegra_fan/target_pwm ]; echo "can't access fan!" return fi case "${action}" in show) echo "fan: speed=`cat /sys/kernel/debug/tegra_fan/target_pwm`" ;; store) store "/sys/kernel/debug/tegra_fan/target_pwm" ;; *) fan_speed=255 echo "${fan_speed}" > /sys/kernel/debug/tegra_fan/target_pwm ;; esac } do_clusterswitch() { case "${action}" in show) if [ -d "/sys/kernel/cluster" ]; active_cluster=`cat /sys/kernel/cluster/active` echo "cpu cluster switching: active cluster ${active_cluster}" else echo "cpu cluster switching: disabled" fi ;; store) if [ -d "/sys/kernel/cluster" ]; store "/sys/kernel/cluster/immediate" store "/sys/kernel/cluster/force" store "/sys/kernel/cluster/active" fi ;; *) if [ -d "/sys/kernel/cluster" ]; echo 1 > /sys/kernel/cluster/immediate echo 0 > /sys/kernel/cluster/force echo g > /sys/kernel/cluster/active fi ;; esac } do_hotplug() { case "${action}" in show) echo "online cpus: `cat /sys/devices/system/cpu/online`" ;; store) file in /sys/devices/system/cpu/cpu[0-9]/online; store "${file}" done ;; *) if [ "${socfamily}" != "tegra186" ]; file in /sys/devices/system/cpu/cpu*/online; if [ `cat $file` -eq 0 ]; echo 1 > "${file}" fi done fi esac } do_cpu() { freq_governor="cpufreq/scaling_governor" cpu_min_freq="cpufreq/scaling_min_freq" cpu_max_freq="cpufreq/scaling_max_freq" cpu_cur_freq="cpufreq/scaling_cur_freq" cpu_set_speed="cpufreq/scaling_setspeed" interactive_settings="/sys/devices/system/cpu/cpufreq/interactive" schedutil_settings="/sys/devices/system/cpu/cpufreq/schedutil" case "${action}" in show) folder in /sys/devices/system/cpu/cpu[0-9]; cpu=`basename ${folder}` if [ -e "${folder}/${freq_governor}" ]; echo "$cpu: gonvernor=`cat ${folder}/${freq_governor}`" \ "minfreq=`cat ${folder}/${cpu_min_freq}`" \ "maxfreq=`cat ${folder}/${cpu_max_freq}`" \ "currentfreq=`cat ${folder}/${cpu_cur_freq}`" fi done ;; store) store "/sys/module/qos/parameters/enable" file in \ /sys/devices/system/cpu/cpu[0-9]/cpufreq/scaling_min_freq; store "${file}" done if [ "${socfamily}" = "tegra186" ]; store "/sys/kernel/debug/tegra_cpufreq/m_cluster/cc3/enable" store "/sys/kernel/debug/tegra_cpufreq/b_cluster/cc3/enable" fi ;; *) echo 0 > /sys/module/qos/parameters/enable if [ "${socfamily}" = "tegra186" ]; echo 0 > /sys/kernel/debug/tegra_cpufreq/m_cluster/cc3/enable 2>/dev/null echo 0 > /sys/kernel/debug/tegra_cpufreq/b_cluster/cc3/enable 2>/dev/null fi folder in /sys/devices/system/cpu/cpu[0-9]; cat "${folder}/${cpu_max_freq}" > "${folder}/${cpu_min_freq}" 2>/dev/null done ;; esac } do_gpu() { case "${socfamily}" in tegra186) gpu_min_freq="/sys/devices/17000000.gp10b/devfreq/17000000.gp10b/min_freq" gpu_max_freq="/sys/devices/17000000.gp10b/devfreq/17000000.gp10b/max_freq" gpu_cur_freq="/sys/devices/17000000.gp10b/devfreq/17000000.gp10b/cur_freq" gpu_rail_gate="/sys/devices/17000000.gp10b/railgate_enable" ;; tegra210) gpu_min_freq="/sys/devices/57000000.gpu/devfreq/57000000.gpu/min_freq" gpu_max_freq="/sys/devices/57000000.gpu/devfreq/57000000.gpu/max_freq" gpu_cur_freq="/sys/devices/57000000.gpu/devfreq/57000000.gpu/cur_freq" gpu_rail_gate="/sys/devices/57000000.gpu/railgate_enable" ;; *) echo "error! unsupported soc ${socfamily}" exit 1; ;; esac case "${action}" in show) echo "gpu minfreq=`cat ${gpu_min_freq}`" \ "maxfreq=`cat ${gpu_max_freq}`" \ "currentfreq=`cat ${gpu_cur_freq}`" ;; store) store "${gpu_min_freq}" store "${gpu_rail_gate}" ;; *) echo 0 > "${gpu_rail_gate}" cat "${gpu_max_freq}" > "${gpu_min_freq}" ret=$? if [ ${ret} -ne 0 ]; echo "error: failed max gpu frequency!" fi ;; esac } do_emc() { case "${socfamily}" in tegra186) emc_iso_cap="/sys/kernel/nvpmodel_emc_cap/emc_iso_cap" emc_min_freq="/sys/kernel/debug/bpmp/debug/clk/emc/min_rate" emc_max_freq="/sys/kernel/debug/bpmp/debug/clk/emc/max_rate" emc_cur_freq="/sys/kernel/debug/clk/emc/clk_rate" emc_update_freq="/sys/kernel/debug/bpmp/debug/clk/emc/rate" emc_freq_override="/sys/kernel/debug/bpmp/debug/clk/emc/mrq_rate_locked" ;; tegra210) emc_min_freq="/sys/kernel/debug/tegra_bwmgr/emc_min_rate" emc_max_freq="/sys/kernel/debug/tegra_bwmgr/emc_max_rate" emc_cur_freq="/sys/kernel/debug/clk/override.emc/clk_rate" emc_update_freq="/sys/kernel/debug/clk/override.emc/clk_update_rate" emc_freq_override="/sys/kernel/debug/clk/override.emc/clk_state" ;; *) echo "error! unsupported soc ${socfamily}" exit 1; ;; esac case "${action}" in show) echo "emc minfreq=`cat ${emc_min_freq}`" \ "maxfreq=`cat ${emc_max_freq}`" \ "currentfreq=`cat ${emc_cur_freq}`" \ "freqoverride=`cat ${emc_freq_override}`" ;; store) store "${emc_freq_override}" ;; *) if [ "${socfamily}" = "tegra186" ]; emc_cap=`cat "${emc_iso_cap}"` if [ "$emc_cap" -eq 0 ]; cat "${emc_max_freq}" > "${emc_update_freq}" else echo "$emc_cap" > "${emc_update_freq}" fi else cat "${emc_max_freq}" > "${emc_update_freq}" fi echo 1 > "${emc_freq_override}" ;; esac } main () { while [ -n "$1" ]; case "$1" in --show) echo "soc family:${socfamily} machine:${machine}" action=show ;; --store) [ -n "$2" ] && conf_file=$2 action=store shift 1 ;; --restore) [ -n "$2" ] && conf_file=$2 action=restore shift 1 ;; -h|--help) usage exit 0 ;; *) usage "unknown option: $1" exit 1 ;; esac shift 1 done [ `whoami` != root ] && \ echo error: run script\($0\) root user && exit 1 case $action in store) if [ -e "${conf_file}" ]; echo "file $conf_file exists. can overwrite it? y/n:" read answer case $answer in y|y) rm -f $conf_file ;; *) echo "error: file $conf_file exists!" exit 1 ;; esac fi ;; restore) if [ ! -e "${conf_file}" ]; echo "error: $conf_file file not found !" exit 1 fi restore exit 0 ;; esac do_hotplug do_clusterswitch do_cpu do_gpu do_emc # do_fan } if [ -e "/sys/devices/soc0/family" ]; socfamily="`cat /sys/devices/soc0/family`" if [ -e "/sys/devices/soc0/machine" ]; machine=`cat /sys/devices/soc0/machine` fi elif [ -e "/proc/device-tree/compatible" ]; grep "nvidia,tegra210" /proc/device-tree/compatible &>/dev/null if [ $? -eq 0 ]; socfamily="tegra210" else grep "nvidia,tegra186" /proc/device-tree/compatible &>/dev/null if [ $? -eq 0 ]; socfamily="tegra186" fi fi if [ -e "/proc/device-tree/model" ]; machine="`cat /proc/device-tree/model`" fi fi main $@ exit 0
Comments
Post a Comment