All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module
@ 2015-02-25  9:13 Alexey Kodanev
  2015-02-25  9:13 ` [LTP] [PATCH 2/3] runtest/kernel_misc: add lock_torture.sh Alexey Kodanev
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-25  9:13 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

This is a wrapper for locktorture kernel module (added in Linux 3.18).
The test requiers that kernel configured with CONFIG_LOCK_TORTURE_TEST.
It runs locktorture module using particular options and then inspects dmesg
output for module's test results. For more information, please read Linux
Documentation: locking/locktorture.txt

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/kernel/device-drivers/Makefile           |    1 +
 testcases/kernel/device-drivers/locking/Makefile   |   22 +++++
 .../kernel/device-drivers/locking/lock_torture.sh  |   93 ++++++++++++++++++++
 3 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/device-drivers/locking/Makefile
 create mode 100755 testcases/kernel/device-drivers/locking/lock_torture.sh

diff --git a/testcases/kernel/device-drivers/Makefile b/testcases/kernel/device-drivers/Makefile
index a5a1745..551d137 100644
--- a/testcases/kernel/device-drivers/Makefile
+++ b/testcases/kernel/device-drivers/Makefile
@@ -21,6 +21,7 @@ include $(top_srcdir)/include/mk/env_pre.mk
 SUBDIRS		:= acpi \
 		   block \
 		   cpufreq \
+		   locking \
 		   pci \
 		   rcu \
 		   rtc \
diff --git a/testcases/kernel/device-drivers/locking/Makefile b/testcases/kernel/device-drivers/locking/Makefile
new file mode 100644
index 0000000..9aabff3
--- /dev/null
+++ b/testcases/kernel/device-drivers/locking/Makefile
@@ -0,0 +1,22 @@
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+top_srcdir	?= ../../../..
+include $(top_srcdir)/include/mk/testcases.mk
+
+INSTALL_TARGETS		:= lock_torture.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/device-drivers/locking/lock_torture.sh b/testcases/kernel/device-drivers/locking/lock_torture.sh
new file mode 100755
index 0000000..e2722dd
--- /dev/null
+++ b/testcases/kernel/device-drivers/locking/lock_torture.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
+#
+# This is a wrapper for locktorture kernel module. The test requiers
+# that kernel configured with CONFIG_LOCK_TORTURE_TEST. It runs locktorture
+# module using particular options and then inspects dmesg output for module's
+# test results. For more information, please read Linux Documentation:
+# locking/locktorture.txt
+
+TCID="lock_torture"
+TST_TOTAL=5
+TST_CLEANUP=cleanup
+. test.sh
+
+# default options
+test_time=60
+
+while getopts :ht: opt; do
+	case "$opt" in
+	h)
+		echo "Usage:"
+		echo "h        help"
+		echo "t x      time in seconds for each test-case"
+		exit 0
+	;;
+	t) test_time=$OPTARG ;;
+	*)
+		tst_brkm TBROK "unknown option: $opt"
+	;;
+	esac
+done
+
+cleanup()
+{
+	tst_resm TINFO "cleanup"
+	rmmod locktorture > /dev/null 2>&1
+}
+
+tst_kvercmp 3 18 0 && \
+	tst_brkm TCONF "test must be run with kernel 3.18 or newer"
+
+tst_require_root
+
+# check if module is present
+modprobe locktorture > /dev/null 2>&1 || \
+	tst_brkm TCONF "Test requires locktorture module"
+rmmod locktorture > /dev/null 2>&1
+
+trap cleanup INT
+
+lock_type="spin_lock spin_lock_irq rw_lock mutex_lock rwsem_lock"
+
+est_time=$(echo "scale=2; $test_time * $TST_TOTAL / 60 " | bc)
+tst_resm TINFO "estimate time $est_time min"
+
+for type in $lock_type; do
+
+	tst_resm TINFO "$type: running $test_time sec..."
+
+	modprobe locktorture torture_type=$type \
+	         > /dev/null 2>&1 || tst_brkm TBROK "failed to load module"
+
+	sleep $test_time
+
+	rmmod locktorture > /dev/null 2>&1 || \
+		tst_brkm TBROK "failed to unload module"
+
+	# check module status in dmesg
+	result_str=`dmesg | sed -nE '$s/.*End of test: ([A-Z]+):.*/\1/p'`
+	if [ "$result_str" = "SUCCESS" ]; then
+		tst_resm TPASS "$type: completed"
+	else
+		tst_resm TFAIL "$type: $result_str, see dmesg"
+	fi
+done
+
+tst_exit
-- 
1.7.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/3] runtest/kernel_misc: add lock_torture.sh
  2015-02-25  9:13 [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module Alexey Kodanev
@ 2015-02-25  9:13 ` Alexey Kodanev
  2015-02-26 10:10   ` Cyril Hrubis
  2015-02-25  9:13 ` [LTP] [PATCH 3/3] device-drivers/rcu/rcu_torture.sh: use default value for nreaders, fix types Alexey Kodanev
  2015-02-26 10:09 ` [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module Cyril Hrubis
  2 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-25  9:13 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 runtest/kernel_misc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/runtest/kernel_misc b/runtest/kernel_misc
index c12c31e..6a29de6 100644
--- a/runtest/kernel_misc
+++ b/runtest/kernel_misc
@@ -8,3 +8,4 @@ ltp_acpi ltp_acpi
 cpufreq_boost cpufreq_boost
 uaccess uaccess
 rcu_torture rcu_torture.sh
+lock_torture lock_torture.sh
-- 
1.7.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 3/3] device-drivers/rcu/rcu_torture.sh: use default value for nreaders, fix types
  2015-02-25  9:13 [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module Alexey Kodanev
  2015-02-25  9:13 ` [LTP] [PATCH 2/3] runtest/kernel_misc: add lock_torture.sh Alexey Kodanev
