Re: [v2,05/12] rcutorture: Add tests for SRCU up/down reader primitives

Joel Fernandes
2025-04-08T20:18:09Z

Hello, Paul,

On Tue, 8 Apr 2025 20:16:08 GMT, "Paul E. McKenney" wrote:
> This commit adds a new rcutorture.n_up_down kernel boot parameter
> that specifies the number of outstanding SRCU up/down readers, which
> begin in kthread context and end in an hrtimer handler. There is a new
> kthread ("rcu_torture_updown") that scans an per-reader array looking
> for elements whose readers have ended. This kthread sleeps between one
> and two milliseconds between consecutive scans.
>
> [ paulmck: Apply kernel test robot feedback. ]
> [ paulmck: Apply Z qiang feedback. ]
>
[...]
> + for (i = 0; i < n_up_down; i++) {
> + init_rcu_torture_one_read_state(&updownreaders[i].rtorsu_rtors, rand);
> + hrtimer_init(&updownreaders[i].rtorsu_hrt, CLOCK_MONOTONIC,
> + HRTIMER_MODE_REL | HRTIMER_MODE_SOFT);

This will now fail to build and needs the following: I will squash it into my
for-next branch into this patch, but let me know if you prefer to provide an
update.

Fix build error by converting hrtimer_init to hrtimer_setup, see:
https://lore.kernel.org/all/174384280127.31282.2714486346304643188.tip-bot2@tip-bot2/

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 4f0a00a8bdee..14a22ef3b56f 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -2480,9 +2480,8 @@ static int rcu_torture_updown_init(void)
}
for (i = 0; i < n_up_down; i++) {
init_rcu_torture_one_read_state(&updownreaders[i].rtorsu_rtors, rand);
- hrtimer_init(&updownreaders[i].rtorsu_hrt, CLOCK_MONOTONIC,
- HRTIMER_MODE_REL | HRTIMER_MODE_SOFT);
- updownreaders[i].rtorsu_hrt.function = rcu_torture_updown_hrt;
+ hrtimer_setup(&updownreaders[i].rtorsu_hrt,
rcu_torture_updown_hrt, CLOCK_MONOTONIC,
+ HRTIMER_MODE_REL | HRTIMER_MODE_SOFT);
torture_random_init(&updownreaders[i].rtorsu_trs);
init_rcu_torture_one_read_state(&updownreaders[i].rtorsu_rtors,
&updownreaders[i].rtorsu_trs);

Thanks.