Commit b3b3cc61 authored by Paul E. McKenney's avatar Paul E. McKenney

locktorture: Warn on individual lock_torture_init() error conditions

When running locktorture as a module, any lock_torture_init() issues will be
reflected in the error code from modprobe or insmod, as the case may be.
However, these error codes are not available when running locktorture
built-in, for example, when using the kvm.sh script.  This commit
therefore adds WARN_ON_ONCE() to allow distinguishing lock_torture_init()
errors when running locktorture built-in.
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent efeff6b3
...@@ -1022,23 +1022,23 @@ static int __init lock_torture_init(void) ...@@ -1022,23 +1022,23 @@ static int __init lock_torture_init(void)
if (onoff_interval > 0) { if (onoff_interval > 0) {
firsterr = torture_onoff_init(onoff_holdoff * HZ, firsterr = torture_onoff_init(onoff_holdoff * HZ,
onoff_interval * HZ, NULL); onoff_interval * HZ, NULL);
if (firsterr) if (torture_init_error(firsterr))
goto unwind; goto unwind;
} }
if (shuffle_interval > 0) { if (shuffle_interval > 0) {
firsterr = torture_shuffle_init(shuffle_interval); firsterr = torture_shuffle_init(shuffle_interval);
if (firsterr) if (torture_init_error(firsterr))
goto unwind; goto unwind;
} }
if (shutdown_secs > 0) { if (shutdown_secs > 0) {
firsterr = torture_shutdown_init(shutdown_secs, firsterr = torture_shutdown_init(shutdown_secs,
lock_torture_cleanup); lock_torture_cleanup);
if (firsterr) if (torture_init_error(firsterr))
goto unwind; goto unwind;
} }
if (stutter > 0) { if (stutter > 0) {
firsterr = torture_stutter_init(stutter, stutter); firsterr = torture_stutter_init(stutter, stutter);
if (firsterr) if (torture_init_error(firsterr))
goto unwind; goto unwind;
} }
...@@ -1082,7 +1082,7 @@ static int __init lock_torture_init(void) ...@@ -1082,7 +1082,7 @@ static int __init lock_torture_init(void)
/* Create writer. */ /* Create writer. */
firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i], firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i],
writer_tasks[i]); writer_tasks[i]);
if (firsterr) if (torture_init_error(firsterr))
goto unwind; goto unwind;
create_reader: create_reader:
...@@ -1091,13 +1091,13 @@ static int __init lock_torture_init(void) ...@@ -1091,13 +1091,13 @@ static int __init lock_torture_init(void)
/* Create reader. */ /* Create reader. */
firsterr = torture_create_kthread(lock_torture_reader, &cxt.lrsa[j], firsterr = torture_create_kthread(lock_torture_reader, &cxt.lrsa[j],
reader_tasks[j]); reader_tasks[j]);
if (firsterr) if (torture_init_error(firsterr))
goto unwind; goto unwind;
} }
if (stat_interval > 0) { if (stat_interval > 0) {
firsterr = torture_create_kthread(lock_torture_stats, NULL, firsterr = torture_create_kthread(lock_torture_stats, NULL,
stats_task); stats_task);
if (firsterr) if (torture_init_error(firsterr))
goto unwind; goto unwind;
} }
torture_init_end(); torture_init_end();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment