From: "Paul E. McKenney" <paulmck@kernel.org>
To: Hou Tao <houtao1@huawei.com>
Cc: Josh Triplett <josh@joshtriplett.org>,
Davidlohr Bueso <dave@stgolabs.net>,
linux-kernel@vger.kernel.org, rcu@vger.kernel.org
Subject: Re: [PATCH v2 1/2] locktorture: doesn't check nreaders_stress when no readlock support
Date: Fri, 18 Sep 2020 10:59:11 -0700 [thread overview]
Message-ID: <20200918175911.GV29330@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20200918114424.100852-1-houtao1@huawei.com>
On Fri, Sep 18, 2020 at 07:44:24PM +0800, Hou Tao wrote:
> 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@huawei.com>
Much better, much easier for people a year from now to understand.
Queued for v5.11, thank you!
I did edit the commit log a bit as shown below, so please let me
know if I messed anything up.
Thanx, Paul
commit 4985c52e3b5237666265e59f56856f485ee36e71
Author: Hou Tao <houtao1@huawei.com>
Date: Fri Sep 18 19:44:24 2020 +0800
locktorture: Ignore nreaders_stress if no readlock support
Exclusive locks do not have readlock support, which means that a
locktorture run with the following module parameters will do nothing:
torture_type=mutex_lock nwriters_stress=0 nreaders_stress=1
This commit therefore rejects this combination for exclusive locks by
returning -EINVAL during module init.
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 316531d..046ea2d 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -870,7 +870,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;
next prev parent reply other threads:[~2020-09-18 17:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 13:59 [PATCH 0/2] two tiny fixes for locktorture Hou Tao
2020-09-17 13:59 ` [PATCH 1/2] locktorture: doesn't check nreaders_stress when no readlock support Hou Tao
2020-09-17 16:58 ` Paul E. McKenney
2020-09-18 1:13 ` Hou Tao
2020-09-18 3:37 ` Paul E. McKenney
2020-09-18 11:44 ` [PATCH v2 " Hou Tao
2020-09-18 17:59 ` Paul E. McKenney [this message]
2020-09-19 3:25 ` Hou Tao
2020-09-17 13:59 ` [PATCH 2/2] locktorture: call percpu_free_rwsem() to do percpu-rwsem cleanup Hou Tao
2020-09-22 23:24 ` Paul E. McKenney
2020-09-23 2:24 ` Hou Tao
2020-09-23 3:51 ` Paul E. McKenney
2020-09-24 14:18 ` [PATCH v2 " Hou Tao
2020-09-25 17:13 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200918175911.GV29330@paulmck-ThinkPad-P72 \
--to=paulmck@kernel.org \
--cc=dave@stgolabs.net \
--cc=houtao1@huawei.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rcu@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox