[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200918114424.100852-1-houtao1@huawei.com>
Date: Fri, 18 Sep 2020 19:44:24 +0800
From: Hou Tao <houtao1@...wei.com>
To: "Paul E. McKenney" <paulmck@...nel.org>
CC: Josh Triplett <josh@...htriplett.org>,
Davidlohr Bueso <dave@...olabs.net>,
<linux-kernel@...r.kernel.org>, <rcu@...r.kernel.org>,
<houtao1@...wei.com>
Subject: [PATCH v2 1/2] locktorture: doesn't check nreaders_stress when no readlock support
When do locktorture for exclusive lock which doesn't have readlock
support, the following module parameters will be considered as valid:
torture_type=mutex_lock nwriters_stress=0 nreaders_stress=1
But locktorture will do nothing useful, so instead of permitting
these useless parameters, let's reject these parameters by returning
-EINVAL during module init.
Signed-off-by: Hou Tao <houtao1@...wei.com>
---
kernel/locking/locktorture.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 9cfa5e89cff7f..bebdf98e6cd78 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -868,7 +868,8 @@ static int __init lock_torture_init(void)
goto unwind;
}
- if (nwriters_stress == 0 && nreaders_stress == 0) {
+ if (nwriters_stress == 0 &&
+ (!cxt.cur_ops->readlock || nreaders_stress == 0)) {
pr_alert("lock-torture: must run at least one locking thread\n");
firsterr = -EINVAL;
goto unwind;
--
2.25.0.4.g0ad7144999
Powered by blists - more mailing lists