SSD tools, commands and links

# Tools

## perf-tools: iolatency

https://github.com/brendangregg/perf-tools

<pre>
root@tokunori-desktop:/home/tokunori/perf-tools# ls -l /dev/nvme*
crw------- 1 root root 239, 0  8月 20 00:00 /dev/nvme0
brw-rw---- 1 root disk 259, 0  8月 20 00:00 /dev/nvme0n1
brw-rw---- 1 root disk 259, 1  8月 20 00:00 /dev/nvme0n1p1
brw-rw---- 1 root disk 259, 2  8月 20 00:00 /dev/nvme0n1p2
brw-rw---- 1 root disk 259, 3  8月 20 00:00 /dev/nvme0n1p5
root@tokunori-desktop:/home/tokunori/perf-tools# ./iolatency -d 259,0
Tracing block I/O. Output every 1 seconds. Ctrl-C to end.

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 5        |######################################|
       1 -> 2       : 0        |                                      |
       2 -> 4       : 0        |                                      |
       4 -> 8       : 2        |################                      |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 168      |######################################|
       1 -> 2       : 2        |#                                     |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 1        |########                              |
       1 -> 2       : 0        |                                      |
       2 -> 4       : 0        |                                      |
       4 -> 8       : 5        |######################################|
^C
Ending tracing...
</pre>

## bcc: biolatency

<pre>
root@tokunori-desktop:/home/tokunori/perf-tools# biolatency-bpfcc -D
In file included from <built-in>:2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:2:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:41:9: warning: '__HAVE_BUILTIN_BSWAP32__' macro redefined [-Wmacro-redefined]
#define __HAVE_BUILTIN_BSWAP32__
        ^
<command line>:4:9: note: previous definition is here
#define __HAVE_BUILTIN_BSWAP32__ 1
        ^
In file included from <built-in>:2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:2:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:42:9: warning: '__HAVE_BUILTIN_BSWAP64__' macro redefined [-Wmacro-redefined]
#define __HAVE_BUILTIN_BSWAP64__
        ^
<command line>:5:9: note: previous definition is here
#define __HAVE_BUILTIN_BSWAP64__ 1
        ^
In file included from <built-in>:2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:2:
In file included from include/linux/compiler_types.h:80:
include/linux/compiler-clang.h:43:9: warning: '__HAVE_BUILTIN_BSWAP16__' macro redefined [-Wmacro-redefined]
#define __HAVE_BUILTIN_BSWAP16__
        ^
<command line>:3:9: note: previous definition is here
#define __HAVE_BUILTIN_BSWAP16__ 1
        ^
3 warnings generated.
Tracing block device I/O... Hit Ctrl-C to end.
^C

disk = b'nvme0n1'
     usecs               : count     distribution
         0 -> 1          : 0        |                                        |
         2 -> 3          : 0        |                                        |
         4 -> 7          : 0        |                                        |
         8 -> 15         : 2        |*                                       |
        16 -> 31         : 30       |***************                         |
        32 -> 63         : 47       |***********************                 |
        64 -> 127        : 27       |*************                           |
       128 -> 255        : 52       |**************************              |
       256 -> 511        : 19       |*********                               |
       512 -> 1023       : 2        |*                                       |
      1024 -> 2047       : 80       |****************************************|
      2048 -> 4095       : 0        |                                        |
      4096 -> 8191       : 63       |*******************************         |

disk = b''
     usecs               : count     distribution
         0 -> 1          : 0        |                                        |
         2 -> 3          : 0        |                                        |
         4 -> 7          : 0        |                                        |
         8 -> 15         : 0        |                                        |
        16 -> 31         : 0        |                                        |
        32 -> 63         : 0        |                                        |
        64 -> 127        : 0        |                                        |
       128 -> 255        : 17       |****************************************|
       256 -> 511        : 5        |***********                             |
</pre>

# Commands
## lspci

https://qiita.com/ikegami-t/items/cd5623fcbac51e21deca

# Links

## OpenSSD

https://www.flashmemorysummit.com/English/Collaterals/Proceedings/2011/20110809_F2C_Lee.pdf

## Device driver

https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/7.2_release_notes/storage

https://www.oreilly.com/library/view/linux-device-drivers/0596000081/ch03s02.html

http://tech.voyagegroup.com/archives/479543.html

https://www.kernel.org/doc/html/latest/block/blk-mq.html

## Tools

https://www.golinuxcloud.com/monitor-disk-io-performance-statistics-linux/

https://github.com/iovisor/bcc

https://qiita.com/gucci3/items/1b97cc2b3deee59f0acd

http://tech.voyagegroup.com/archives/479543.html

## Linux Kernel

https://www.kernel.org/doc/html/latest/bpf/index.html

https://docs.cilium.io/en/latest/bpf/

https://training.ti.com/profiling-suspend-resume-latency-linux-kernel-pm-print-times