rcu: fix a deadlock caused by not release rcu_node->lock
PATCH 1/1 rcu: fix a deadlock caused by not release rcu_node->lock
From: Yanfei Xu <[email protected]>
rcu_node->lock isn't released in rcu_print_task_stall() if the rcu_node don't contain tasks which blocking the GP. However this rcu_node->lock will be used again in rcu_dump_cpu_stacks() soon while the ndetected is non-zero. As a result the cpu will hung by this deadlock.
Signed-off-by Yanfei Xu <[email protected]>
--- kernel/rcu/tree_stall.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/rcu/tree_stall.h +3 -1
@@ -267,8 +267,10 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)struct task_struct *ts[8 ];lockdep_assert_irqs_disabled (); -if (!rcu_preempt_blocked_readers_cgp (rnp)) +if (!rcu_preempt_blocked_readers_cgp (rnp)) { +raw_spin_lock_irqsave_rcu_node (rnp, flags);return 0 ; + }pr_err ("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):" , rnp->level, rnp->grplo, rnp->grphi); t = list_entry(rnp->gp_tasks->prev,
Signature · 1 line
2.27.0
sorry, please ignore this patch...
Regards,
Yanfei
Quoted 29 lines · On 5/16/21 5:28 PM, [email protected] wrote:
From: Yanfei Xu <[email protected]>
rcu_node->lockisn't released inrcu_print_task_stall()if thercu_nodedon't contain tasks which blocking the GP. However thisrcu_node->lockwill be used again inrcu_dump_cpu_stacks()soon while the ndetected is non-zero. As a result the cpu will hung by this deadlock.Signed-off-by Yanfei Xu <[email protected]>--- kernel/rcu/tree_stall.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)kernel/rcu/tree_stall.h +3
-1@@ -267,8 +267,10 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)struct task_struct *ts[8 ];lockdep_assert_irqs_disabled (); -if (!rcu_preempt_blocked_readers_cgp (rnp)) +if (!rcu_preempt_blocked_readers_cgp (rnp)) { +raw_spin_lock_irqsave_rcu_node (rnp, flags);return 0 ; + }pr_err ("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):" , rnp->level, rnp->grplo, rnp->grphi); t = list_entry(rnp->gp_tasks->prev,