From: John Ogness <>
Date: Wed, 14 Sep 2022 08:17:13 +0206
Subject: [PATCH 19/24] rcu: Add atomic write enforcement for rcu stalls

Invoke the atomic write enforcement functions for rcu stalls to
ensure that the information gets out to the consoles.

It is important to note that if there are any legacy consoles
registered, they will be attempting to directly print from the
printk-caller context, which may jeopardize the reliability of the
atomic consoles. Optimally there should be no legacy consoles

Signed-off-by: John Ogness <>
Signed-off-by: Sebastian Andrzej Siewior <>
 kernel/rcu/tree_stall.h |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-6.3.0-rt11/kernel/rcu/tree_stall.h
@ linux-6.3.0-rt11/kernel/rcu/tree_stall.h:11 @
 #include <linux/kvm_para.h>
+#include <linux/console.h>
@ linux-6.3.0-rt11/kernel/rcu/tree_stall.h:586 @ static void rcu_check_gp_kthread_expired
 static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
+	enum cons_prio prev_prio;
 	int cpu;
 	unsigned long flags;
 	unsigned long gpa;
@ linux-6.3.0-rt11/kernel/rcu/tree_stall.h:602 @ static void print_other_cpu_stall(unsign
 	if (rcu_stall_is_suppressed())
+	prev_prio = cons_atomic_enter(CONS_PRIO_EMERGENCY);
 	 * OK, time to rat on our buddy...
 	 * See Documentation/RCU/stallwarn.rst for info on how to debug
@ linux-6.3.0-rt11/kernel/rcu/tree_stall.h:658 @ static void print_other_cpu_stall(unsign
 	rcu_force_quiescent_state();  /* Kick them all. */
+	cons_atomic_exit(CONS_PRIO_EMERGENCY, prev_prio);
 static void print_cpu_stall(unsigned long gps)