selftest: cpufreq: Add support for cpufreq framework
Subsystems (2)
Viresh Kumar
maintainercover selftest: cpufreq: Add support for cpufreq framework
Hi,
This patchset adds support for cpufreq selftests to the kernel selftest framework. More details can be found on individual patches.
These are all tested after installation of selftests on ARM Dual A15 core Exynos platform.
The content of the output file for the basic tests looks like this:
http://pastebin.com/nBY9AfD5 .
--
viresh
Viresh Kumar (4):
selftest: cpufreq: Add support for cpufreq tests
selftest: cpufreq: Add suspend/resume/hibernate support
selftest: cpufreq: Add support to test cpufreq modules
selftest: cpufreq: Add special tests
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpufreq/Makefile | 8 + tools/testing/selftests/cpufreq/cpu.sh | 84 ++++++++ tools/testing/selftests/cpufreq/cpufreq.sh | 241 ++++++++++++++++++++++ tools/testing/selftests/cpufreq/governor.sh | 153 ++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 194 ++++++++++++++++++ tools/testing/selftests/cpufreq/module.sh | 243 +++++++++++++++++++++++ tools/testing/selftests/cpufreq/special-tests.sh | 115 +++++++++++ 8 files changed, 1039 insertions(+) create mode 100644 tools/testing/selftests/cpufreq/Makefile create mode 100755 tools/testing/selftests/cpufreq/cpu.sh create mode 100755 tools/testing/selftests/cpufreq/cpufreq.sh create mode 100755 tools/testing/selftests/cpufreq/governor.sh create mode 100755 tools/testing/selftests/cpufreq/main.sh create mode 100755 tools/testing/selftests/cpufreq/module.sh create mode 100755 tools/testing/selftests/cpufreq/special-tests.sh
Signature · 1 line
2.7.1.410.g6faf27b
Viresh Kumar
maintainerPATCH 1/4 selftest: cpufreq: Add support for cpufreq tests
This patch adds supports for basic cpufreq tests, which can be performed independent of any platform.
It does basic tests for now, like
- reading all cpufreq files
- trying to update them
- switching frequencies
- switching governors
This can be extended to have more specific tests later on.
--- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpufreq/Makefile | 8 ++ tools/testing/selftests/cpufreq/cpu.sh | 84 ++++++++++++ tools/testing/selftests/cpufreq/cpufreq.sh | 201 ++++++++++++++++++++++++++++ tools/testing/selftests/cpufreq/governor.sh | 146 ++++++++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 128 ++++++++++++++++++ 6 files changed, 568 insertions(+) create mode 100644 tools/testing/selftests/cpufreq/Makefile create mode 100755 tools/testing/selftests/cpufreq/cpu.sh create mode 100755 tools/testing/selftests/cpufreq/cpufreq.sh create mode 100755 tools/testing/selftests/cpufreq/governor.sh create mode 100755 tools/testing/selftests/cpufreq/main.sh
tools/testing/selftests/Makefile +1 -0
@@ -1,6 +1,7 @@ TARGETS = bpf TARGETS += breakpoints TARGETS += capabilities +TARGETS += cpufreq TARGETS += cpu-hotplug TARGETS += efivarfs TARGETS += exec
tools/testing/selftests/cpufreq/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +all: + +TEST_PROGS := main.sh +TEST_FILES := cpu.sh cpufreq.sh governor.sh + +include ../lib.mk + +clean:
tools/testing/selftests/cpufreq/cpu.sh new file +84 -0
84 lines not on this page · raw message
tools/testing/selftests/cpufreq/cpufreq.sh new file +201 -0
201 lines not on this page · raw message
tools/testing/selftests/cpufreq/governor.sh new file +146 -0
146 lines not on this page · raw message
tools/testing/selftests/cpufreq/main.sh new file +128 -0
128 lines not on this page · raw message
Signature · 1 line
2.7.1.410.g6faf27b
Viresh Kumar
maintainerPATCH 2/4 selftest: cpufreq: Add suspend/resume/hibernate support
In reply to Viresh KumarThis patch adds support to test basic suspend/resume and hibernation to the cpufreq selftests.
--- tools/testing/selftests/cpufreq/cpufreq.sh | 40 ++++++++++++++++++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 14 +++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-)
tools/testing/selftests/cpufreq/cpufreq.sh +40 -0
@@ -199,3 +199,43 @@ cpufreq_basic_tests() # Test all governors shuffle_governors_for_all_cpus 1 } + +# Suspend/resume +# $1: "suspend" or "hibernate", $2: loop count +do_suspend() +{ + printf "** Test: Running ${FUNCNAME[0]}: Trying $1 for $2 loops **\n\n" + + # Is the directory available + if [ ! -d $SYSFS/power/ -o ! -f $SYSFS/power/state ]; then + printf "$SYSFS/power/state not available\n" + return 1 + fi + + if [ $1 = "suspend" ]; then + filename="mem" + elif [ $1 = "hibernate" ]; then + filename="disk" + else + printf "$1 is not a valid option\n" + return 1 + fi + + if [ -n $filename ]; then + present=$(cat $SYSFS/power/state | grep $filename) + + if [ -z "$present" ]; then + printf "Tried to $1 but $filename isn't present in $SYSFS/power/state\n" + return 1; + fi + + for i in `seq 1 $2`; do + printf "Starting $1\n" + echo $filename > $SYSFS/power/state + printf "Came out of $1\n" + + printf "Do basic tests after finishing $1 to verify cpufreq state\n\n" + cpufreq_basic_tests + done + fi +}
tools/testing/selftests/cpufreq/main.sh +12 -2
@@ -15,7 +15,9 @@ helpme() printf "Usage: $0 [-h] [-to args] [-h <help>] [-o <output-file-for-dump>] - [-t <basic: Basic cpufreq testing>] + [-t <basic: Basic cpufreq testing + suspend: suspend/resume, + hibernate: hibernate/resume>] \n" exit 2 }
@@ -61,7 +63,7 @@ parse_arguments() helpme ;; - t) # --func_type (Function to perform: basic (default: basic)) + t) # --func_type (Function to perform: basic, suspend, hibernate (default: basic)) FUNC=$OPTARG ;;
@@ -91,6 +93,14 @@ do_test() cpufreq_basic_tests ;; + "suspend") + do_suspend "suspend" 1 + ;; + + "hibernate") + do_suspend "hibernate" 1 + ;; + *) echo "Invalid [-f] function type" helpme
Signature · 1 line
2.7.1.410.g6faf27b
Viresh Kumar
maintainerPATCH 3/4 selftest: cpufreq: Add support to test cpufreq modules
In reply to Viresh KumarThis patch adds support for cpufreq modules like cpufreq drivers and cpufreq governors. The tests will insert the modules in different orders and them perform basic cpufreq tests. The modules are then removed from the kernel.
--- tools/testing/selftests/cpufreq/Makefile | 2 +- tools/testing/selftests/cpufreq/main.sh | 45 +++++- tools/testing/selftests/cpufreq/module.sh | 243 ++++++++++++++++++++++++++++++ 3 files changed, 284 insertions(+), 6 deletions(-) create mode 100755 tools/testing/selftests/cpufreq/module.sh
tools/testing/selftests/cpufreq/Makefile +1 -1
@@ -1,7 +1,7 @@ all: TEST_PROGS := main.sh -TEST_FILES := cpu.sh cpufreq.sh governor.sh +TEST_FILES := cpu.sh cpufreq.sh governor.sh module.sh include ../lib.mk
tools/testing/selftests/cpufreq/main.sh +40 -5
91 lines not on this page · raw message
tools/testing/selftests/cpufreq/module.sh new file +243 -0
243 lines not on this page · raw message
Signature · 1 line
2.7.1.410.g6faf27b
Viresh Kumar
maintainerPATCH 4/4 selftest: cpufreq: Add special tests
In reply to Viresh KumarThis patch adds support for special tests which were reported on the PM list over the years, which helped catching core bugs by several developers.
--- tools/testing/selftests/cpufreq/Makefile | 2 +- tools/testing/selftests/cpufreq/governor.sh | 7 ++ tools/testing/selftests/cpufreq/main.sh | 25 ++++- tools/testing/selftests/cpufreq/special-tests.sh | 115 +++++++++++++++++++++++ 4 files changed, 146 insertions(+), 3 deletions(-) create mode 100755 tools/testing/selftests/cpufreq/special-tests.sh
tools/testing/selftests/cpufreq/Makefile +1 -1
@@ -1,7 +1,7 @@ all: TEST_PROGS := main.sh -TEST_FILES := cpu.sh cpufreq.sh governor.sh module.sh +TEST_FILES := cpu.sh cpufreq.sh governor.sh module.sh special-tests.sh include ../lib.mk
tools/testing/selftests/cpufreq/governor.sh +7 -0
@@ -71,6 +71,13 @@ __switch_governor() echo $2 > $CPUFREQROOT/$1/scaling_governor } +# param: +# $1: cpu, $2: governor +__switch_governor_for_cpu() +{ + echo $2 > $CPUROOT/$1/cpufreq/scaling_governor +} + # SWITCH GOVERNORS # $1: cpu, $2: governor
tools/testing/selftests/cpufreq/main.sh +23 -2
@@ -4,6 +4,7 @@ source cpu.sh source cpufreq.sh source governor.sh source module.sh +source special-tests.sh FUNC=basic # do basic tests by default OUTFILE=cpufreq_selftest
@@ -19,7 +20,11 @@ helpme() [-t <basic: Basic cpufreq testing suspend: suspend/resume, hibernate: hibernate/resume, - modtest: test driver or governor modules. Only to be used with -d or -g options>] + modtest: test driver or governor modules. Only to be used with -d or -g options, + sptest1: Simple governor switch to produce lockdep. + sptest2: Concurrent governor switch to produce lockdep. + sptest3: Governor races, shuffle between governors quickly. + sptest4: CPU hotplugs with updates to cpufreq files.>] [-d <driver's module name: only with \"-t modtest>\"] [-g <governor's module name: only with \"-t modtest>\"] \n"
@@ -67,7 +72,7 @@ parse_arguments() helpme ;; - t) # --func_type (Function to perform: basic, suspend, hibernate, modtest (default: basic)) + t) # --func_type (Function to perform: basic, suspend, hibernate, modtest, sptest1/2/3/4 (default: basic)) FUNC=$OPTARG ;;
@@ -136,6 +141,22 @@ do_test() fi ;; + "sptest1") + simple_lockdep + ;; + + "sptest2") + concurrent_lockdep + ;; + + "sptest3") + governor_race + ;; + + "sptest4") + hotplug_with_updates + ;; + *) echo "Invalid [-f] function type" helpme
tools/testing/selftests/cpufreq/special-tests.sh new file +115 -0
115 lines not on this page · raw message
Signature · 1 line
2.7.1.410.g6faf27b
Shuah Khan
maintainerQuoted 5 lines · Viresh Kumar
Hi,
This patchset adds support for cpufreq selftests to the kernel selftest framework. More details can be found on individual patches.
Quoted 8 lines
These are all tested after installation of selftests on ARM Dual A15 core Exynos platform.
The content of the output file for the basic tests looks like this:
http://pastebin.com/nBY9AfD5 .--
viresh
Hi Viresh,
Could you please add .gitignore for generated files. You can send that as a separate patch and don't have to resend the series.
thanks,
-- Shuah
Quoted 24 lines
Viresh Kumar (4):
selftest: cpufreq: Add support for cpufreq tests
selftest: cpufreq: Add suspend/resume/hibernate support
selftest: cpufreq: Add support to test cpufreq modules
selftest: cpufreq: Add special teststools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpufreq/Makefile | 8 + tools/testing/selftests/cpufreq/cpu.sh | 84 ++++++++ tools/testing/selftests/cpufreq/cpufreq.sh | 241 ++++++++++++++++++++++ tools/testing/selftests/cpufreq/governor.sh | 153 ++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 194 ++++++++++++++++++ tools/testing/selftests/cpufreq/module.sh | 243 +++++++++++++++++++++++ tools/testing/selftests/cpufreq/special-tests.sh | 115 +++++++++++ 8 files changed, 1039 insertions(+) create mode 100644 tools/testing/selftests/cpufreq/Makefile create mode 100755 tools/testing/selftests/cpufreq/cpu.sh create mode 100755 tools/testing/selftests/cpufreq/cpufreq.sh create mode 100755 tools/testing/selftests/cpufreq/governor.sh create mode 100755 tools/testing/selftests/cpufreq/main.sh create mode 100755 tools/testing/selftests/cpufreq/module.sh create mode 100755 tools/testing/selftests/cpufreq/special-tests.sh
Viresh Kumar
maintainerQuoted 3 lines · Shuah Khan
Could you please add .gitignore for generated files. You can send that as a separate patch and don't have to resend the series.
Hi Shuah,
Quoted 8 lines
Quoted 8 lines
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpufreq/Makefile | 8 + tools/testing/selftests/cpufreq/cpu.sh | 84 ++++++++ tools/testing/selftests/cpufreq/cpufreq.sh | 241 ++++++++++++++++++++++ tools/testing/selftests/cpufreq/governor.sh | 153 ++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 194 ++++++++++++++++++ tools/testing/selftests/cpufreq/module.sh | 243 +++++++++++++++++++++++ tools/testing/selftests/cpufreq/special-tests.sh | 115 +++++++++++
All I have are .sh files and no intermediate files are generated. Perhaps I don't need any .gitignore entries ?
Signature · 1 line
viresh
Shuah Khan
maintainerQuoted 16 lines · Viresh Kumar
Quoted 3 lines · Shuah Khan
Could you please add .gitignore for generated files. You can send that as a separate patch and don't have to resend the series.
Hi Shuah,
Quoted 8 lines
Quoted 8 lines
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpufreq/Makefile | 8 + tools/testing/selftests/cpufreq/cpu.sh | 84 ++++++++ tools/testing/selftests/cpufreq/cpufreq.sh | 241 ++++++++++++++++++++++ tools/testing/selftests/cpufreq/governor.sh | 153 ++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 194 ++++++++++++++++++ tools/testing/selftests/cpufreq/module.sh | 243 +++++++++++++++++++++++ tools/testing/selftests/cpufreq/special-tests.sh | 115 +++++++++++
Quoted 3 lines
All I have are .sh files and no intermediate files are generated. Perhaps I don't need any .gitignore entries ?
Never mind. There is no need to do .gitignore.
thanks,
-- Shuah
Shuah Khan
maintainerQuoted 17 lines · Shuah Khan
Quoted 16 lines · Viresh Kumar
Quoted 3 lines · Shuah Khan
Could you please add .gitignore for generated files. You can send that as a separate patch and don't have to resend the series.
Hi Shuah,
Quoted 8 lines
Quoted 8 lines
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/cpufreq/Makefile | 8 + tools/testing/selftests/cpufreq/cpu.sh | 84 ++++++++ tools/testing/selftests/cpufreq/cpufreq.sh | 241 ++++++++++++++++++++++ tools/testing/selftests/cpufreq/governor.sh | 153 ++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 194 ++++++++++++++++++ tools/testing/selftests/cpufreq/module.sh | 243 +++++++++++++++++++++++ tools/testing/selftests/cpufreq/special-tests.sh | 115 +++++++++++
Quoted 6 lines
Quoted 3 lines
All I have are .sh files and no intermediate files are generated. Perhaps I don't need any .gitignore entries ?
Never mind. There is no need to do .gitignore.
Thanks for these tests. Applied the series to linux-kselftest next for 4.11
thanks,
-- Shuah
Viresh Kumar
maintainerPATCH 1/1 selftest: cpufreq: Update MAINTAINERS file
Update MAINTAINERS file with cpufreq's selftest directory.
---
Hi shuah,
Can you please add this one as well along with the code? Thanks.
MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -3381,6 +3381,7 @@ B: https://bugzilla.kernel.org F: Documentation/cpu-freq/ F: drivers/cpufreq/ F: include/linux/cpufreq.h +F: tools/testing/selftests/cpufreq/ CPU FREQUENCY DRIVERS - ARM BIG LITTLE M: Viresh Kumar <[email protected]>
Signature · 1 line
2.7.1.410.g6faf27b
Viresh Kumar
maintainerRe: [PATCH] selftest: cpufreq: Update MAINTAINERS file
Quoted 16 lines · Viresh Kumar
Update
MAINTAINERSfile with cpufreq's selftest directory.Signed-off-by Viresh Kumar <[email protected]>---
Hi shuah,Can you please add this one as well along with the code? Thanks.
MAINTAINERS | 1 + 1 file changed, 1 insertion(+)MAINTAINERS +0
-0
MAINTAINERS B: https://bugzilla.kernel.org · line 3387
Quoted 7 lines
MAINTAINERS +1
-0@@ -3381,6 +3381,7 @@ B: https://bugzilla.kernel.org F: Documentation/cpu-freq/ F: drivers/cpufreq/ F: include/linux/cpufreq.h +F: tools/testing/selftests/cpufreq/ CPU FREQUENCY DRIVERS - ARM BIG LITTLE M: Viresh Kumar <[email protected]>
@Shuah; Can you please add this as well?
Signature · 1 line
viresh
Shuah Khan
maintainerRe: [PATCH] selftest: cpufreq: Update MAINTAINERS file
Quoted 22 lines · Viresh Kumar
Quoted 21 lines · Viresh Kumar
Update
MAINTAINERSfile with cpufreq's selftest directory.Signed-off-by Viresh Kumar <[email protected]>---
Hi shuah,Can you please add this one as well along with the code? Thanks.
MAINTAINERS | 1 + 1 file changed, 1 insertion(+)MAINTAINERS +1
-0@@ -3381,6 +3381,7 @@ B: https://bugzilla.kernel.org F: Documentation/cpu-freq/ F: drivers/cpufreq/ F: include/linux/cpufreq.h +F: tools/testing/selftests/cpufreq/
Quoted 5 lines
MAINTAINERS B: https://bugzilla.kernel.org · line 3387
Quoted 2 lines
MAINTAINERS +0
-0CPU FREQUENCY DRIVERS - ARM BIG LITTLE M: Viresh Kumar <[email protected]>@Shuah; Can you please add this as well?
Thanks for reminding me. I will pick this up.
-- Shuah