Skip to contentSkip to conversation

torture-test changes for 4.4

PATCH In review Paul E. McKenney 2 participants 8 messages Oct 6, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover torture-test changes for 4.4

Hello!

This series contains torture-test changes:

1. Fix module unwind when bad torture_type specified to rcutorture.

2. Fix unused-function warning for torturing_tasks().

3. Forgive non-plural arguments.

4. Fix module unwind when bad torture_type specified to locktorture.

Thanx, Paul

------------------------------------------------------------------------

 b/kernel/locking/locktorture.c                  |    6 +++---
 b/kernel/rcu/rcutorture.c                       |    8 ++++----
 b/tools/testing/selftests/rcutorture/bin/kvm.sh |    6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)
#4 lore raw

PATCH 4/4 locktorture: Fix module unwind when bad torture_type specified

In reply to Paul E. McKenney

The locktorture module has a list of torture types, and specifying a type not on this list is supposed to cleanly fail the module load. Unfortunately, the "fail" happens without the "cleanly". This commit therefore adds the needed clean-up after an incorrect torture_type.

---
 kernel/locking/locktorture.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/locking/locktorture.c +3 -3
index 32244186f1f2..820852f69858 100644
@@ -661,11 +661,11 @@ static int __init lock_torture_init(void)
 		for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
 			pr_alert(" %s", torture_ops[i]->name);
 		pr_alert("\n");
-		torture_init_end();
-		return -EINVAL;
+		firsterr = -EINVAL;
+		goto unwind;
 	}
 	if (cxt.cur_ops->init)
-		cxt.cur_ops->init(); /* no "goto unwind" prior to this point!!! */
+		cxt.cur_ops->init();
 
 	if (nwriters_stress >= 0)
 		cxt.nrealwriters_stress = nwriters_stress;
Signature · 1 line
2.5.2
#3 lore raw

PATCH 3/4 torture: Forgive non-plural arguments

In reply to Paul E. McKenney

This commit allows --bootarg instead of --bootargs, --config instead of --configs, and --qemu-arg instead of --qemu-args. For those cases where a native English speaker might auto-correct the argument to be incorrect.

---
 tools/testing/selftests/rcutorture/bin/kvm.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm.sh +3 -3
index fbe2dbff1e21..f6483609ebc2 100755
@@ -75,7 +75,7 @@ usage () {
 while test $# -gt 0
 do
 	case "$1" in
-	--bootargs)
+	--bootargs|--bootarg)
 		checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
 		TORTURE_BOOTARGS="$2"
 		shift
@@ -88,7 +88,7 @@ do
 	--buildonly)
 		TORTURE_BUILDONLY=1
 		;;
-	--configs)
+	--configs|--config)
 		checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
 		configs="$2"
 		shift
@@ -134,7 +134,7 @@ do
 	--no-initrd)
 		TORTURE_INITRD=""; export TORTURE_INITRD
 		;;
-	--qemu-args)
+	--qemu-args|--qemu-arg)
 		checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
 		TORTURE_QEMU_ARG="$2"
 		shift
Signature · 1 line
2.5.2
#1 lore raw

PATCH 1/4 rcutorture: Fix module unwind when bad torture_type specified

In reply to Paul E. McKenney

The rcutorture module has a list of torture types, and specifying a type not on this list is supposed to cleanly fail the module load. Unfortunately, the "fail" happens without the "cleanly". This commit therefore adds the needed clean-up after an incorrect torture_type.

---
 kernel/rcu/rcutorture.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/rcutorture.c +3 -3
index 77192953dee5..b74b56474e17 100644
@@ -1742,15 +1742,15 @@ rcu_torture_init(void)
 		for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
 			pr_alert(" %s", torture_ops[i]->name);
 		pr_alert("\n");
-		torture_init_end();
-		return -EINVAL;
+		firsterr = -EINVAL;
+		goto unwind;
 	}
 	if (cur_ops->fqs == NULL && fqs_duration != 0) {
 		pr_alert("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n");
 		fqs_duration = 0;
 	}
 	if (cur_ops->init)
