Skip to content

Releases: dagomez137/bcc

blkalgn v0.2

13 Mar 11:07

Choose a tag to compare

Release v0.2

commit 474b124
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Mar 12 20:20:17 2025 +0000

blkalgn: bump to 0.2

Prepare for v0.2 release.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 05097a6
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Mar 12 19:58:09 2025 +0000

blkalgn: reduce mm required

Current values consume quite significant memory.

Limit them for now.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 83a798a
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Mar 12 19:40:26 2025 +0000

blkalgn: clang-format

Format code with clang.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 73c998e
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Mar 12 19:36:40 2025 +0000

blkalgn: add lbs information in granularity hist

Add lbads, LBA format or logical_block_size information.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 608af9a
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Mar 12 19:23:46 2025 +0000

blkalgn: fix granularity encoding

lbs is returned in bytes. Calculate the shift to encode length properly.

Fixes: 261fcae5 ("blkalgn: encode granularity in lbs step")

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

blkalgn v0.1

12 Mar 18:02

Choose a tag to compare

Release v0.1

commit af5c47c
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Mar 12 13:22:38 2025 +0000

blkalgn: update email address

Specify email address name.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 7589095
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Mar 12 11:16:57 2025 +0000

Revert "blkalgn: generate json output in bytes"

This reverts commit 2a9d89c8a3a96c9b1e986e3dc653fa346fd38a56.

We don't need anymore to communicate the type of histogram when
generating the json output in bytes. Instead, look at the new
granularity field to check how the slot is encoded.

commit 261fcae
Author: Daniel Gomez da.gomez@samsung.com
Date: Tue Mar 4 09:35:55 2025 +0000

blkalgn: encode granularity in lbs steps

The length was previously encoded in sector steps, but this approach is
inefficient since the LBA format can be larger, and that represents the
smallest granularity for I/O operations.

This update encodes the length using the granularity histogram in LBA
(lbs) steps instead of sector steps. Additionally, the size of the
histogram granularity (hgran) has been increased to accommodate higher
values at very low granularities, such as 16 MiB with a 512-byte step.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit c30ecfd
Author: Daniel Gomez da.gomez@samsung.com
Date: Fri Feb 28 09:31:51 2025 +0000

blkalgn: fix granularity sectors

We need to track up to 8 MiB in sectors: 8 MiB = 8388608-bytes => 16384.

Including 0-length commands, that is a total of 16384 + 1.

Fixes:
89f73742 ("blkalgn: increase MAX_SLOTS to support 8 MiB")
2a9d89c8 ("blkalgn: generate json output in bytes")
64688c6b ("blkalgn: fix base bytes offset")

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 7cf1252
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Feb 19 14:54:38 2025 +0000

blkalgn: fix pid not captured

Process ID was not being captured. Add it so it's reported in the trace
output.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 07c2e45
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Feb 19 14:36:16 2025 +0000

blkalgn: generate json output in bytes

Instead of generating alignment and granularity json trees in sector
sizes, do it in bytes so it's clear the values.

This also fixes the output for sectors which was off by one.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 03916be
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Feb 19 13:40:20 2025 +0000

blkalgn: fix base bytes offset

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit a65bd24
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Feb 19 13:28:36 2025 +0000

blkalgn: increase MAX_SLOTS to support 8 MiB

8 MiB is the max NVMe driver transfer limit. To support this in slots of
sector sizes we need 16k slots.

8 MiB >> 9 = 16k.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 1e95f1e
Author: Daniel Gomez da.gomez@samsung.com
Date: Wed Feb 19 13:10:31 2025 +0000

blkalgn: fix LBA reported value

Trace mode reports LBA calculated in LBA format steps. But the returned
value is sectors. Adjust and fix the value to sectors.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit a144c9f
Author: Daniel Gomez da.gomez@samsung.com
Date: Tue Nov 26 14:53:59 2024 +0000

blkalgn: add stack trace support

Print stack trace symbols if --stacktrace argument is passed/enabled.
Implementation uses blazesym [1] library from libbpf.

From blazesym documentation, kallsyms defaults to /proc/kallsyms [2]
and kernel_image [3] defaults to /boot/vmlinux-xxx (or /usr/lib/debug/
boot/).

[1] https://github.com/libbpf/blazesym

[2] kallsyms:
https://github.com/libbpf/blazesym/blob/v0.2.0-rc.2/capi/include/blazesym.h#L777

[3] kernel_image:
https://github.com/libbpf/blazesym/blob/v0.2.0-rc.2/capi/include/blazesym.h#L786

Example:

Capture without stack traces:

