From: Joel Fernandes <joelagnelf@nvidia.com>
To: "paulmck@kernel.org" <paulmck@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Josh Triplett <josh@joshtriplett.org>,
Frederic Weisbecker <frederic@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>,
Uladzislau Rezki <urezki@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Zqiang <qiang.zhang@linux.dev>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>
Subject: Re: [PATCH] rcutorture: Fix operator precedence bug in exp_current() invocation
Date: Tue, 23 Dec 2025 01:24:21 +0000 [thread overview]
Message-ID: <A7C75238-E17D-4288-8A2B-5BC62CBB5FD8@nvidia.com> (raw)
In-Reply-To: <4bbae00e-f078-4f1e-a1e0-b1cdc72981de@paulmck-laptop>
> On Dec 22, 2025, at 8:12 PM, Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Mon, Dec 22, 2025 at 07:44:07PM -0500, Joel Fernandes wrote:
>> Fix incorrect operator precedence in the conditional that determines
>> when to call exp_current() during torture testing. The modulo
>> by 0xff appears to do nothing.
>>
>> Fix by adding parentheses:
>>
>> !(torture_random(&rand) % 0xff)
>>
>> Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
>
> Good eyes, thank you!
>
> Unfortunately, Chris Mason beat you to it:
>
> 50d8a5d2a94c ("rcutorture: Correctly compute probability to invoke ->exp_current()")
>
> I will add your Reported-by to that commit on my next rebase.
Ah, nice thanks.
- Joel
>
> Thanx, Paul
>
>> ---
>> kernel/rcu/rcutorture.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
>> index 82588ceed9da..9873a1d54c46 100644
>> --- a/kernel/rcu/rcutorture.c
>> +++ b/kernel/rcu/rcutorture.c
>> @@ -1749,7 +1749,7 @@ rcu_torture_writer(void *arg)
>> ulo[i] = cur_ops->get_comp_state();
>> gp_snap = cur_ops->start_gp_poll();
>> rcu_torture_writer_state = RTWS_POLL_WAIT;
>> - if (cur_ops->exp_current && !torture_random(&rand) % 0xff)
>> + if (cur_ops->exp_current && !(torture_random(&rand) % 0xff))
>> cur_ops->exp_current();
>> while (!cur_ops->poll_gp_state(gp_snap)) {
>> gp_snap1 = cur_ops->get_gp_state();
>> @@ -1771,7 +1771,7 @@ rcu_torture_writer(void *arg)
>> cur_ops->get_comp_state_full(&rgo[i]);
>> cur_ops->start_gp_poll_full(&gp_snap_full);
>> rcu_torture_writer_state = RTWS_POLL_WAIT_FULL;
>> - if (cur_ops->exp_current && !torture_random(&rand) % 0xff)
>> + if (cur_ops->exp_current && !(torture_random(&rand) % 0xff))
>> cur_ops->exp_current();
>> while (!cur_ops->poll_gp_state_full(&gp_snap_full)) {
>> cur_ops->get_gp_state_full(&gp_snap1_full);
>> --
>> 2.34.1
>>
next prev parent reply other threads:[~2025-12-23 1:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 0:44 Joel Fernandes
2025-12-23 1:12 ` Paul E. McKenney
2025-12-23 1:24 ` Joel Fernandes [this message]
2025-12-23 16:37 ` Steven Rostedt
2025-12-23 17:22 ` Joel Fernandes
2025-12-23 17:28 ` Paul E. McKenney
2025-12-23 17:30 ` Joel Fernandes
2025-12-23 17:51 ` Paul E. McKenney
2025-12-23 20:54 ` Steven Rostedt
2025-12-23 23:50 ` Paul E. McKenney
2025-12-24 14:14 ` Steven Rostedt
2025-12-25 18:43 ` Paul E. McKenney
2025-12-24 0:50 ` Chris Mason
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=A7C75238-E17D-4288-8A2B-5BC62CBB5FD8@nvidia.com \
--to=joelagnelf@nvidia.com \
--cc=boqun.feng@gmail.com \
--cc=dave@stgolabs.net \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=qiang.zhang@linux.dev \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=urezki@gmail.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®