rcu: Use IRQ_WORK_INIT_HARD for srcu's irq_work
Subsystems (3)
Sebastian Andrzej Siewior
maintainerPATCH v2 1/1 rcu: Use IRQ_WORK_INIT_HARD for srcu's irq_work
The irq_work in srcu is used to schedule a delayed work. The work item is not scheduled directly because it is not always possible wake a thread directly.
On PREEMPT_RT the default irq_work is initialized with IRQ_WORK_LAZY and is delayed to the irq_work thread. A system booted with the command line "trace_event=…" will freeze during boot because the irq_work thread is not yet deployed (and tracing uses synchronize_srcu() in tp_rcu_cond_sync()).
The irq_work performs just a wakeup a thread, there is nothing wrong with doing this from hardirq context on PREEMPT_RT.
Use IRQ_WORK_INIT_HARD for srcu's irq_work.
---
v1…v2: https://lore.kernel.org/all/[email protected]/
- Add a comment as suggested by Steven.
kernel/rcu/srcutree.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/rcu/srcutree.c +6 -1
@@ -218,7 +218,12 @@ static int init_srcu_struct_fields(struct srcu_struct *ssp, bool is_static)mutex_init (&ssp->srcu_sup->srcu_barrier_mutex);atomic_set (&ssp->srcu_sup->srcu_barrier_cpu_cnt,0 );INIT_DELAYED_WORK (&ssp->srcu_sup->work, process_srcu); -init_irq_work (&ssp->srcu_sup->irq_work, srcu_irq_work); +/* +* trace events started on the command line require SRCU before +* the irq_work kthread starts. Since all it does is a simple +* wakeup, having it as a hard irq, even on PREEMPT_RT is fine. +*/ + ssp->srcu_sup->irq_work =IRQ_WORK_INIT_HARD (srcu_irq_work); ssp->srcu_sup->sda_is_static = is_static;if (!is_static) { ssp->sda = alloc_percpu(struct srcu_data);
Signature · 1 line
2.55.0
Paul E. McKenney
maintainerQuoted 10 lines · Sebastian Andrzej Siewior
The
irq_workin srcu is used to schedule a delayed work. The work item is not scheduled directly because it is not always possible wake a thread directly.On
PREEMPT_RTthe defaultirq_workis initialized withIRQ_WORK_LAZYand is delayed to theirq_workthread. A system booted with the command line "trace_event=…" will freeze during boot because theirq_workthread is not yet deployed (and tracing usessynchronize_srcu()intp_rcu_cond_sync()).
Quoted 7 lines
The
irq_workperforms just a wakeup a thread, there is nothing wrong with doing this from hardirq context onPREEMPT_RT.Use
IRQ_WORK_INIT_HARDfor srcu'sirq_work.Fixes 7c405fb3279b3 ("rcu: Use an intermediate irq_work to start process_srcu()")Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Good catch, queued for further review and testing, thank you!
Thanx, Paul
Quoted 28 lines
---
v1…v2: https://lore.kernel.org/all/[email protected]/
- Add a comment as suggested by Steven.kernel/rcu/srcutree.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)kernel/rcu/srcutree.c +6
-1@@ -218,7 +218,12 @@ static int init_srcu_struct_fields(struct srcu_struct *ssp, bool is_static)mutex_init (&ssp->srcu_sup->srcu_barrier_mutex);atomic_set (&ssp->srcu_sup->srcu_barrier_cpu_cnt,0 );INIT_DELAYED_WORK (&ssp->srcu_sup->work, process_srcu); -init_irq_work (&ssp->srcu_sup->irq_work, srcu_irq_work); +/* +* trace events started on the command line require SRCU before +* the irq_work kthread starts. Since all it does is a simple +* wakeup, having it as a hard irq, even on PREEMPT_RT is fine. +*/ + ssp->srcu_sup->irq_work =IRQ_WORK_INIT_HARD (srcu_irq_work); ssp->srcu_sup->sda_is_static = is_static;if (!is_static) { ssp->sda = alloc_percpu(struct srcu_data);Signature · 1 line
2.55.0