[PATCH] makedumpfile: printk: add support for lockless ringbuffer

John Ogness john.ogness at linutronix.de
Thu Nov 19 21:04:09 EST 2020

On 2020-11-19, HAGIO KAZUHITO(萩尾 一仁)	<k-hagio-ab at nec.com> wrote:
> From: John Ogness <john.ogness at linutronix.de>
> Linux 5.10 introduces a new lockless ringbuffer.  The new ringbuffer
> is structured completely different to the previous iterations.
> Add support for retrieving the ringbuffer from debug information
> and/or using vmcoreinfo.  The new ringbuffer is detected based on
> the availability of the "prb" symbol.
> Signed-off-by: John Ogness <john.ogness at linutronix.de>
> Signed-off-by: Kazuhito Hagio <k-hagio-ab at nec.com>
> ---
> I've updated John's RFC makedumpfile patch to match 5.10-rc4 kernel.
> Changes from the RFC patch:
> - followed the following kernel commit
>     cfe2790b163a ("printk: move printk_info into separate array")
> - divided members of struct printk_log in offset_table into each structure
>   for readability
> - added some error handlings
> - also dump head record that was missed

I confirm that these changes are correct. Thanks for updating this,
adding the needed error handling, and catching that the head record was

I tested this by:

1. Boot kernel with: crashkernel=512M

2. Setup and trigger crash:

   kexec -p /boot/bzImage --initrd=/boot/rescue-initrd --append="console=ttyS0,115200"
   echo c > /proc/sysrq-trigger

3. From rescue environment, copy crashed vmcore to external machine:

   cp /proc/vmcore /remote/nfs/mount/

4. From external machine, extract kernel log using vmcoreinfo:

   makedumpfile -g ./vmcoreinfo -x ./vmlinux
   makedumpfile --dump-dmesg -i ./vmcoreinfo ./vmcore dmesg1.txt

5. From external machine, extract kernel log using debug symbols:

   makedumpfile --dump-dmesg -x ./vmlinux ./vmcore dmesg2.txt

6. Compare and inspect the kernel logs:

   diff dmesg1.txt dmesg2.txt
   cat dmesg1.txt

John Ogness

More information about the kexec mailing list