rcutorture: Fix operator precedence bug in exp_current() invocation
Subsystems (2)
Joel Fernandes
maintainerPATCH 1/1 rcutorture: Fix operator precedence bug in exp_current() invocation
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)
--- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/rcutorture.c +2 -2
@@ -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);
Signature · 1 line
2.34.1
Paul E. McKenney
maintainerQuoted 9 lines · Joel Fernandes
Fix incorrect operator precedence in the conditional that determines when to call
exp_current()during torture testing. The modulo by0xffappears to do nothing.Fix by adding parentheses:
!(torture_random(&rand) % 0xff)Signed-off-by Joel Fernandes <[email protected]>
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.
Thanx, Paul
Quoted 29 lines
--- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/rcu/rcutorture.c +2
-2@@ -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);Signature · 1 line
2.34.1
Joel Fernandes
maintainerQuoted 15 lines · Paul E. McKenney
Quoted 9 lines · Joel Fernandes
Fix incorrect operator precedence in the conditional that determines when to call
exp_current()during torture testing. The modulo by0xffappears to do nothing.Fix by adding parentheses:
!(torture_random(&rand) % 0xff)Signed-off-by Joel Fernandes <[email protected]>
Quoted 7 lines
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
Quoted 32 lines
Thanx, Paul
Quoted 29 lines
---
kernel/rcu/rcutorture.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)kernel/rcu/rcutorture.c +2
-3@@ -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
Steven Rostedt
reviewerQuoted 3 lines · On Mon, 22 Dec 2025 17:12:18 -0800 "Paul E. McKenney" <[email protected]>…
Good eyes, thank you!
Unfortunately, Chris Mason beat you to it:
Was it Chris or his AI? ;-)
-- Steve
Joel Fernandes
maintainerQuoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 22 Dec 2025 17:12:18 -0800 "Paul E. McKenney" <[email protected]>…
Good eyes, thank you!
Unfortunately, Chris Mason beat you to it:
Was it Chris or his AI? ;-)
Does it matter? It is like saying, was it "Chris or his text editor". ;-)
- Joel
Paul E. McKenney
maintainerQuoted 11 lines · Joel Fernandes
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 22 Dec 2025 17:12:18 -0800 "Paul E. McKenney" <[email protected]>…
Good eyes, thank you!
Unfortunately, Chris Mason beat you to it:
Was it Chris or his AI? ;-)
Does it matter? It is like saying, was it "Chris or his text editor". ;-)
Adding Chris on CC for his thoughts on whether it was him or his AI and whether or not this matters. Should he choose to share any thoughts on either topic. ;-)
Thanx, Paul
Joel Fernandes
maintainerQuoted 9 lines · Paul E. McKenney
Quoted 8 lines · Joel Fernandes
Quoted 7 lines · Steven Rostedt
Quoted 3 lines · On Mon, 22 Dec 2025 17:12:18 -0800 "Paul E. McKenney" <[email protected]>…
Good eyes, thank you!
Unfortunately, Chris Mason beat you to it:
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Was it Chris or his AI? ;-)
Does it matter? It is like saying, was it "Chris or his text editor". ;-)
Adding Chris on CC for his thoughts on whether it was him or his AI and whether or not this matters. Should he choose to share any thoughts on either topic. ;-)
"Was it Paul replying here, or was it his email client?" ;-)
Sorry I couldn't help. :-) What is a Christmas holiday if not for poking some fun?
- Joel
Paul E. McKenney
maintainerQuoted 14 lines · Joel Fernandes
Quoted 11 lines · Paul E. McKenney
Quoted 10 lines · Joel Fernandes
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Mon, 22 Dec 2025 17:12:18 -0800 "Paul E. McKenney" <[email protected]>…
Good eyes, thank you!
Unfortunately, Chris Mason beat you to it:
Was it Chris or his AI? ;-)
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Does it matter? It is like saying, was it "Chris or his text editor". ;-)
Adding Chris on CC for his thoughts on whether it was him or his AI and whether or not this matters. Should he choose to share any thoughts on either topic. ;-)
"Was it Paul replying here, or was it his email client?" ;-)
"Yes!!!" ;-)
Quoted 1 line
Sorry I couldn't help. :-) What is a Christmas holiday if not for poking some fun?
No problem!
I was half expecting something along the lines of "Is Paul an AI?" ;-)
Thanx, Paul
Steven Rostedt
reviewerQuoted 9 lines · On Tue, 23 Dec 2025 09:51:19 -0800 "Paul E. McKenney" <[email protected]>…
Quoted 8 lines · Joel Fernandes
Quoted 5 lines · Paul E. McKenney
Quoted 4 lines · Joel Fernandes
Quoted 3 lines · Steven Rostedt
On Mon, 22 Dec 2025 17:12:18 -0800
"Paul E. McKenney" <[email protected]> wrote:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Good eyes, thank you!
Unfortunately, Chris Mason beat you to it:
Was it Chris or his AI? ;-)
Does it matter? It is like saying, was it "Chris or his text editor". ;-)
I think AI is a bit more powerful than a text editor. Unless you think Chris is using emacs?
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Adding Chris on CC for his thoughts on whether it was him or his AI and whether or not this matters. Should he choose to share any thoughts on either topic. ;-)
"Was it Paul replying here, or was it his email client?" ;-)
Quoted 7 lines
"Yes!!!" ;-)
Quoted 1 line
Sorry I couldn't help. :-) What is a Christmas holiday if not for poking some fun?
No problem!
I was half expecting something along the lines of "Is Paul an AI?" ;-)
I guess that begs the question. Is your intelligence artificial? ;-)
-- Steve
Paul E. McKenney
maintainerQuoted 8 lines · Steven Rostedt
Quoted 6 lines · On Tue, 23 Dec 2025 09:51:19 -0800 "Paul E. McKenney" <[email protected]>…
Quoted 5 lines · Joel Fernandes
Quoted 4 lines · Paul E. McKenney
Quoted 3 lines · Joel Fernandes
Quoted 2 lines · Steven Rostedt
On Mon, 22 Dec 2025 17:12:18 -0800
"Paul E. McKenney" <[email protected]> wrote:
[ . . . ]
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Adding Chris on CC for his thoughts on whether it was him or his AI and whether or not this matters. Should he choose to share any thoughts on either topic. ;-)
"Was it Paul replying here, or was it his email client?" ;-)
"Yes!!!" ;-)
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Sorry I couldn't help. :-) What is a Christmas holiday if not for poking some fun?
No problem!
I was half expecting something along the lines of "Is Paul an AI?" ;-)
I guess that begs the question. Is your intelligence artificial? ;-)
My many teachers and mentors along the way would likely argue that they made a difference. That would suggest that at least some of my intelligence is created by the efforts of human beings.
Does that mean that my intelligence is artificial?
Choose your answer carefully. But don't worry about my reaction to it. After all, more than six decades of being incessantly targeted by advertising has made me quite good at ignoring things. ;-)
Thanx, Paul
Steven Rostedt
reviewerQuoted 5 lines · On Tue, 23 Dec 2025 15:50:18 -0800 "Paul E. McKenney" <[email protected]>…
Does that mean that my intelligence is artificial?
Choose your answer carefully. But don't worry about my reaction to it. After all, more than six decades of being incessantly targeted by advertising has made me quite good at ignoring things. ;-)
Paul, I don't think your intelligence is artificial. Heck I usually tell people the two most intelligent kernel developers are you and Al Viro.
Although, maybe all intelligence is artificial? Who knows?
-- Steve
Paul E. McKenney
maintainerQuoted 11 lines · Steven Rostedt
Quoted 5 lines · On Tue, 23 Dec 2025 15:50:18 -0800 "Paul E. McKenney" <[email protected]>…
Does that mean that my intelligence is artificial?
Choose your answer carefully. But don't worry about my reaction to it. After all, more than six decades of being incessantly targeted by advertising has made me quite good at ignoring things. ;-)
Paul, I don't think your intelligence is artificial. Heck I usually tell people the two most intelligent kernel developers are you and Al Viro.
Thank you for that high praise, but I fear that you might be selling Al short. His ability to dive into random code and find issues is truly impressive. Maybe we need him to teach the LLMs a thing or two?
Quoted 1 line
Although, maybe all intelligence is artificial? Who knows?
We each can choose our definitions to get whatever answer we want. What could go wrong? ;-)
Thanx, Paul
Quoted 14 lines · Steven Rostedt
Quoted 11 lines · On Tue, 23 Dec 2025 09:51:19 -0800 "Paul E. McKenney" <[email protected]>…
Quoted 10 lines · Joel Fernandes
Quoted 7 lines · Paul E. McKenney
Quoted 6 lines · Joel Fernandes
Quoted 5 lines · Steven Rostedt
Quoted 2 lines · On Mon, 22 Dec 2025 17:12:18 -0800 "Paul E. McKenney" <[email protected]>…
Good eyes, thank you!
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Unfortunately, Chris Mason beat you to it:
Was it Chris or his AI? ;-)
Does it matter? It is like saying, was it "Chris or his text editor". ;-)
I think AI is a bit more powerful than a text editor. Unless you think Chris is using emacs?
In the interest of full disclosure, this review came from a local version of my prompts that told AI to review as though it was a kernel developer who preferred vi over emacs.
-chris