@ 2015-02-25  9:13 ` Alexey Kodanev
  2015-02-26 10:12   ` Cyril Hrubis
  2015-02-26 10:09 ` [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module Cyril Hrubis
  2 siblings, 1 reply; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-25  9:13 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

* rcutorture module sets nreaders to twice the number of CPUs
* fix rcutorture types, some of them were removed,
  some merged together in commits 99f8891 (v3.11), 2ec1f2d (v3.12)

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/kernel/device-drivers/rcu/rcu_torture.sh |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/testcases/kernel/device-drivers/rcu/rcu_torture.sh b/testcases/kernel/device-drivers/rcu/rcu_torture.sh
index 65c4fe0..55349fd 100755
--- a/testcases/kernel/device-drivers/rcu/rcu_torture.sh
+++ b/testcases/kernel/device-drivers/rcu/rcu_torture.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -24,27 +24,25 @@
 # For more information, please read Linux Documentation: RCU/torture.txt
 
 TCID="rcu_torture"
-TST_TOTAL=14
+TST_TOTAL=4
+TST_CLEANUP=cleanup
 
 . test.sh
 
 # default options
 test_time=60
-num_readers=10
 num_writers=5
 
-while getopts :ht:r:w: opt; do
+while getopts :ht:w: opt; do
 	case "$opt" in
 	h)
 		echo "Usage:"
 		echo "h        help"
 		echo "t x      time in seconds for each test-case"
-		echo "r x      number of readers"
 		echo "w x      number of writers"
 		exit 0
 	;;
 	t) test_time=$OPTARG ;;
-	r) num_readers=$OPTARG ;;
 	w) num_writers=$OPTARG ;;
 	*)
 		tst_brkm TBROK "unknown option: $opt"
@@ -54,9 +52,8 @@ done
 
 cleanup()
 {
-	tst_resm TINFO "test interrupted, cleanup..."
+	tst_resm TINFO "cleanup"
 	rmmod rcutorture > /dev/null 2>&1
-	tst_exit
 }
 
 tst_require_root
@@ -68,9 +65,7 @@ rmmod rcutorture > /dev/null 2>&1
 
 trap cleanup INT
 
-rcu_type="rcu rcu_sync rcu_expedited rcu_bh rcu_bh_sync rcu_bh_expedited \
-          srcu srcu_sync srcu_expedited srcu_raw srcu_raw_sync sched \
-          sched_sync sched_expedited"
+rcu_type="rcu rcu_bh srcu sched"
 
 est_time=`echo "scale=2; $test_time * $TST_TOTAL / 60 " | bc`
 tst_resm TINFO "estimate time $est_time min"
@@ -79,7 +74,7 @@ for type in $rcu_type; do
 
 	tst_resm TINFO "$type: running $test_time sec..."
 
-	modprobe rcutorture nreaders=$num_readers nfakewriters=$num_writers \
+	modprobe rcutorture nfakewriters=$num_writers \
 	         stat_interval=60 test_no_idle_hz=1 shuffle_interval=3 \
 	         stutter=5 irqreader=1 fqs_duration=0 fqs_holdoff=0 \
 	         fqs_stutter=3 test_boost=1 test_boost_interval=7 \
-- 
1.7.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module
  2015-02-25  9:13 [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module Alexey Kodanev
  2015-02-25  9:13 ` [LTP] [PATCH 2/3] runtest/kernel_misc: add lock_torture.sh Alexey Kodanev
  2015-02-25  9:13 ` [LTP] [PATCH 3/3] device-drivers/rcu/rcu_torture.sh: use default value for nreaders, fix types Alexey Kodanev
@ 2015-02-26 10:09 ` Cyril Hrubis
  2 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2015-02-26 10:09 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> +TCID="lock_torture"
