Skip to contentSkip to conversation

test driver to analyse vmalloc allocator

RFC Superseded Uladzislau Rezki (Sony) 3 participants 8 messages Dec 31, 2018 – Jan 1, 2019

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Uladzislau Rezki (Sony)

author maintainer
#0 lore raw

v2 cover test driver to analyse vmalloc allocator

Hello.

The first RFC was here: https://lkml.org/lkml/2018/11/13/957
Please have a look there for detailed description and discussion. Here i will just specify what has been done since last RFC:

Changes in v2:
- Code cleanup to make it more simple;
- Now __vmalloc_node_range() is exported if CONFIG_TEST_VMALLOC_MODULE=m
- Integrate vmalloc test suite into tools/testing/selftests/vm

I hope this test suite is more or less ready to go with. Appreciate your comments and feedback anyway, so please RFC v2.

Thanks.

Uladzislau Rezks (Sony) (3):
vmalloc: export __vmalloc_node_range for CONFIG_TEST_VMALLOC_MODULE
vmalloc: add test driver to analyse vmalloc allocator selftests/vm: add script helper for CONFIG_TEST_VMALLOC_MODULE

 lib/Kconfig.debug                          |  12 +
 lib/Makefile                               |   1 +
 lib/test_vmalloc.c                         | 543 +++++++++++++++++++++++++++++
 mm/vmalloc.c                               |   9 +
 tools/testing/selftests/vm/run_vmtests     |  11 +
 tools/testing/selftests/vm/test_vmalloc.sh | 173 +++++++++
 6 files changed, 749 insertions(+)
 create mode 100644 lib/test_vmalloc.c
 create mode 100755 tools/testing/selftests/vm/test_vmalloc.sh
Signature · 1 line
2.11.0
author maintainer
#1 lore raw

RFC v2 1/3 vmalloc: export __vmalloc_node_range for CONFIG_TEST_VMALLOC_MODULE

Export __vmaloc_node_range() function if CONFIG_TEST_VMALLOC_MODULE is enabled. Some test cases in vmalloc test suite module require and make use of that function. Please note, that it is not supposed to be used for other purposes.

We need it only for performance analysis, stressing and stability check of vmalloc allocator.

---
 mm/vmalloc.c | 9 +++++++++
 1 file changed, 9 insertions(+)
mm/vmalloc.c +9 -0
index cfea25be7754..50ccb8bdfad8 100644
@@ -1764,6 +1764,15 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
 	return NULL;
 }
 
