On 2023/06/22 23:11, Petr Mladek wrote: >> Question to Peter: >> Even if local_irq_save(flags) disables IRQ, NMI context can enqueue message via printk(). >> When does the message enqueued from NMI context gets printed? > > They are flushed to the console either by irq_work or by another > printk(). The irq_work could not be proceed when IRQs are disabled. Is that rule same for both COMFIG_PREEMPT_RT=y and COMFIG_PREEMPT_RT=n ? If yes, when Sebastian's patch is applied, IRQs will not be disabled for COMFIG_PREEMPT_RT=y kernels because write_seqlock_irqsave() is equivalent with write_seqlock() because spin_lock_irqsave(lock, flags) is equivalent with spin_lock(lock), and > But another non-deferred printk() would try to flush them immediately. > >> If there is a possibility >> that the message enqueued from NMI context gets printed between >> "write_seqlock_irqsave(&zonelist_update_seq, flags) and printk_deferred_enter()" or >> "printk_deferred_exit() and write_sequnlock_irqrestore(&zonelist_update_seq, flags)" ? >> If yes, we can't increment zonelist_update_seq.seqcount before printk_deferred_enter()... > > It might happen when a printk() is called in these holes. printk() can happen between these holes for COMFIG_PREEMPT_RT=y kernels. We will need to call printk_deferred_enter() before incrementing zonelist_update_seq.seqcount in order to close these holes.