Skip to contentSkip to conversation

rcu-tasks: Make RCU Tasks Trace checking for userspace execution

PATCH Superseded Zqiang 1 participant 1 message Jul 19, 2022 RCU

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH v3 1/1 rcu-tasks: Make RCU Tasks Trace checking for userspace execution

For RCU tasks trace, the userspace execution is also a valid quiescent state, when scheduling-clock interrupt handler interrupts the task is in userspace.

if the ->trc_reader_nesting is zero, and the ->trc_reader_special.b.need_qs is not set, set the tasks ->trc_reader_special.b.need_qs is TRC_NEED_QS_CHECKED, this cause grace-period kthread remove it from holdout list if it remains here.

If the ->trc_reader_nesting is not zero(if one of the functions in the scheduling-clock interrupt handler were traced/instrumented), and starts a new RCU tasks trace grace period, when grace period kthread scan running tasks on each CPU, this running uasks will be inserted into hold list.

This commit add rcu_tasks_trace_qs() to rcu_flavor_sched_clock_irq() when the kernel built with no PREEMPT_RCU.

---
v1->v2:
Fix build error due to undeclared rcu_tasks_trace_qs(), note in no-PREEMPT_RCU kernel, the RCU Tasks is replaced by RCU, so rcu_note_voluntary_context_switch() only include rcu_tasks_trace_qs().

v2->v3:
Modify commit information.

 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 4152816dd29f..5fb0b2dd24fd 100644
@@ -976,7 +976,7 @@ static void rcu_flavor_sched_clock_irq(int user)
 		 * neither access nor modify, at least not while the
 		 * corresponding CPU is online.
 		 */
-
+		rcu_note_voluntary_context_switch(current);
 		rcu_qs();
 	}
 }
Signature · 1 line
2.25.1