+/*
+ * This is only for performance analysis of vmalloc and stress purpose.
+ * It is required by vmalloc test module, therefore do not use it other
+ * than that.
+ */
+#ifdef CONFIG_TEST_VMALLOC_MODULE
+EXPORT_SYMBOL(__vmalloc_node_range);
+#endif
+
 /**
  *	__vmalloc_node  -  allocate virtually contiguous memory
  *	@size:		allocation size
Signature · 1 line
2.11.0
#2 lore raw

Re: [RFC v2 1/3] vmalloc: export __vmalloc_node_range for CONFIG_TEST_VMALLOC_MODULE

mm/vmalloc.c void *__vmalloc_node_range(unsigned long size, unsigned long align, · line 1774

Quoted 3 lines · Uladzislau Rezki (Sony)
mm/vmalloc.c +3 -0
+#ifdef CONFIG_TEST_VMALLOC_MODULE
+EXPORT_SYMBOL(__vmalloc_node_range);
+#endif

Definitely needs to be _GPL.

author maintainer
#3 lore raw

Re: [RFC v2 1/3] vmalloc: export __vmalloc_node_range for CONFIG_TEST_VMALLOC_MODULE

Quoted 6 lines · Matthew Wilcox

mm/vmalloc.c void *__vmalloc_node_range(unsigned long size, unsigned long align, · line 1774

Quoted 3 lines · Uladzislau Rezki (Sony)
mm/vmalloc.c +3 -0
+#ifdef CONFIG_TEST_VMALLOC_MODULE
+EXPORT_SYMBOL(__vmalloc_node_range);
+#endif

Definitely needs to be _GPL.

Will upload updated variant.

Thanks for the comment!

--
Vlad Rezki

author maintainer
#4 lore raw

RFC v2 2/3 vmalloc: add test driver to analyse vmalloc allocator

In reply to Uladzislau Rezki (Sony)

This adds a new kernel module for analysis of vmalloc allocator. It is only enabled as a module. There are two main reasons this module should be used for: performance evaluation and stressing of vmalloc subsystem.

It consists of several test cases. As of now there are 8. The module has five parameters we can specify to change its the behaviour.

1) run_test_mask - set of tests to be run

id: 1, name: fix_size_alloc_test
id: 2, name: full_fit_alloc_test
id: 4, name: long_busy_list_alloc_test
id: 8, name: random_size_alloc_test
id: 16, name: fix_align_alloc_test
id: 32, name: random_size_align_alloc_test
id: 64, name: align_shift_alloc_test
id: 128, name: pcpu_alloc_test

By default all tests are in run test mask. If you want to select some specific tests it is possible to pass the mask. For example for first, second and fourth tests we go 11 value.

2) test_repeat_count - how many times each test should be repeated By default it is one time per test. It is possible to pass any number. As high the value is the test duration gets increased.

3) test_loop_count - internal test loop counter. By default it is set to 1000000.

4) single_cpu_test - use one CPU to run the tests
By default this parameter is set to false. It means that all online CPUs execute tests. By setting it to 1, the tests are executed by first online CPU only.

5) sequential_test_order - run tests in sequential order
By default this parameter is set to false. It means that before running tests the order is shuffled. It is possible to make it sequential, just set it to 1.

Performance analysis:
In order to evaluate performance of vmalloc allocations, usually it makes sense to use only one CPU that runs tests, use sequential order, number of repeat tests can be different as well as set of test mask.

For example if we want to run all tests, to use one CPU and repeat each test 3 times. Insert the module passing following parameters:

single_cpu_test=1 sequential_test_order=1 test_repeat_count=3

with following output:

<snip>
Summary: fix_size_alloc_test passed: 3 failed: 0 repeat: 3 loops: 1000000 avg: 901177 usec
Summary: full_fit_alloc_test passed: 3 failed: 0 repeat: 3 loops: 1000000 avg: 1039341 usec
Summary: long_busy_list_alloc_test passed: 3 failed: 0 repeat: 3 loops: 1000000 avg: 11775763 usec
Summary: random_size_alloc_test passed 3: failed: 0 repeat: 3 loops: 1000000 avg: 6081992 usec
Summary: fix_align_alloc_test passed: 3 failed: 0 repeat: 3, loops: 1000000 avg: 2003712 usec
Summary: random_size_align_alloc_test passed: 3 failed: 0 repeat: 3 loops: 1000000 avg: 2895689 usec
Summary: align_shift_alloc_test passed: 0 failed: 3 repeat: 3 loops: 1000000 avg: 573 usec
Summary: pcpu_alloc_test passed: 3 failed: 0 repeat: 3 loops: 1000000 avg: 95802 usec All test took CPU0=192945605995 cycles
<snip>

The align_shift_alloc_test is expected to be failed.

Stressing:
In order to stress the vmalloc subsystem we run all available test cases on all available CPUs simultaneously. In order to prevent constant behaviour pattern, the test cases array is shuffled by default to randomize the order of test execution.

For example if we want to run all tests(default), use all online CPUs(default) with shuffled order(default) and to repeat each test 30 times. The command would be like:

modprobe vmalloc_test test_repeat_count=30

Expected results are the system is alive, there are no any BUG_ONs or Kernel Panics the tests are completed, no memory leaks.

---
 lib/Kconfig.debug  |  12 ++
 lib/Makefile       |   1 +
 lib/test_vmalloc.c | 543 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 556 insertions(+)
 create mode 100644 lib/test_vmalloc.c
lib/Kconfig.debug +12 -0
index 8838d1158d19..ca8a1a55d777 100644
@@ -1851,6 +1851,18 @@ config TEST_LKM
 
 	  If unsure, say N.
 
+config TEST_VMALLOC
+	tristate "Test module for stress/performance analysis of vmalloc allocator"
+	default n
+	depends on m
+	help
+	  This builds the "vmalloc_test" module that should be used for
+	  stress and performance analysis. So, any new change for vmalloc
+	  subsystem can be evaluated from performance and stability point
+	  of view.
+
+	  If unsure, say N.
+
 config TEST_USER_COPY
 	tristate "Test user/kernel boundary protections"
 	default n
lib/Makefile +1 -0
index 90dc5520b784..2caa6161b417 100644
@@ -57,6 +57,7 @@ UBSAN_SANITIZE_test_ubsan.o := y
 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
 obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o
 obj-$(CONFIG_TEST_LKM) += test_module.o
+obj-$(CONFIG_TEST_VMALLOC) += test_vmalloc.o
 obj-$(CONFIG_TEST_OVERFLOW) += test_overflow.o
 obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o
 obj-$(CONFIG_TEST_SORT) += test_sort.o
lib/test_vmalloc.c new file +543 -0

543 lines not on this page · raw message

Signature · 1 line
2.11.0
author maintainer
#5 lore raw

RFC v2 3/3 selftests/vm: add script helper for CONFIG_TEST_VMALLOC_MODULE

In reply to Uladzislau Rezki (Sony)

Add the test script for the kernel test driver to analyse vmalloc allocator for benchmarking and stressing purposes. It is just a kernel module loader. You can specify and pass different parameters in order to investigate allocations behaviour. See "usage" output for more details.

Also add basic vmalloc smoke test to the "run_vmtests" suite.

---
 tools/testing/selftests/vm/run_vmtests     |  11 ++
 tools/testing/selftests/vm/test_vmalloc.sh | 173 +++++++++++++++++++++++++++++
 2 files changed, 184 insertions(+)
 create mode 100755 tools/testing/selftests/vm/test_vmalloc.sh
tools/testing/selftests/vm/run_vmtests +11 -0
index 88cbe5575f0c..56053ac2bf47 100755
@@ -200,4 +200,15 @@ else
     echo "[PASS]"
 fi
 
+echo "------------------------------------"
+echo "running vmalloc stability smoke test"
+echo "------------------------------------"
+./test_vmalloc.sh smoke
+if [ $? -ne 0 ]; then
+	echo "[FAIL]"
+	exitcode=1
+else
+	echo "[PASS]"
+fi
+
 exit $exitcode
tools/testing/selftests/vm/test_vmalloc.sh new file +173 -0

173 lines not on this page · raw message

Signature · 1 line
2.11.0
maintainer
#6 lore raw

Re: [RFC v2 3/3] selftests/vm: add script helper for CONFIG_TEST_VMALLOC_MODULE

Quoted 7 lines · Uladzislau Rezki (Sony)

Add the test script for the kernel test driver to analyse vmalloc allocator for benchmarking and stressing purposes. It is just a kernel module loader. You can specify and pass different parameters in order to investigate allocations behaviour. See "usage" output for more details.

Also add basic vmalloc smoke test to the "run_vmtests" suite.

Thanks for the test. A few comments below.

Quoted 13 lines
---
  tools/testing/selftests/vm/run_vmtests     |  11 ++
  tools/testing/selftests/vm/test_vmalloc.sh | 173 +++++++++++++++++++++++++++++
  2 files changed, 184 insertions(+)

create mode 100755 tools/testing/selftests/vm/test_vmalloc.sh

tools/testing/selftests/vm/run_vmtests +0 -0
index 88cbe5575f0c..56053ac2bf47 100755

tools/testing/selftests/vm/run_vmtests else · line 209

Quoted 10 lines
tools/testing/selftests/vm/run_vmtests +7 -0
@@ -200,4 +200,15 @@ else
      echo "[PASS]"
  fi
 
+echo "------------------------------------"
+echo "running vmalloc stability smoke test"
+echo "------------------------------------"
+./test_vmalloc.sh smoke
+if [ $? -ne 0 ]; then
+	echo "[FAIL]"
+	exitcode=1

Please handle skil cases - exit code for skip is 4.

Quoted 32 lines
tools/testing/selftests/vm/run_vmtests +4 -0
+else
+	echo "[PASS]"
+fi
+
  exit $exitcode
tools/testing/selftests/vm/test_vmalloc.sh new file +21 -0
new file mode 100755
index 000000000000..f4f0d3990f2c
@@ -0,0 +1,173 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2018 Uladzislau Rezki (Sony) <[email protected]>
+#
+# This is a test script for the kernel test driver to analyse vmalloc
+# allocator. Therefore it is just a kernel module loader. You can specify
+# and pass different parameters in order to:
+#     a) analyse performance of vmalloc allocations;
+#     b) stressing and stability check of vmalloc subsystem.
+
+TEST_NAME="vmalloc"
+DRIVER="test_${TEST_NAME}"
+
+# 1 if fails
+exitcode=1
+
+#
+# Static templates for performance, stressing and smoke tests.
+# Also it is possible to pass any supported parameters manualy.
+#

tools/testing/selftests/vm/test_vmalloc.sh line 31

Quoted 10 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +10 -0
+PERF_PARAM="single_cpu_test=1 sequential_test_order=1 test_repeat_count=3"
+SMOKE_PARAM="single_cpu_test=1 test_loop_count=10000 test_repeat_count=10"
+STRESS_PARAM="test_repeat_count=20"
+
+check_test_requirements()
+{
+	uid=$(id -u)
+	if [ $uid -ne 0 ]; then
+		echo "$0: Must be run as root"
+		exit $exitcode

This is a skip and not a fail.

tools/testing/selftests/vm/test_vmalloc.sh line 36

Quoted 5 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +5 -0
+	fi
+
+	if ! which modprobe > /dev/null 2>&1; then
+		echo "$0: You need modprobe installed"
+		exit $exitcode

This is a skip and not a fail.

tools/testing/selftests/vm/test_vmalloc.sh line 42

Quoted 6 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +6 -0
+	fi
+
+	if ! modinfo $DRIVER > /dev/null 2>&1; then
+		echo "$0: You must have the following enabled in your kernel:"
+		echo "CONFIG_TEST_VMALLOC=m"
+		exit $exitcode

This is a skip and not a fail.

Quoted 122 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +121 -0
+	fi
+}
+
+run_perfformance_check()
+{
+	echo "Run performance tests to evaluate how fast vmalloc allocation is."
+	echo "It runs all test cases on one single CPU with sequential order."
+
+	modprobe $DRIVER $PERF_PARAM > /dev/null 2>&1
+	echo "Done."
+	echo "Ccheck the kernel message buffer to see the summary."
+}
+
+run_stability_check()
+{
+	echo "Run stability tests. In order to stress vmalloc subsystem we run"
+	echo "all available test cases on all available CPUs simultaneously."
+	echo "It will take time, so be patient."
+
+	modprobe $DRIVER $STRESS_PARAM > /dev/null 2>&1
+	echo "Done."
+	echo "Check the kernel ring buffer to see the summary."
+}
+
+run_smoke_check()
+{
+	echo "Run smoke test. Note, this test provides basic coverage."
+	echo "Please check $0 output how it can be used"
+	echo "for deep performance analysis as well as stress testing."
+
+	modprobe $DRIVER $SMOKE_PARAM > /dev/null 2>&1
+	echo "Done."
+	echo "Check the kernel ring buffer to see the summary."
+}
+
+usage()
+{
+	echo -n "Usage: $0 [ performance ] | [ stress ] | | [ smoke ] | "
+	echo "manual parameters"
+	echo
+	echo "Valid tests and parameters:"
+	echo
+	modinfo $DRIVER
+	echo
+	echo "Example usage:"
+	echo
+	echo "# Shows help message"
+	echo "./${DRIVER}.sh"
+	echo
+	echo "# Runs 1 test(id_1), repeats it 5 times on all online CPUs"
+	echo "./${DRIVER}.sh run_test_mask=1 test_repeat_count=5"
+	echo
+	echo -n "# Runs 4 tests(id_1|id_2|id_4|id_16) on one CPU with "
+	echo "sequential order"
+	echo -n "./${DRIVER}.sh single_cpu_test=1 sequential_test_order=1 "
+	echo "run_test_mask=23"
+	echo
+	echo -n "# Runs all tests on all online CPUs, shuffled order, repeats "
+	echo "20 times"
+	echo "./${DRIVER}.sh test_repeat_count=20"
+	echo
+	echo "# Performance analysis"
+	echo "./${DRIVER}.sh performance"
+	echo
+	echo "# Stress testing"
+	echo "./${DRIVER}.sh stress"
+	echo
+	exit $exitcode
+}
+
+function validate_passed_args()
+{
+	VALID_ARGS=`modinfo $DRIVER | awk '/parm:/ {print $2}' | sed 's/:.*//'`
+
+	#
+	# Something has been passed, check it.
+	#
+	for passed_arg in $@; do
+		key=${passed_arg//=*/}
+		val="${passed_arg:$((${#key}+1))}"
+		valid=0
+
+		for valid_arg in $VALID_ARGS; do
+			if [[ $key = $valid_arg ]] && [[ $val -gt 0 ]]; then
+				valid=1
+				break
+			fi
+		done
+
+		if [[ $valid -ne 1 ]]; then
+			echo "Error: key or value is not correct: ${key} $val"
+			exit $exitcode
+		fi
+	done
+}
+
+function run_manual_check()
+{
+	#
+	# Validate passed parameters. If there is wrong one,
+	# the script exists and does not execute further.
+	#
+	validate_passed_args $@
+
+	echo "Run the test with following parameters: $@"
+	modprobe $DRIVER $@ > /dev/null 2>&1
+	echo "Done."
+	echo "Check the kernel ring buffer to see the summary."
+}
+
+function run_test()
+{
+	if [ $# -eq 0 ]; then
+		usage
+	else
+		if [[ "$1" = "performance" ]]; then
+			run_perfformance_check
+		elif [[ "$1" = "stress" ]]; then
+			run_stability_check
+		elif [[ "$1" = "smoke" ]]; then
+			run_smoke_check

tools/testing/selftests/vm/test_vmalloc.sh line 173

Quoted 10 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +10 -0
+		else
+			run_manual_check $@
+		fi
+	fi
+}
+
+check_test_requirements
+run_test $@
+
+exit 0

thanks,
-- Shuah

author maintainer
#7 lore raw

Re: [RFC v2 3/3] selftests/vm: add script helper for CONFIG_TEST_VMALLOC_MODULE

Quoted 19 lines · shuah
Quoted 7 lines · Uladzislau Rezki (Sony)

Add the test script for the kernel test driver to analyse vmalloc allocator for benchmarking and stressing purposes. It is just a kernel module loader. You can specify and pass different parameters in order to investigate allocations behaviour. See "usage" output for more details.

Also add basic vmalloc smoke test to the "run_vmtests" suite.

Thanks for the test. A few comments below.

Quoted 8 lines
---
  tools/testing/selftests/vm/run_vmtests     |  11 ++
  tools/testing/selftests/vm/test_vmalloc.sh | 173 +++++++++++++++++++++++++++++
  2 files changed, 184 insertions(+)

create mode 100755 tools/testing/selftests/vm/test_vmalloc.sh

Quoted 17 lines
Quoted 5 lines
tools/testing/selftests/vm/run_vmtests +0 -0
index 88cbe5575f0c..56053ac2bf47 100755

tools/testing/selftests/vm/run_vmtests else · line 208

Quoted 9 lines
tools/testing/selftests/vm/run_vmtests +7 -0
@@ -200,4 +200,15 @@ else
      echo "[PASS]"
  fi
+echo "------------------------------------"
+echo "running vmalloc stability smoke test"
+echo "------------------------------------"
+./test_vmalloc.sh smoke
+if [ $? -ne 0 ]; then
+	echo "[FAIL]"
+	exitcode=1

Please handle skil cases - exit code for skip is 4.

Will add skip case.

Quoted 36 lines
Quoted 36 lines
tools/testing/selftests/vm/run_vmtests +4 -0
+else
+	echo "[PASS]"
+fi
+
  exit $exitcode
tools/testing/selftests/vm/test_vmalloc.sh new file +25 -0
new file mode 100755
index 000000000000..f4f0d3990f2c
@@ -0,0 +1,173 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2018 Uladzislau Rezki (Sony) <[email protected]>
+#
+# This is a test script for the kernel test driver to analyse vmalloc
+# allocator. Therefore it is just a kernel module loader. You can specify
+# and pass different parameters in order to:
+#     a) analyse performance of vmalloc allocations;
+#     b) stressing and stability check of vmalloc subsystem.
+
+TEST_NAME="vmalloc"
+DRIVER="test_${TEST_NAME}"
+
+# 1 if fails
+exitcode=1
+
+#
+# Static templates for performance, stressing and smoke tests.
+# Also it is possible to pass any supported parameters manualy.
+#
+PERF_PARAM="single_cpu_test=1 sequential_test_order=1 test_repeat_count=3"
+SMOKE_PARAM="single_cpu_test=1 test_loop_count=10000 test_repeat_count=10"
+STRESS_PARAM="test_repeat_count=20"
+
Quoted 9 lines

tools/testing/selftests/vm/test_vmalloc.sh line 31

Quoted 6 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +6 -0
+check_test_requirements()
+{
+	uid=$(id -u)
+	if [ $uid -ne 0 ]; then
+		echo "$0: Must be run as root"
+		exit $exitcode

This is a skip and not a fail.

Will update it. Agree it should not interrupt test sequence.

Quoted 8 lines

tools/testing/selftests/vm/test_vmalloc.sh line 36

Quoted 5 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +5 -0
+	fi
+
+	if ! which modprobe > /dev/null 2>&1; then
+		echo "$0: You need modprobe installed"
+		exit $exitcode

This is a skip and not a fail.

Will update it.

Quoted 9 lines

tools/testing/selftests/vm/test_vmalloc.sh line 42

Quoted 6 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +6 -0
+	fi
+
+	if ! modinfo $DRIVER > /dev/null 2>&1; then
+		echo "$0: You must have the following enabled in your kernel:"
+		echo "CONFIG_TEST_VMALLOC=m"
+		exit $exitcode

This is a skip and not a fail.

Will update it.

Quoted 135 lines
Quoted 122 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +121 -0
+	fi
+}
+
+run_perfformance_check()
+{
+	echo "Run performance tests to evaluate how fast vmalloc allocation is."
+	echo "It runs all test cases on one single CPU with sequential order."
+
+	modprobe $DRIVER $PERF_PARAM > /dev/null 2>&1
+	echo "Done."
+	echo "Ccheck the kernel message buffer to see the summary."
+}
+
+run_stability_check()
+{
+	echo "Run stability tests. In order to stress vmalloc subsystem we run"
+	echo "all available test cases on all available CPUs simultaneously."
+	echo "It will take time, so be patient."
+
+	modprobe $DRIVER $STRESS_PARAM > /dev/null 2>&1
+	echo "Done."
+	echo "Check the kernel ring buffer to see the summary."
+}
+
+run_smoke_check()
+{
+	echo "Run smoke test. Note, this test provides basic coverage."
+	echo "Please check $0 output how it can be used"
+	echo "for deep performance analysis as well as stress testing."
+
+	modprobe $DRIVER $SMOKE_PARAM > /dev/null 2>&1
+	echo "Done."
+	echo "Check the kernel ring buffer to see the summary."
+}
+
+usage()
+{
+	echo -n "Usage: $0 [ performance ] | [ stress ] | | [ smoke ] | "
+	echo "manual parameters"
+	echo
+	echo "Valid tests and parameters:"
+	echo
+	modinfo $DRIVER
+	echo
+	echo "Example usage:"
+	echo
+	echo "# Shows help message"
+	echo "./${DRIVER}.sh"
+	echo
+	echo "# Runs 1 test(id_1), repeats it 5 times on all online CPUs"
+	echo "./${DRIVER}.sh run_test_mask=1 test_repeat_count=5"
+	echo
+	echo -n "# Runs 4 tests(id_1|id_2|id_4|id_16) on one CPU with "
+	echo "sequential order"
+	echo -n "./${DRIVER}.sh single_cpu_test=1 sequential_test_order=1 "
+	echo "run_test_mask=23"
+	echo
+	echo -n "# Runs all tests on all online CPUs, shuffled order, repeats "
+	echo "20 times"
+	echo "./${DRIVER}.sh test_repeat_count=20"
+	echo
+	echo "# Performance analysis"
+	echo "./${DRIVER}.sh performance"
+	echo
+	echo "# Stress testing"
+	echo "./${DRIVER}.sh stress"
+	echo
+	exit $exitcode
+}
+
+function validate_passed_args()
+{
+	VALID_ARGS=`modinfo $DRIVER | awk '/parm:/ {print $2}' | sed 's/:.*//'`
+
+	#
+	# Something has been passed, check it.
+	#
+	for passed_arg in $@; do
+		key=${passed_arg//=*/}
+		val="${passed_arg:$((${#key}+1))}"
+		valid=0
+
+		for valid_arg in $VALID_ARGS; do
+			if [[ $key = $valid_arg ]] && [[ $val -gt 0 ]]; then
+				valid=1
+				break
+			fi
+		done
+
+		if [[ $valid -ne 1 ]]; then
+			echo "Error: key or value is not correct: ${key} $val"
+			exit $exitcode
+		fi
+	done
+}
+
+function run_manual_check()
+{
+	#
+	# Validate passed parameters. If there is wrong one,
+	# the script exists and does not execute further.
+	#
+	validate_passed_args $@
+
+	echo "Run the test with following parameters: $@"
+	modprobe $DRIVER $@ > /dev/null 2>&1
+	echo "Done."
+	echo "Check the kernel ring buffer to see the summary."
+}
+
+function run_test()
+{
+	if [ $# -eq 0 ]; then
+		usage
+	else
+		if [[ "$1" = "performance" ]]; then
+			run_perfformance_check
+		elif [[ "$1" = "stress" ]]; then
+			run_stability_check
+		elif [[ "$1" = "smoke" ]]; then
+			run_smoke_check

tools/testing/selftests/vm/test_vmalloc.sh line 173

Quoted 10 lines
tools/testing/selftests/vm/test_vmalloc.sh new file +10 -0
+		else
+			run_manual_check $@
+		fi
+	fi
+}
+
+check_test_requirements
+run_test $@
+
+exit 0

thanks,
-- Shuah