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 1/2] rcutorture: Add usage warnings for parameters gp_normal and gp_exp
Date: Wed, 6 Dec 2017 18:51:07 +0800	[thread overview]
Message-ID: <1512557468-52633-2-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>

In rcu_torture_fakewriter(), when param gp_normal is equal to
gp_exp (even when they are false), both cur_ops->sync() and
cur_ops->exp_sync() may be invoked. This commit checks that
if any of them is NULL, it will print out a warning message.
It also emits a warning if gp_normal is true but cur_ops->sync()
is NULL.

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

I think the last else-if block is redundant and I choose to include it
for completeness. In addition, it may be better to have more informative
warning messages for the new if-else blocks. Feel free to revise them.

 kernel/rcu/rcutorture.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index d1b64dc..d2abebd 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -937,6 +937,16 @@ rcu_torture_writer(void *arg)
 		synctype[nsynctypes++] = RTWS_SYNC;
 	else if (gp_sync && !cur_ops->sync)
 		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__);
+		if (!cur_ops->exp_sync)
+			pr_alert("%s: gp_exp without primitives.\n", __func__);
+	} else if (gp_normal && !cur_ops->sync) {
+		pr_alert("%s: gp_sync without primitives.\n", __func__);
+	} else if (gp_exp && !cur_ops->exp_sync) {
+		pr_alert("%s: gp_exp without primitives.\n", __func__);
+	}
 	if (WARN_ONCE(nsynctypes == 0,
 		      "rcu_torture_writer: No update-side primitives.\n")) {
 		/*
-- 
2.7.4

  reply	other threads:[~2017-12-06 10:59 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 usage warnings lianglihao
2017-12-06 10:51 ` lianglihao [this message]
2017-12-07  0:23   ` [PATCH 1/2] rcutorture: Add usage warnings for parameters gp_normal and gp_exp Paul E. McKenney
2017-12-06 10:51 ` [PATCH 2/2] rcutorture: Add tests of param usage warnings lianglihao

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-2-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®