3

I am new to Linux kernel debugging.

I have came across the tools like ftrace and gdb. I want to see all the relevant function calls made when a module is loaded by the kernel when it loads such as the function calls made by the graphics driver (drm, kms, setting up of buffers etc.) and initializing of the GPU.

I tried to set up the grub by adding

stacktrace trace_event=sched:,timer:,irq:* trace_buf_size=40M

and I got the following output

       Depth    Size   Location    (58 entries)
        -----    ----   --------
  0)     4096      68   ftrace_call+0x5/0xb
  1)     4028       8   mempool_alloc_slab+0x13/0x20
  2)     4020      56   mempool_alloc+0x4e/0x140
  3)     3964      12   scsi_sg_alloc+0x48/0x60
  4)     3952      44   __sg_alloc_table+0xd6/0x130
  5)     3908      32   scsi_alloc_sgtable+0x81/0xe0
  6)     3876      20   scsi_init_sgtable+0x27/0x70
  7)     3856      36   scsi_init_io+0x3c/0x1c0
  8)     3820     140   sd_setup_read_write_cmnd+0x3c/0xb70
  9)     3680       8   sd_init_command+0x2d/0xc0
 10)     3672      16   scsi_setup_cmnd+0xe1/0x170
 11)     3656      24   scsi_prep_fn+0xc4/0x170
 12)     3632      36   blk_peek_request+0x13b/0x280
 13)     3596      68   scsi_request_fn+0x38/0x5f0
 14)     3528      12   __blk_run_queue+0x2e/0x40
 15)     3516      40   blk_queue_bio+0x38c/0x3a0
 16)     3476      40   generic_make_request+0xd0/0x1b0
 17)     3436      96   submit_bio+0x67/0x180
 18)     3340      28   submit_bh_wbc+0x115/0x170
 19)     3312      16   bh_submit_read+0x3c/0xb0
 20)     3296      64   __read_extent_tree_block+0x180/0x210
 21)     3232      76   ext4_find_extent+0x11e/0x2f0
 22)     3156     184   ext4_ext_map_blocks+0x63/0xec0
 23)     2972      96   ext4_map_blocks+0x87/0x540
 24)     2876      60   ext4_getblk+0x52/0x1b0
 25)     2816      24   ext4_bread+0x23/0xa0
 26)     2792      76   __ext4_read_dirblock+0x27/0x3f0
 27)     2716      72   dx_probe+0x36/0x5e0
 28)     2644     160   ext4_find_entry+0x457/0x610
 29)     2484      60   ext4_lookup+0x5c/0x230
 30)     2424      16   lookup_real+0x17/0x50
 31)     2408      28   __lookup_hash+0x40/0x60
 32)     2380      52   walk_component+0x218/0x2f0
 33)     2328      52   link_path_walk+0x149/0x530
 34)     2276     120   path_openat+0x7f/0x1120
 35)     2156     152   do_filp_open+0x68/0xe0
 36)     2004      40   file_open_name+0xf5/0x180
 37)     1964      20   filp_open+0x27/0x50

which didn't help me much.

How should I proceed? Any help would be appreciated.

Thanks

anupamD
  • 862
  • 1
  • 8
  • 21
  • 1
    If you want to profile some driver, then probably [OProfile](http://ssvb.github.io/2011/08/23/yet-another-oprofile-tutorial.html) tool can be a good choice. If you just want to trace kernel boot-up sequence, you can use [initcall_debug](http://elinux.org/Initcall_Debug) kernel param for that. – Sam Protsenko Mar 04 '17 at 00:01

0 Answers0