sudo ./blkalgn --trace --disk nvme0n1 --ops Write --len 4096 --comm kswapd0 --alignment 4096
Tracing block device I/O... Hit Ctrl-C to end.
DISK       OPS        FLAGS    LEN      LBA                   PID        COMM             ALGN
nvme0n1    0x1000001  Write    4096     652256                0          kswapd0          4096
nvme0n1    0x1000001  Write    4096     410912                0          kswapd0          4096
nvme0n1    0x1000001  Write    4096     533544                0          kswapd0          4096
nvme0n1    0x1000001  Write    4096     533344                0          kswapd0          4096
nvme0n1    0x1000001  Write    4096     175416                0          kswapd0          4096

Capture with stack traces:
sudo ./blkalgn --trace --disk nvme0n1 --ops Write --len 4096 --comm kswapd0 --alignment 4096 --stacktrace
nvme0n1    0x1000001  Write    4096     662984                0          kswapd0          4096
Kernel:
  0 [<ffffffffa0003803>] bpf_prog_84885faf3ae27510_block_rq_issue+0x257
  1 [<ffffffffa0003803>] bpf_prog_84885faf3ae27510_block_rq_issue+0x257
  2 [<ffffffff81137727>] bpf_trace_run1+0x67
  3 [<ffffffff815bbb06>] blk_mq_start_request+0x46
  4 [<ffffffff8177d5e6>] nvme_prep_rq+0x3d6
  5 [<ffffffff8177df08>] nvme_queue_rqs+0x68
  6 [<ffffffff815bd9cc>] blk_mq_flush_plug_list+0x43c
  7 [<ffffffff815bbd86>] blk_add_rq_to_plug+0x56
  8 [<ffffffff815be03e>] blk_mq_submit_bio+0x4be
  9 [<ffffffff815b3a56>] __submit_bio+0x86
  10 [<ffffffff815b287c>] submit_bio_noacct_nocheck+0xbc
  11 [<ffffffff812392b2>] __swap_writepage+0x372
  12 [<ffffffff8123cabd>] swap_swapcount+0x3d
  13 [<ffffffff8123cc8d>] folio_free_swap+0x5d
  14 [<ffffffff81238d42>] swap_writepage+0x262
  15 [<ffffffff811d92d1>] shrink_folio_list+0x831
  16 [<ffffffff811dad99>] shrink_lruvec+0x829
  17 [<ffffffff8125fcee>] mem_cgroup_iter+0x7e
  18 [<ffffffff811dd2a5>] shrink_node+0x3f5
  19 [<ffffffff811dbb58>] kswapd+0x5e8
  20 [<ffffffff811db570>] kswapd+0x0
  21 [<ffffffff8107c071>] kthread+0xd1
  22 [<ffffffff8107bfa0>] kthread+0x0
  23 [<ffffffff8102b9ef>] ret_from_fork+0x2f
  24 [<ffffffff8107bfa0>] kthread+0x0
  25 [<ffffffff81001341>] ret_from_fork_asm+0x11
No Userspace Stack

./scripts/faddr2line --list vmlinux shrink_folio_list+0x831
shrink_folio_list+0x831/0xdd0:

shrink_folio_list at mm/vmscan.c:690
 685                    if (shmem_mapping(mapping) && folio_test_large(folio))
 686                            wbc.list = folio_list;
 687
 688                    folio_set_reclaim(folio);
 689                    res = mapping->a_ops->writepage(&folio->page, &wbc);
>690<                   if (res < 0)
 691                            handle_write_error(mapping, folio, res);
 692                    if (res == AOP_WRITEPAGE_ACTIVATE) {
 693                            folio_clear_reclaim(folio);
 694                            return PAGE_ACTIVATE;
 695                    }

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 08b1a0b
Author: Daniel Gomez da.gomez@samsung.com
Date: Thu Nov 28 09:21:59 2024 +0000

blkalgn: add extra filters

Add support for length (-l, --length <bytes>), alignment (-a, alignment
--<bytes>) and comm (-c, --comm <comm>) filters.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit d12a417
Author: Daniel Gomez da.gomez@samsung.com
Date: Thu Nov 28 08:46:14 2024 +0000

blkalgn: update alignment histogram description

To be consistent with linear histogram.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit 46c67c7
Author: Daniel Gomez da.gomez@samsung.com
Date: Tue Nov 26 14:48:31 2024 +0000

blkalgn: print sectors in bytes

Duplicate the print_linear_hist() trace_helper into
print_linear_hist_sec() to print sectors in bytes instead of amount.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>

commit abf4f4e
Author: Daniel Gomez da.gomez@samsung.com
Date: Tue Oct 29 12:11:36 2024 +0000

blkalgn: add support

Add blkalgn support to trace block I/Os and report Granularity and
Alignment.

Update libbpf-tools/Makefile to support math.h and json-c/json.h
headers for blkalgn.

Update fedora Dockerfile to include json-c development package support.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>