From: "Paul E. McKenney" <paulmck@kernel.org>
To: Zqiang <qiang.zhang1211@gmail.com>
Cc: frederic@kernel.org, neeraj.upadhyay@kernel.org,
joel@joelfernandes.org, rcu@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rcutorture: Make the rcu_gp_slow_register/unregister() be used only for rcutype test
Date: Mon, 1 Apr 2024 09:09:13 -0700 [thread overview]
Message-ID: <9c1624cf-5c7e-4717-9f0c-ba6cbbba08ff@paulmck-laptop> (raw)
In-Reply-To: <20240329045245.16456-1-qiang.zhang1211@gmail.com>
On Fri, Mar 29, 2024 at 12:52:45PM +0800, Zqiang wrote:
> The rcu_gp_slow_register/unregister() is only valid for tests which
> the torture_type is rcu, this commit therefore generates gp_slow_register
> and gp_slow_unregister function pointers in rcu_torture_ops structures,
> and operates only when the function pointer exists.
>
> Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
Good point, queued, thank you!
Thanx, Paul
> ---
> kernel/rcu/rcutorture.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> index 8654e99bd4a3..32f1c4e932eb 100644
> --- a/kernel/rcu/rcutorture.c
> +++ b/kernel/rcu/rcutorture.c
> @@ -382,6 +382,8 @@ struct rcu_torture_ops {
> bool (*check_boost_failed)(unsigned long gp_state, int *cpup);
> int (*stall_dur)(void);
> void (*get_gp_data)(int *flags, unsigned long *gp_seq);
> + void (*gp_slow_register)(atomic_t *rgssp);
> + void (*gp_slow_unregister)(atomic_t *rgssp);
> long cbflood_max;
> int irq_capable;
> int can_boost;
> @@ -570,6 +572,8 @@ static struct rcu_torture_ops rcu_ops = {
> .check_boost_failed = rcu_check_boost_fail,
> .stall_dur = rcu_jiffies_till_stall_check,
> .get_gp_data = rcutorture_get_gp_data,
> + .gp_slow_register = rcu_gp_slow_register,
> + .gp_slow_unregister = rcu_gp_slow_unregister,
> .irq_capable = 1,
> .can_boost = IS_ENABLED(CONFIG_RCU_BOOST),
> .extendables = RCUTORTURE_MAX_EXTEND,
> @@ -3343,12 +3347,12 @@ rcu_torture_cleanup(void)
> pr_info("%s: Invoking %pS().\n", __func__, cur_ops->cb_barrier);
> cur_ops->cb_barrier();
> }
> - rcu_gp_slow_unregister(NULL);
> + if (cur_ops->gp_slow_unregister)
> + cur_ops->gp_slow_unregister(NULL);
> return;
> }
> if (!cur_ops) {
> torture_cleanup_end();
> - rcu_gp_slow_unregister(NULL);
> return;
> }
>
> @@ -3447,7 +3451,8 @@ rcu_torture_cleanup(void)
> else
> rcu_torture_print_module_parms(cur_ops, "End of test: SUCCESS");
> torture_cleanup_end();
> - rcu_gp_slow_unregister(&rcu_fwd_cb_nodelay);
> + if (cur_ops->gp_slow_unregister)
> + cur_ops->gp_slow_unregister(NULL);
> }
>
> #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
> @@ -3929,7 +3934,8 @@ rcu_torture_init(void)
> if (object_debug)
> rcu_test_debug_objects();
> torture_init_end();
> - rcu_gp_slow_register(&rcu_fwd_cb_nodelay);
> + if (cur_ops->gp_slow_register)
> + cur_ops->gp_slow_register(&rcu_fwd_cb_nodelay);
> return 0;
>
> unwind:
> --
> 2.17.1
>
prev parent reply other threads:[~2024-04-01 16:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 4:52 [PATCH] rcutorture: Make the rcu_gp_slow_register/unregister() be used only for rcutype test Zqiang
2024-04-01 16:09 ` Paul E. McKenney [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=9c1624cf-5c7e-4717-9f0c-ba6cbbba08ff@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=qiang.zhang1211@gmail.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).