~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/cpufreq/special-tests.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 #
  4 # Special test cases reported by people
  5 
  6 # Testcase 1: Reported here: http://marc.info/?l=linux-pm&m=140618592709858&w=2
  7 
  8 # protect against multiple inclusion
  9 if [ $FILE_SPECIAL ]; then
 10         return 0
 11 else
 12         FILE_SPECIAL=DONE
 13 fi
 14 
 15 source cpu.sh
 16 source cpufreq.sh
 17 source governor.sh
 18 
 19 # Test 1
 20 # $1: policy
 21 __simple_lockdep()
 22 {
 23         # switch to ondemand
 24         __switch_governor $1 "ondemand"
 25 
 26         # cat ondemand files
 27         local ondir=$(find_gov_directory $1 "ondemand")
 28         if [ -z $ondir ]; then
 29                 printf "${FUNCNAME[0]}Ondemand directory not created, quit"
 30                 return
 31         fi
 32 
 33         cat $ondir/*
 34 
 35         # switch to conservative
 36         __switch_governor $1 "conservative"
 37 }
 38 
 39 simple_lockdep()
 40 {
 41         printf "** Test: Running ${FUNCNAME[0]} **\n"
 42 
 43         for_each_policy __simple_lockdep
 44 }
 45 
 46 # Test 2
 47 # $1: policy
 48 __concurrent_lockdep()
 49 {
 50         for i in `seq 0 100`; do
 51                 __simple_lockdep $1
 52         done
 53 }
 54 
 55 concurrent_lockdep()
 56 {
 57         printf "** Test: Running ${FUNCNAME[0]} **\n"
 58 
 59         for_each_policy_concurrent __concurrent_lockdep
 60 }
 61 
 62 # Test 3
 63 quick_shuffle()
 64 {
 65         # this is called concurrently from governor_race
 66         for I in `seq 1000`
 67         do
 68                 echo ondemand | sudo tee $CPUFREQROOT/policy*/scaling_governor &
 69                 echo userspace | sudo tee $CPUFREQROOT/policy*/scaling_governor &
 70         done
 71 }
 72 
 73 governor_race()
 74 {
 75         printf "** Test: Running ${FUNCNAME[0]} **\n"
 76 
 77         # run 8 concurrent instances
 78         for I in `seq 8`
 79         do
 80                 quick_shuffle &
 81         done
 82 }
 83 
 84 # Test 4
 85 # $1: cpu
 86 hotplug_with_updates_cpu()
 87 {
 88         local filepath="$CPUROOT/$1/cpufreq"
 89 
 90         # switch to ondemand
 91         __switch_governor_for_cpu $1 "ondemand"
 92 
 93         for i in `seq 1 5000`
 94         do
 95                 reboot_cpu $1
 96         done &
 97 
 98         local freqs=$(cat $filepath/scaling_available_frequencies)
 99         local oldfreq=$(cat $filepath/scaling_min_freq)
100 
101         for j in `seq 1 5000`
102         do
103                 # Set all frequencies one-by-one
104                 for freq in $freqs; do
105                         echo $freq > $filepath/scaling_min_freq
106                 done
107         done
108 
109         # restore old freq
110         echo $oldfreq > $filepath/scaling_min_freq
111 }
112 
113 hotplug_with_updates()
114 {
115         for_each_non_boot_cpu hotplug_with_updates_cpu
116 }

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php