Skip to content

Commit 36bbbd0

Browse files
committed
Merge branch 'rcu/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
Pull RCU fix from Paul McKenney: "This is a fix for a regression in the v5.10 merge window, but it was reported quite late in the v5.10 process, plus generating and testing the fix took some time. The regression is due to commit 36dadef ("kprobes: Init kprobes in early_initcall") which on powerpc can use RCU Tasks before initialization, resulting in boot failures. The fix is straightforward, simply moving initialization of RCU Tasks before the early_initcall()s. The fix has been exposed to -next and kbuild test robot testing, and has been tested by the PowerPC guys" * 'rcu/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu: rcu-tasks: Move RCU-tasks initialization to before early_initcall()
2 parents f4f6a2e + 1b04fa9 commit 36bbbd0

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

include/linux/rcupdate.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ void rcu_sched_clock_irq(int user);
8686
void rcu_report_dead(unsigned int cpu);
8787
void rcutree_migrate_callbacks(int cpu);
8888

89+
#ifdef CONFIG_TASKS_RCU_GENERIC
90+
void rcu_init_tasks_generic(void);
91+
#else
92+
static inline void rcu_init_tasks_generic(void) { }
93+
#endif
94+
8995
#ifdef CONFIG_RCU_STALL_COMMON
9096
void rcu_sysrq_start(void);
9197
void rcu_sysrq_end(void);

init/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,7 @@ static noinline void __init kernel_init_freeable(void)
15181518

15191519
init_mm_internals();
15201520

1521+
rcu_init_tasks_generic();
15211522
do_pre_smp_initcalls();
15221523
lockup_detector_init();
15231524

kernel/rcu/tasks.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static int __noreturn rcu_tasks_kthread(void *arg)
241241
}
242242
}
243243

244-
/* Spawn RCU-tasks grace-period kthread, e.g., at core_initcall() time. */
244+
/* Spawn RCU-tasks grace-period kthread. */
245245
static void __init rcu_spawn_tasks_kthread_generic(struct rcu_tasks *rtp)
246246
{
247247
struct task_struct *t;
@@ -564,7 +564,6 @@ static int __init rcu_spawn_tasks_kthread(void)
564564
rcu_spawn_tasks_kthread_generic(&rcu_tasks);
565565
return 0;
566566
}
567-
core_initcall(rcu_spawn_tasks_kthread);
568567

569568
#if !defined(CONFIG_TINY_RCU)
570569
void show_rcu_tasks_classic_gp_kthread(void)
@@ -692,7 +691,6 @@ static int __init rcu_spawn_tasks_rude_kthread(void)
692691
rcu_spawn_tasks_kthread_generic(&rcu_tasks_rude);
693692
return 0;
694693
}
695-
core_initcall(rcu_spawn_tasks_rude_kthread);
696694

697695
#if !defined(CONFIG_TINY_RCU)
698696
void show_rcu_tasks_rude_gp_kthread(void)
@@ -968,6 +966,11 @@ static void rcu_tasks_trace_pregp_step(void)
968966
static void rcu_tasks_trace_pertask(struct task_struct *t,
969967
struct list_head *hop)
970968
{
969+
// During early boot when there is only the one boot CPU, there
970+
// is no idle task for the other CPUs. Just return.
971+
if (unlikely(t == NULL))
972+
return;
973+
971974
WRITE_ONCE(t->trc_reader_special.b.need_qs, false);
972975
WRITE_ONCE(t->trc_reader_checked, false);
973976
t->trc_ipi_to_cpu = -1;
@@ -1193,7 +1196,6 @@ static int __init rcu_spawn_tasks_trace_kthread(void)
11931196
rcu_spawn_tasks_kthread_generic(&rcu_tasks_trace);
11941197
return 0;
11951198
}
1196-
core_initcall(rcu_spawn_tasks_trace_kthread);
11971199

11981200
#if !defined(CONFIG_TINY_RCU)
11991201
void show_rcu_tasks_trace_gp_kthread(void)
@@ -1222,6 +1224,21 @@ void show_rcu_tasks_gp_kthreads(void)
12221224
}
12231225
#endif /* #ifndef CONFIG_TINY_RCU */
12241226

1227+
void __init rcu_init_tasks_generic(void)
1228+
{
1229+
#ifdef CONFIG_TASKS_RCU
1230+
rcu_spawn_tasks_kthread();
1231+
#endif
1232+
1233+
#ifdef CONFIG_TASKS_RUDE_RCU
1234+
rcu_spawn_tasks_rude_kthread();
1235+
#endif
1236+
1237+
#ifdef CONFIG_TASKS_TRACE_RCU
1238+
rcu_spawn_tasks_trace_kthread();
1239+
#endif
1240+
}
1241+
12251242
#else /* #ifdef CONFIG_TASKS_RCU_GENERIC */
12261243
static inline void rcu_tasks_bootup_oddness(void) {}
12271244
void show_rcu_tasks_gp_kthreads(void) {}

0 commit comments

Comments
 (0)