Tips for Kernel Module Debugging

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sat Sep 12 15:27:12 EDT 2015


On Sat, 12 Sep 2015 16:04:43 -0300, Lucas Tanure said:

> I'm testing the linux-next tree and I got this stack:
>
> [    2.158054] Call Trace:
> [    2.158058]  [<ffffffff812b9159>] dump_stack+0x4b/0x72
> [    2.158061]  [<ffffffff81074e62>] warn_slowpath_common+0x82/0xc0
> [    2.158063]  [<ffffffff81074faa>] warn_slowpath_null+0x1a/0x20
> [    2.158066]  [<ffffffffa0572291>] drm_dev_alloc+0x251/0x320 [drm]
> [    2.158070]  [<ffffffffa0574d0b>] drm_get_pci_dev+0x3b/0x1e0 [drm]
> [    2.158081]  [<ffffffffa07062d4>] i915_pci_probe+0x34/0x50 [i915]
>
> How is the best way to debug this ? I really need to add a print, compile
> and boot many times ?
> How would you guys debug this ?

Step 0:  Include the last few lines *before* the Call Trace - if indeed
it was a Warning, it will give you the file and line number of where the
WARN_ON was..

[26636.029711] ------------[ cut here ]------------
[26636.029724] WARNING: CPU: 3 PID: 19157 at ./arch/x86/include/asm/thread_info.h:239 sigsuspend+0xa4/0xb0()

Bummer of a birthmark, Hal.  The one my laptop hit was a WARN_ON inside
either a macro or static inline from that .h file. Fortunately, yours
was inside a .c file and pointed in the right place (see below for how
I know that...)

That 'cut here' is where you should start the cut-n-paste, and include
everything down to 'end trace'.

Having said that, looking at drivers/gpu/drm/drm_drv.c:drm_dev_alloc() we
find only one WARN_ON:

        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
                ret = drm_minor_alloc(dev, DRM_MINOR_CONTROL);
                if (ret)
                        goto err_minors;

                WARN_ON(driver->suspend || driver->resume);
        }

As to *why* that one triggered, you'll have to ask an actual i915 expert.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150912/6ce9d989/attachment.bin 


More information about the Kernelnewbies mailing list