If the kernel crashes in a context where printk() calls always defer printing (such as in NMI or inside a printk_safe section) then the final panic messages will be deferred to irq_work. But if irq_work is not available, the messages will not get printed unless explicitly flushed. The result is that the final "end Kernel panic" banner does not get printed. Add one final flush after the last printk() call to make sure the final panic messages make it out as well. Additional info: 社区有patch已经解决 panic: Flush kernel log buffer at the end commit 5b71a921dbe7c804048922da794f7d5dab5b2c2 Reference:https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=5b71a921dbe7c804048922da794f7d5dab5b2c2f git cherry-pick -s 5b71a921d(with stable-v5.10.215 repo added)
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3079
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3685