On 2023-06-21 23:50:02 [+0900], Tetsuo Handa wrote: > On 2023/06/21 23:34, Sebastian Andrzej Siewior wrote: > >> Also, if local_irq_save() is hidden due to RT, what guarantees that > >> > >> write_seqlock_irqsave(&zonelist_update_seq, flags); > >> <<IRQ>> > >> some_timer_function() { > >> printk(); > >> } > >> <<IRQ>> > >> printk_deferred_enter(); > >> > >> does not happen because write_seqlock_irqsave() does not disable IRQ? > > > > I don't see how zonelist_update_seq and printk here are connected > > without the port lock/ or memory allocation. But there are two things > > that are different on RT which probably answer your question: > > It is explained as the first deadlock scenario in commit 1007843a9190 > ("mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock"). > We have to disable IRQ before making zonelist_update_seq.seqcount odd. You did explain the relation zonelist_update_seq -> kmalloc(, GFP_ATOMIC) and tty_insert_flip_string_and_push_buffer() -> kmalloc(, GFP_ATOMIC) with printk() on another CPU. As far as PREEMPT_RT goes, it is not an issue because the port-lock is not used or printing is deferred. Sebastian