Skip to content

Commit fd13fe1

Browse files
committed
rcutorture: Don't cpuhp_remove_state() if cpuhp_setup_state() failed
Currently, in CONFIG_RCU_BOOST kernels, if the rcu_torture_init() function's call to cpuhp_setup_state() fails, rcu_torture_cleanup() gamely passes nonsense to cpuhp_remove_state(). This results in strange and misleading splats. This commit therefore ensures that if the rcu_torture_init() function's call to cpuhp_setup_state() fails, rcu_torture_cleanup() avoids invoking cpuhp_remove_state(). Signed-off-by: Paul E. McKenney <[email protected]>
1 parent eb77abf commit fd13fe1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/rcu/rcutorture.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,7 @@ rcu_torture_cleanup(void)
28192819
rcutorture_seq_diff(gp_seq, start_gp_seq));
28202820
torture_stop_kthread(rcu_torture_stats, stats_task);
28212821
torture_stop_kthread(rcu_torture_fqs, fqs_task);
2822-
if (rcu_torture_can_boost())
2822+
if (rcu_torture_can_boost() && rcutor_hp >= 0)
28232823
cpuhp_remove_state(rcutor_hp);
28242824

28252825
/*
@@ -3132,9 +3132,9 @@ rcu_torture_init(void)
31323132
firsterr = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "RCU_TORTURE",
31333133
rcutorture_booster_init,
31343134
rcutorture_booster_cleanup);
3135+
rcutor_hp = firsterr;
31353136
if (torture_init_error(firsterr))
31363137
goto unwind;
3137-
rcutor_hp = firsterr;
31383138

31393139
// Testing RCU priority boosting requires rcutorture do
31403140
// some serious abuse. Counter this by running ksoftirqd

0 commit comments

Comments
 (0)