-		cur_ops->init(); /* no "goto unwind" prior to this point!!! */
+		cur_ops->init();
 
 	if (nreaders >= 0) {
 		nrealreaders = nreaders;
Signature · 1 line
2.5.2
#2 lore raw

PATCH 2/4 rcutorture: Fix unused-function warning for torturing_tasks()

The torturing_tasks() function is used only in kernels built with CONFIG_PROVE_RCU=y, so the second definition can result in unused-function compiler warnings. This commit adds __maybe_unused to suppress these warnings.

---
 kernel/rcu/rcutorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/rcutorture.c +1 -1
index b74b56474e17..009b62c76dfa 100644
@@ -695,7 +695,7 @@ static bool __maybe_unused torturing_tasks(void)
 
 #define RCUTORTURE_TASKS_OPS
 
-static bool torturing_tasks(void)
+static bool __maybe_unused torturing_tasks(void)
 {
 	return false;
 }
Signature · 1 line
2.5.2
maintainer Reviewed-by on v1 1/4
#5 lore raw

Re: [PATCH tip/core/rcu 1/4] rcutorture: Fix module unwind when bad torture_type specified

In reply to Paul E. McKenney
Quoted 8 lines · Paul E. McKenney

The rcutorture module has a list of torture types, and specifying a type not on this list is supposed to cleanly fail the module load. Unfortunately, the "fail" happens without the "cleanly". This commit therefore adds the needed clean-up after an incorrect torture_type.

After a careful review of rcu_torture_cleanup and the cur_ops->init() functions to verify that the dire comment about not using "goto unwind" doesn't actually apply (rcu_torture_cleanup *seems* to handle lack of init), this seems fine.

Quoted 29 lines
 kernel/rcu/rcutorture.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/rcutorture.c +3 -3
index 77192953dee5..b74b56474e17 100644
@@ -1742,15 +1742,15 @@ rcu_torture_init(void)
 		for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
 			pr_alert(" %s", torture_ops[i]->name);
 		pr_alert("\n");
-		torture_init_end();
-		return -EINVAL;
+		firsterr = -EINVAL;
+		goto unwind;
 	}
 	if (cur_ops->fqs == NULL && fqs_duration != 0) {
 		pr_alert("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n");
 		fqs_duration = 0;
 	}
 	if (cur_ops->init)
-		cur_ops->init(); /* no "goto unwind" prior to this point!!! */
+		cur_ops->init();
 
 	if (nreaders >= 0) {
 		nrealreaders = nreaders;
Signature · 1 line
2.5.2
maintainer Reviewed-by on the v1 series
#7 lore raw
In reply to Paul E. McKenney
Quoted 11 lines · Paul E. McKenney

Hello!

This series contains torture-test changes:

1. Fix module unwind when bad torture_type specified to rcutorture.

2. Fix unused-function warning for torturing_tasks().

3. Forgive non-plural arguments.

4. Fix module unwind when bad torture_type specified to locktorture.

For all four:

#6 lore raw

Re: [PATCH tip/core/rcu 1/4] rcutorture: Fix module unwind when bad torture_type specified

In reply to Josh Triplett
Quoted 6 lines · Josh Triplett
Quoted 5 lines · Paul E. McKenney

The rcutorture module has a list of torture types, and specifying a type not on this list is supposed to cleanly fail the module load. Unfortunately, the "fail" happens without the "cleanly". This commit therefore adds the needed clean-up after an incorrect torture_type.

Quoted 8 lines
Quoted 3 lines

After a careful review of rcu_torture_cleanup and the cur_ops->init() functions to verify that the dire comment about not using "goto unwind" doesn't actually apply (rcu_torture_cleanup *seems* to handle lack of init), this seems fine.

I was indeed a bit nervous about removing that comment, so thank you for checking up on it! (Can't be bothered to go back and figure out if it ever really was relevant...)

Thanx, Paul

Quoted 32 lines
Quoted 29 lines
 kernel/rcu/rcutorture.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/rcutorture.c +3 -3
index 77192953dee5..b74b56474e17 100644
@@ -1742,15 +1742,15 @@ rcu_torture_init(void)
 		for (i = 0; i < ARRAY_SIZE(torture_ops); i++)
 			pr_alert(" %s", torture_ops[i]->name);
 		pr_alert("\n");
-		torture_init_end();
-		return -EINVAL;
+		firsterr = -EINVAL;
+		goto unwind;
 	}
 	if (cur_ops->fqs == NULL && fqs_duration != 0) {
 		pr_alert("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n");
 		fqs_duration = 0;
 	}
 	if (cur_ops->init)
-		cur_ops->init(); /* no "goto unwind" prior to this point!!! */
+		cur_ops->init();
 
 	if (nreaders >= 0) {
 		nrealreaders = nreaders;
Signature · 1 line
2.5.2