> +TST_TOTAL=5
> +TST_CLEANUP=cleanup
> +. test.sh
> +
> +# default options
> +test_time=60
> +
> +while getopts :ht: opt; do
> +	case "$opt" in
> +	h)
> +		echo "Usage:"
> +		echo "h        help"
> +		echo "t x      time in seconds for each test-case"
> +		exit 0
> +	;;
> +	t) test_time=$OPTARG ;;
> +	*)
> +		tst_brkm TBROK "unknown option: $opt"
> +	;;
> +	esac
> +done
> +
> +cleanup()
> +{
> +	tst_resm TINFO "cleanup"
> +	rmmod locktorture > /dev/null 2>&1
> +}
> +
> +tst_kvercmp 3 18 0 && \
> +	tst_brkm TCONF "test must be run with kernel 3.18 or newer"

We check if the module is present, do we have to check for the kernel
version too?


Otherwise it look OK.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 2/3] runtest/kernel_misc: add lock_torture.sh
  2015-02-25  9:13 ` [LTP] [PATCH 2/3] runtest/kernel_misc: add lock_torture.sh Alexey Kodanev
@ 2015-02-26 10:10   ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2015-02-26 10:10 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
>  runtest/kernel_misc |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/runtest/kernel_misc b/runtest/kernel_misc
> index c12c31e..6a29de6 100644
> --- a/runtest/kernel_misc
> +++ b/runtest/kernel_misc
> @@ -8,3 +8,4 @@ ltp_acpi ltp_acpi
>  cpufreq_boost cpufreq_boost
>  uaccess uaccess
>  rcu_torture rcu_torture.sh
> +lock_torture lock_torture.sh

This should be part of the previous patch. There is no need to enable it
in a separate patch.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 3/3] device-drivers/rcu/rcu_torture.sh: use default value for nreaders, fix types
  2015-02-25  9:13 ` [LTP] [PATCH 3/3] device-drivers/rcu/rcu_torture.sh: use default value for nreaders, fix types Alexey Kodanev
@ 2015-02-26 10:12   ` Cyril Hrubis
       [not found]     ` <54F030D6.5020500@oracle.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2015-02-26 10:12 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> * rcutorture module sets nreaders to twice the number of CPUs
> * fix rcutorture types, some of them were removed,
>   some merged together in commits 99f8891 (v3.11), 2ec1f2d (v3.12)

I guess that this change is not backward compatible, is it?

I guess that we should at least add a check to disable it on older
kernels.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 3/3] device-drivers/rcu/rcu_torture.sh: use default value for nreaders, fix types
       [not found]     ` <54F030D6.5020500@oracle.com>
@ 2015-03-02 11:13       ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2015-03-02 11:13 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> >> * rcutorture module sets nreaders to twice the number of CPUs
> >> * fix rcutorture types, some of them were removed,
> >>    some merged together in commits 99f8891 (v3.11), 2ec1f2d (v3.12)
> > I guess that this change is not backward compatible, is it?
> >
> > I guess that we should at least add a check to disable it on older
> > kernels.
> 
> There're no new rcutorture types here, so the test will run fine on 
> older kernels. The main disadvantage here is that If we run it on older 
> kernels, there will be less tested types. Is it OK or should I add a 
> check to run all previous types on older kernels?

It would be a bit better to change the module parameters depending on
kernel version.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-02 11:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25  9:13 [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module Alexey Kodanev
2015-02-25  9:13 ` [LTP] [PATCH 2/3] runtest/kernel_misc: add lock_torture.sh Alexey Kodanev
2015-02-26 10:10   ` Cyril Hrubis
2015-02-25  9:13 ` [LTP] [PATCH 3/3] device-drivers/rcu/rcu_torture.sh: use default value for nreaders, fix types Alexey Kodanev
2015-02-26 10:12   ` Cyril Hrubis
     [not found]     ` <54F030D6.5020500@oracle.com>
2015-03-02 11:13       ` Cyril Hrubis
2015-02-26 10:09 ` [LTP] [PATCH 1/3] device-drivers/locking: add wrapper for locktorture kernel module Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.