Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block_bio_* tracing #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shastah
Copy link

@shastah shastah commented Oct 13, 2017

Disclaimer: I don't necessarily need it merged as-is, but it may be helpful for others who stumble upon a similar problem.

I scratched my head today trying to explain the IO on a disk, as it wasn't showing up in iosnoop output in a manner that would allow me to pinpoint what exactly is that IO.

So I hacked in tracing block_bio_queue and block_bio_complete, et voila

COMM         PID    TYPE DEV      BLOCK        BYTES     LATms
ext4lazyinit 13030  W    253,18   5553305856   1048576     3.31
ext4lazyinit 13030  WS   253,18   5553307904   1048576     5.70
ext4lazyinit 13030  WS   253,23   1778432256   1048576     5.70
ext4lazyinit 13030  W    253,18   5553309952   1048576     6.61

This patch adds -B option that traces block_bio_queue and block_bio_complete instead of block_rq_*, and is mutually exclusive with -Q.

Add -B option that traces block_bio_queue and block_bio_complete instead
of block_rq_*, so that things like ext4 lazy init show up too.

Without this patch:
  # bin/iosnoop 1
  Tracing block I/O for 1 seconds (buffered)...
  COMM         PID    TYPE DEV      BLOCK        BYTES     LATms
  dmcrypt_writ 3432   W    8,0      5251285248   1048576     2.53
  dmcrypt_writ 3432   WS   8,0      5251287296   1048576     4.86
  dmcrypt_writ 3432   W    8,0      5251289344   1048576     2.53
  dmcrypt_writ 3432   WS   8,0      5251291392   1048576     4.87

With it:
  # bin/iosnoop -B 1
  Tracing block I/O for 1 seconds (buffered)...
  COMM         PID    TYPE DEV      BLOCK        BYTES     LATms
  ext4lazyinit 13030  W    253,18   5251324160   1048576     6.51
  ext4lazyinit 13030  WS   253,18   5251326208   1048576     6.56
  ext4lazyinit 13030  WS   253,23   1476450560   1048576     6.56
  ext4lazyinit 13030  W    253,18   5251328256   1048576     4.73
  ext4lazyinit 13030  WS   253,18   5251330304   1048576     7.08
  ext4lazyinit 13030  WS   253,23   1476454656   1048576     7.08
  jbd2/dm-8-24 2472   WS   253,4    3967160      4096       0.79
  jbd2/dm-8-24 2472   WS   253,4    3967168      4096       0.77
  jbd2/dm-8-24 2472   WS   253,4    3967176      4096       0.76
  jbd2/dm-8-24 2472   WS   253,4    3967184      4096       0.76
  jbd2/dm-8-24 2472   WS   253,4    3967192      4096       0.76
  jbd2/dm-8-24 2472   WS   253,4    3967200      4096       0.76
  jbd2/dm-8-24 2472   WS   253,4    3967208      4096       0.76
  jbd2/dm-8-24 2472   WFS  253,4    3967216      4096       7.90
  ext4lazyinit 13030  W    253,18   5251332352   1048576     4.80
  ext4lazyinit 13030  WS   253,18   5251334400   1048576     7.16
  ext4lazyinit 13030  WS   253,23   1476458752   1048576     7.17

Using -B and -Q at the same time is not supported.

Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
@brendangregg
Copy link
Owner

How is block_bio_queue different to block_rq_insert (ie, -Q)? I can see that they are called from different places, and have the plug/unplug stuff between them, but I'm wondering how we can neatly explain this and how it was affecting your workload? I'm happy with the change, just need to understand it first.

@shastah
Copy link
Author

shastah commented Jan 2, 2018

As far as I can tell, tracing block_rq_insert will not show mkfs.ext4 writes - it only shows the underlying disks (dev major 8):

# ./iosnoop -i '*W*' -Q 
(...)
md2_raid5    307    WS   8,0      105908240    4096       0.23
md2_raid5    307    WS   8,16     105908240    4096       0.28
md2_raid5    307    WS   8,32     105908240    4096       0.27
md2_raid5    307    WS   8,48     105908240    4096       0.26
md2_raid5    307    WS   8,0      105908232    512        0.25
md2_raid5    307    WS   8,16     105908232    512        0.29
md2_raid5    307    WS   8,32     105908232    512        0.28
md2_raid5    307    WS   8,48     105908232    512        0.28
(...)

While with -B, I can see write requests to other layers of my stack, namely 253: (dm/lvm) and 9: (md)

# ./iosnoop -i '*W*' -B
(...)
mkfs.ext4    19006  WS   253,7    17105049432  4096   13885.14
mkfs.ext4    19006  WS   253,10   3221900120   4096   13885.14
dmcrypt_writ 1669   WS   9,2      17105052512  4096      64.57
(...)

This is while doing mkfs.ext4 /dev/mapper/vgS-test. The setup is: four disks in a md_raid5 array, LUKS-encrypted volume on top of that, and LVM PV on top of it:

$ lsblk
(...)
sdd                    8:48   0  3.7T  0 disk  
(...)
|-sdd3                 8:51   0  3.6T  0 part  
| `-md2                9:2    0 10.8T  0 raid5 
|   `-pvcrypt        253:7    0 10.8T  0 crypt 
|     `-vgS-test     253:10   0    3T  0 lvm   
(...)
$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants