Linux Dynamic Debug

Document created by rogeriopimentel Employee on Oct 10, 2017
Version 1Show Document
  • View in full screen mode

The Linux Dynamic Debug allows the user to enable/disable debug messages on specific kernel drivers in run time, without the need of re-building the kernel to enable/disable debug message every time the user wants to change it.

 

To enable the Linux dynamic debug, select the option "Enable dynamic printk() support" on Kernel menuconfig as following:

 

Kernel hacking  ---> printk and dmesg options  ---> [*] Enable dynamic printk() support

 

 

 

After booting the new compiled kernel, on your board's system, set the debug level to 8:

 

$echo 8 > /proc/sys/kernel/printk

 

Select the file(s) you want to debug by adding "+p" in front of the file(s) name(s). To disable the debug for specific files, use "-p". In this example, we will print debug messages only on IPU device driver, file ipu_device.c:

 

$echo 'file ipu_device.c +p' > /sys/kernel/debug/dynamic_debug/control

 

When running some application that uses the file being debugged, the debug messages will be shown on terminal. In this case, let's test with the unit test mxc_v4l2_overlay.out:

 

$/unit_tests/mxc_v4l2_overlay.out

 

The following debug messages will be shown on terminal:

 

imx-ipuv3 2400000.ipu: [0xa8fab200] no-0x820 ipu irq done!
imx-ipuv3 2400000.ipu: CSI stop timeout - -44 * 10ms
imx-ipuv3 2400000.ipu: put_vdoa_ipu_res:no:0x820,rel_vdoa:0, rel_ipu:1
imx-ipuv3 2400000.ipu: thread:2 complete tsk no:0x820-[0xa8fab200].
mxc_ipu mxc_ipu: [0xa8fab200,no-0x830] list_add_tail
mxc_ipu mxc_ipu: thread_id:2,[0xa8fab200] task_no:0x830,mode:0x1 list_del
imx-ipuv3 2400000.ipu: _get_vdoa_ipu_res:no:0x830,found_vdoa:0, found_ipu:1
imx-ipuv3 2400000.ipu: [0xa8fab200]Do task no:0x830: id 1
imx-ipuv3 2400000.ipu: [0xa8fab200]ic channel MEM_PRP_VF_MEM
imx-ipuv3 2400000.ipu: [0xa8fab200]only ic mode
imx-ipuv3 2400000.ipu: [0xa8fab200] no-0x830 in-irq!
imx-ipuv3 2400000.ipu: [0xa8fab200] no-0x830 ipu irq done!
imx-ipuv3 2400000.ipu: put_vdoa_ipu_res:no:0x830,rel_vdoa:0, rel_ipu:1
imx-ipuv3 2400000.ipu: thread:2 complete tsk no:0x830-[0xa8fab200].

 

More information at:

https://lwn.net/Articles/434833/
https://www.kernel.org/doc/html/v4.11/admin-guide/dynamic-debug-howto.html

4 people found this helpful

Attachments

    Outcomes