On Thu 2024-05-02 23:44:38, John Ogness wrote:
> Mark emergency sections wherever multiple lines of
> rcu stall information are generated. In an emergency
> section the CPU will not perform console output for the
> printk() calls. Instead, a flushing of the console
> output is triggered when exiting the emergency section.
> This allows the full message block to be stored as
> quickly as possible in the ringbuffer.
>
> --- a/kernel/rcu/tree_exp.h
> +++ b/kernel/rcu/tree_exp.h
> @@ -612,6 +616,7 @@ static void synchronize_rcu_expedited_wait(void)
>                       }
>                       pr_cont("\n");
>               }
> +             nbcon_cpu_emergency_flush();

It would make more sense to do the flush inside the cycle after each
dump_cpu_task(). Something like:

                rcu_for_each_leaf_node(rnp) {
                        for_each_leaf_node_possible_cpu(rnp, cpu) {
                                mask = leaf_node_cpu_bit(rnp, cpu);
                                if (!(READ_ONCE(rnp->expmask) & mask))
                                        continue;
                                preempt_disable(); // For smp_processor_id() in 
dump_cpu_task().
                                dump_cpu_task(cpu);
                                preempt_enable();
+                               nbcon_cpu_emergency_flush();
                        }
                        rcu_exp_print_detail_task_stall_rnp(rnp);
                }


Or maybe, it is limited onto to few CPUs by rcu_for_each_leaf_node(rnp)?


>               rcu_for_each_leaf_node(rnp) {
>                       for_each_leaf_node_possible_cpu(rnp, cpu) {
>                               mask = leaf_node_cpu_bit(rnp, cpu);

Otherwise, it looks good to me.

Best Regards,
Petr

Reply via email to