mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <lianglihao@huawei.com>
To: <paulmck@linux.vnet.ibm.com>
Cc: <guohanjun@huawei.com>, <lihao.liang@gmail.com>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] rcutorture: Add tests of param usage warnings
Date: Wed, 6 Dec 2017 18:51:08 +0800	[thread overview]
Message-ID: <1512557468-52633-3-git-send-email-lianglihao@huawei.com> (raw)
In-Reply-To: <1512557468-52633-1-git-send-email-lianglihao@huawei.com>

From: Lihao Liang <lianglihao@huawei.com>

Test the first patch of this patch series

Signed-off-by: Lihao Liang <lianglihao@huawei.com>
---

This patch is for testing purposes only and is not intended to be merged.
It seems that the scripts didn’t pick up the lines in BUSTED02.boot that
set the value of gp_normal and gp_exp. But when I hard-coded gp_normal to
true in rcutorture.c, it did print out "rcu_torture_writer3: gp_sync
without primitives" as expected.


 kernel/rcu/rcutorture.c                                    | 14 ++++++++------
 tools/testing/selftests/rcutorture/configs/rcu/BUSTED02    |  7 +++++++
 .../testing/selftests/rcutorture/configs/rcu/BUSTED02.boot |  1 +
 tools/testing/selftests/rcutorture/configs/rcu/CFLIST      |  2 ++
 4 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/BUSTED02
 create mode 100644 tools/testing/selftests/rcutorture/configs/rcu/BUSTED02.boot

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index d2abebd..233be41 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -465,10 +465,12 @@ static void rcu_busted_torture_deferred_free(struct rcu_torture *p)
 	rcu_torture_cb(&p->rtort_rcu);
 }
 
+#if 0
 static void synchronize_rcu_busted(void)
 {
 	/* This is a deliberate bug for testing purposes only! */
 }
+#endif
 
 static void
 call_rcu_busted(struct rcu_head *head, rcu_callback_t func)
@@ -486,8 +488,8 @@ static struct rcu_torture_ops rcu_busted_ops = {
 	.started	= rcu_no_completed,
 	.completed	= rcu_no_completed,
 	.deferred_free	= rcu_busted_torture_deferred_free,
-	.sync		= synchronize_rcu_busted,
-	.exp_sync	= synchronize_rcu_busted,
+	.sync		= NULL,
+	.exp_sync	= NULL,
 	.call		= call_rcu_busted,
 	.cb_barrier	= NULL,
 	.fqs		= NULL,
@@ -939,13 +941,13 @@ rcu_torture_writer(void *arg)
 		pr_alert("%s: gp_sync without primitives.\n", __func__);
 	if (gp_normal == gp_exp) {
 		if (!cur_ops->sync)
-			pr_alert("%s: gp_sync without primitives.\n", __func__);
+			pr_alert("%s 1: gp_sync without primitives.\n", __func__);
 		if (!cur_ops->exp_sync)
-			pr_alert("%s: gp_exp without primitives.\n", __func__);
+			pr_alert("%s 2: gp_exp without primitives.\n", __func__);
 	} else if (gp_normal && !cur_ops->sync) {
-		pr_alert("%s: gp_sync without primitives.\n", __func__);
+		pr_alert("%s 3: gp_sync without primitives.\n", __func__);
 	} else if (gp_exp && !cur_ops->exp_sync) {
-		pr_alert("%s: gp_exp without primitives.\n", __func__);
+		pr_alert("%s 4: gp_exp without primitives.\n", __func__);
 	}
 	if (WARN_ONCE(nsynctypes == 0,
 		      "rcu_torture_writer: No update-side primitives.\n")) {
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/BUSTED02 b/tools/testing/selftests/rcutorture/configs/rcu/BUSTED02
new file mode 100644
index 0000000..48d8a24
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/rcu/BUSTED02
@@ -0,0 +1,7 @@
+CONFIG_RCU_TRACE=n
+CONFIG_SMP=y
+CONFIG_NR_CPUS=4
+CONFIG_HOTPLUG_CPU=y
+CONFIG_PREEMPT_NONE=n
+CONFIG_PREEMPT_VOLUNTARY=n
+CONFIG_PREEMPT=y
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/BUSTED02.boot b/tools/testing/selftests/rcutorture/configs/rcu/BUSTED02.boot
new file mode 100644
index 0000000..40cf978
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/configs/rcu/BUSTED02.boot
@@ -0,0 +1 @@
+rcutorture.torture_type=busted rcutorture.gp_normal=true rcutorture.gp_sync=false
diff --git a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST
index 6a0b9f6..e91f8b5 100644
--- a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST
+++ b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST
@@ -16,3 +16,5 @@ TINY02
 TASKS01
 TASKS02
 TASKS03
+BUSTED
+BUSTED02
-- 
2.7.4

      parent reply	other threads:[~2017-12-06 11:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 10:51 [PATCH 0/2] rcutorture: Add parameter " lianglihao
2017-12-06 10:51 ` [PATCH 1/2] rcutorture: Add usage warnings for parameters gp_normal and gp_exp lianglihao
2017-12-07  0:23   ` Paul E. McKenney
2017-12-06 10:51 ` lianglihao [this message]

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=1512557468-52633-3-git-send-email-lianglihao@huawei.com \
    --to=lianglihao@huawei.com \
    --cc=guohanjun@huawei.com \
    --cc=lihao.liang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®