Re: [PATCH 2/3] rcu: Defer RCU kthreads wakeup when CPU is dying

Frederic Weisbecker
2024-08-12T11:13:57Z

Le Mon, Aug 12, 2024 at 09:10:56AM +0000, Cheng-Jui Wang (王正睿) a écrit :
> On Wed, 2023-12-20 at 16:13 +0100, Frederic Weisbecker wrote:
> > Le Wed, Dec 20, 2023 at 04:24:35PM +0800, Z qiang a écrit :
> > > >
> > >
> > > In the rcutree_report_cpu_dead(), the rcuog kthreads may also be
> > > wakeup in
> > > do_nocb_deferred_wakeup(), if the rcuog kthreads is rt-fifo and
> > > wakeup happen,
> > > the rt_period_active is set 1 and enqueue hrtimer to offline CPU in
> > > do_start_rt_bandwidth(),
> > > after that, we invoke swake_up_one_online() send ipi to online CPU,
> > > due to the
> > > rt_period_active is 1, the rt-bandwith hrtimer will not enqueue to
> > > online CPU.
> > > any thoughts?
> >
> > Duh, you're right, that one too. How many more? This hrtimer
> > situation is scary...
> >
> > Thanks.
>
> I encountered the issue pointed out by Z Qiang on kernel-6.6, which
> cause RT tasks on the CPU to never be scheduled, leading to a system
> reboot. It triggered the WARN_ON_ONCE(!base->cpu_base->online)
> introduced in [PATCH 1/3]. Below is the call trace:
>
> Call trace:
> enqueue_hrtimer+0x7c/0xf8
> hrtimer_start_range_ns+0x2b8/0x300
> enqueue_task_rt+0x298/0x3f0
> enqueue_task+0x94/0x188
> ttwu_do_activate+0xb4/0x27c
> try_to_wake_up+0x2d8/0x79c
> wake_up_process+0x18/0x28
> __wake_nocb_gp+0x80/0x1a0
> do_nocb_deferred_wakeup_common+0x3c/0xcc
> rcu_report_dead+0x68/0x1ac
> cpuhp_report_idle_dead+0x48/0x9c
> do_idle+0x288/0x294
> cpu_startup_entry+0x34/0x3c
> secondary_start_kernel+0x138/0x158

This means you are setting rcuo kthreads as real time
tasks. I would be curious about your usecase.

Anyway I'm working on a fix. Thanks!