On (10/18/17 01:10), pierre kuo wrote: [..] > > Well, it might get quite complicated, see printk_safe_flush_buffer(). > > BTW, after checking printk_safe_flush_buffer() and related functions, > we have one question: > a) Why in printk_safe_log_store(), we need to use atomic_xxxx operation in > it?
because IRQ flush work iterates all CPUs and modifies CPUs' buffer state, and this easily can race with printk_safe() or printk_nmi() on some of the CPUs. -ss