ubuntu20.04.4 crash功能使用

1.安装kdump-tools或者linux-crashdump

记得选择yes,将crash配置到grub中

2.写一个导致内核驱动出错的驱动,测试。

289     spin_lock_irq(&xdx_hdmi_audio_ptr->spin_lock);
        。。。。
332         kf_write_to_file(xdx_hdmi_audio_ptr->playDataBufsPtr, dma_bytes, xdx_hdmi_audio_ptr->queuework_run_cnt*dma_bytes);
333         xdx_hdmi_audio_ptr->queuework_run_cnt ++;
334         if (xdx_hdmi_audio_ptr->playback_substream) {
335             spin_unlock_irq(&xdx_hdmi_audio_ptr->spin_lock);
336             snd_pcm_period_elapsed(xdx_hdmi_audio_ptr->playback_substream);
337             spin_lock_irq(&xdx_hdmi_audio_ptr->spin_lock);
338         }
339     }
340     //printk(KERN_INFO "%s %s line is %d end\n", __FILE__, __FUNCTION__, __LINE__);
341 
342     spin_unlock_irq(&xdx_hdmi_audio_ptr->spin_lock);

3.先不配置crash,跑驱动,不会出现crash文件,在/var/crash下面,

配置crash后,跑驱动,则在/var/carsh文件夹下面出现crash出错文件:/var/crash/202212131426/dmesg.202212131426                                                                                         [ft=] [fenc=utf-8] [ff=unix] [asc=098] [hex=62] [pos=1275,0033][96%] [len=1324]

[  372.684995] [snd_xdx_hdmi_audio_trigger 358] mod_timer HZ/20=12
1274 [  372.739869] ------------[ cut here ]------------
1275 [  372.739874] kernel BUG at fs/buffer.c:1222!
1276 [  372.739887] invalid opcode: 0000 [#1] SMP NOPTI
1277 [  372.739892] CPU: 1 PID: 141 Comm: kworker/u16:3 Kdump: loaded Tainted: G           OE     5.14.0-1054-oem #61-Ubuntu
1278 [  372.739898] Hardware name: LENOVO 20X2A00KCD/20X2A00KCD, BIOS R1JET43W (1.43 ) 05/04/2021
1279 [  372.739902] Workqueue: xdx_hdmi_audio_misr xdx_hdmi_audio_int_work [snd_iec]
1280 [  372.739914] RIP: 0010:__find_get_block+0x294/0x2e0
1281 [  372.739923] Code: 07 83 f8 04 0f 85 64 ff ff ff 49 8b 42 08 8b 40 68 83 e8 01 83 f8 01 0f 87 51 ff ff ff 4c 89 d7 e8 31 7d ef ff e9 4f ff ff ff <0f> 0b 4c 89 d7 e8 92 7c ef ff e9 40 ff ff ff 49 89 dc e9      0b fe ff
1282 [  372.739927] RSP: 0018:ffffbd6fc0e8b970 EFLAGS: 00010046
1283 [  372.739932] RAX: 0000000000000082 RBX: ffff99f98f493000 RCX: 0000000000000008
1284 [  372.739935] RDX: 0000000000001000 RSI: 0000000004a002e6 RDI: ffff99f98f493000
1285 [  372.739938] RBP: ffffbd6fc0e8b9a8 R08: 0000000004a00220 R09: ffff99f983733040
1286 [  372.739941] R10: ffffffffadbdcca3 R11: 0000000000000005 R12: ffff99f981320000
1287 [  372.739943] R13: 0000000004a002e6 R14: 0000000000001000 R15: 0000000000000c67
1288 [  372.739946] FS:  0000000000000000(0000) GS:ffff99fad7640000(0000) knlGS:0000000000000000
1289 [  372.739950] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
1290 [  372.739953] CR2: 00007ffd22278828 CR3: 00000001d5c10003 CR4: 0000000000770ee0
1291 [  372.739956] PKRU: 55555554
1292 [  372.739958] Call Trace:
1293 [  372.739961]  
1294 [  372.739965]  __getblk_gfp+0x27/0x270

你可能感兴趣的:(Linux,kernel,bug)