From: Kevin Wolf <kwolf@redhat.com>
To: Jorge Merlino <jorge.merlino@canonical.com>
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
qemu-block@nongnu.org
Subject: Re: [PATCH] block: add debug when block operations finish
Date: Fri, 25 Sep 2026 17:09:05 +0200 [thread overview]
Message-ID: <araOkUxn0agKKJrJ@redhat.com> (raw)
In-Reply-To: <20260909-debug-block-ops-b4-v1-1-2405f34ec068@canonical.com>
Am 09.09.2026 um 21:56 hat Jorge Merlino geschrieben:
> Add new debug tracepoints when block read and write operations finish to
> be able to measure latency.
>
> Signed-off-by: Jorge Merlino <jorge.merlino@canonical.com>
The subject line should mention trace points. Maybe just "block: Add
tracepoiont at end of read/write"?
> This patch adds debug tracepoints when block read and write operations
> finish. The log includes the parameters used when the operation was
> initiated so that the start and finish messages can be easily
> correlated. Also the return value of the operation is logged.
>
> This can be used to analyze latency issues with block operations.
Yes, this seems useful.
I wonder if we shouldn't make sure that the start and end traces always
come in pairs. Specifically...
> block/block-backend.c | 2 ++
> block/trace-events | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 37ba7e9fc4..75d3cd1949 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -1364,6 +1364,7 @@ blk_co_do_preadv_part(BlockBackend *blk, int64_t offset, int64_t bytes,
Adding more context here:
trace_blk_co_preadv(blk, bs, offset, bytes, flags);
ret = blk_check_byte_request(blk, offset, bytes);
if (ret < 0) {
return ret;
}
Should this error return also call trace_blk_co_preadv_done()?
bdrv_inc_in_flight(bs);
/* throttling disk I/O */
if (qatomic_load_acquire(&tgm->throttle_state)) {
throttle_group_co_io_limits_intercept(tgm, bytes, THROTTLE_READ);
}
>
> ret = bdrv_co_preadv_part(blk->root, offset, bytes, qiov, qiov_offset,
> flags);
> + trace_blk_co_preadv_done(blk, bs, offset, bytes, ret);
> bdrv_dec_in_flight(bs);
> return ret;
> }
> @@ -1442,6 +1443,7 @@ blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes,
>
> ret = bdrv_co_pwritev_part(blk->root, offset, bytes, qiov, qiov_offset,
> flags);
> + trace_blk_co_pwritev_done(blk, bs, offset, bytes, ret);
> bdrv_dec_in_flight(bs);
> return ret;
> }
Same question for writes.
Kevin
prev parent reply other threads:[~2026-09-25 15:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 19:56 [PATCH] block: add debug when block operations finish Jorge Merlino
2026-09-25 15:09 ` Kevin Wolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=araOkUxn0agKKJrJ@redhat.com \
--to=kwolf@redhat.com \
--cc=hreitz@redhat.com \
--cc=jorge.merlino@canonical.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.