History

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.

Paul E. McKenney committed 5 years ago

Commit b3b3cc61 parent efeff6b1 file · +7 −7Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/locking/locktorture.c+7−7
@@ -1022,23 +1022,23 @@ static int __init lock_torture_init(void) · 1021 unmodified lines
10221022 if (onoff_interval > 0) {
10231023 firsterr = torture_onoff_init(onoff_holdoff * HZ,
10241024 onoff_interval * HZ, NULL);
1025− if (firsterr)
1025+ if (torture_init_error(firsterr))
10261026 goto unwind;
10271027 }
10281028 if (shuffle_interval > 0) {
10291029 firsterr = torture_shuffle_init(shuffle_interval);
1030− if (firsterr)
1030+ if (torture_init_error(firsterr))
10311031 goto unwind;
10321032 }
10331033 if (shutdown_secs > 0) {
10341034 firsterr = torture_shutdown_init(shutdown_secs,
10351035 lock_torture_cleanup);
1036− if (firsterr)
1036+ if (torture_init_error(firsterr))
10371037 goto unwind;
10381038 }
10391039 if (stutter > 0) {
10401040 firsterr = torture_stutter_init(stutter, stutter);
1041− if (firsterr)
1041+ if (torture_init_error(firsterr))
10421042 goto unwind;
10431043 }
10441044
@@ -1082,7 +1082,7 @@ static int __init lock_torture_init(void) · 37 unmodified lines
10821082 /* Create writer. */
10831083 firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i],
10841084 writer_tasks[i]);
1085− if (firsterr)
1085+ if (torture_init_error(firsterr))
10861086 goto unwind;
10871087
10881088 create_reader:
@@ -1091,13 +1091,13 @@ static int __init lock_torture_init(void) · 2 unmodified lines
10911091 /* Create reader. */
10921092 firsterr = torture_create_kthread(lock_torture_reader, &cxt.lrsa[j],
10931093 reader_tasks[j]);
1094− if (firsterr)
1094+ if (torture_init_error(firsterr))
10951095 goto unwind;
10961096 }
10971097 if (stat_interval > 0) {
10981098 firsterr = torture_create_kthread(lock_torture_stats, NULL,
10991099 stats_task);
1100− if (firsterr)
1100+ if (torture_init_error(firsterr))
11011101 goto unwind;
11021102 }
11031103 torture_init_end();