All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Hanna Czenczek <hreitz@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	"Denis V . Lunev" <den@openvz.org>,
	Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH 8/9] block/accounting: Move latency_ns override down
Date: Thu, 3 Sep 2026 11:08:42 -0400	[thread overview]
Message-ID: <20260903150842.GF825275@fedora> (raw)
In-Reply-To: <20260831135206.126184-9-hreitz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]

On Mon, Aug 31, 2026 at 03:52:04PM +0200, Hanna Czenczek wrote:
> I am not quite sure why `latency_ns` is overridden by a fixed value in
> qtest mode because personally, I find it much better if I can
> individually change requests' latency by modifying the qtest clock.

It looks like tests/qemu-iotests/136 relies on a hardcoded constant so
it can check min/max/avg against known values.

> 
> But I'm not going to change existing behavior for the histogram and
> such, so I will just move this override after the latency has been
> evaluated regarding a potential BLOCK_IO_DELAY event.

That's fine if you aren't taking the same testing approach as
tests/qemu-iotests/136. I think the benefit of hardcoding the value for
testing is that it would become possible to trigger the latency
threshold without worrying about timing in the test environment.

> 
> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
> ---
>  block/accounting.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/block/accounting.c b/block/accounting.c
> index debf1924455..223becd2e04 100644
> --- a/block/accounting.c
> +++ b/block/accounting.c
> @@ -271,10 +271,6 @@ static void block_account_one_io(BlockAcctStats *stats, BlockAcctCookie *cookie,
>      int64_t time_ns = qemu_clock_get_ns(clock_type);
>      int64_t latency_ns = time_ns - cookie->start_time_ns;
>  
> -    if (qtest_enabled()) {
> -        latency_ns = qtest_latency_ns;
> -    }
> -
>      assert(cookie->type < BLOCK_MAX_IOTYPE);
>  
>      if (cookie->type == BLOCK_ACCT_NONE) {
> @@ -292,6 +288,10 @@ static void block_account_one_io(BlockAcctStats *stats, BlockAcctCookie *cookie,
>                                         cookie->bytes);
>      }
>  
> +    if (qtest_enabled()) {
> +        latency_ns = qtest_latency_ns;
> +    }
> +
>      WITH_QEMU_LOCK_GUARD(&stats->lock) {
>          if (failed) {
>              stats->failed_ops[cookie->type]++;
> -- 
> 2.55.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-09-03 15:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 13:51 [PATCH 0/9] block: BLOCK_IO_DELAY event Hanna Czenczek
2026-08-31 13:51 ` [PATCH 1/9] block/accounting: Add offset to BlockAcctCookie Hanna Czenczek
2026-09-07 10:05   ` Jesper Wendel Devantier
2026-08-31 13:51 ` [PATCH 2/9] qapi/block: Add IoAccountingOperation enum Hanna Czenczek
2026-09-03 14:32   ` Markus Armbruster
2026-08-31 13:51 ` [PATCH 3/9] qapi/block: Add BLOCK_IO_DELAY event Hanna Czenczek
2026-09-03 14:36   ` Markus Armbruster
2026-08-31 13:52 ` [PATCH 4/9] block-backend: Public blk_get_attached_dev_path() Hanna Czenczek
2026-08-31 13:52 ` [PATCH 5/9] block/accounting: Add BB field to latency checker Hanna Czenczek
2026-08-31 13:52 ` [PATCH 6/9] block/accounting: Emit BLOCK_IO_DELAY event Hanna Czenczek
2026-09-03 14:23   ` Stefan Hajnoczi
2026-08-31 13:52 ` [PATCH 7/9] block: Add delay-alert-ms property Hanna Czenczek
2026-09-03 14:30   ` Stefan Hajnoczi
2026-08-31 13:52 ` [PATCH 8/9] block/accounting: Move latency_ns override down Hanna Czenczek
2026-09-03 15:08   ` Stefan Hajnoczi [this message]
2026-08-31 13:52 ` [PATCH 9/9] iotests: Add delay-alert test Hanna Czenczek
2026-09-03 15:16   ` Stefan Hajnoczi
2026-09-03 14:08 ` [PATCH 0/9] block: BLOCK_IO_DELAY event Stefan Hajnoczi

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=20260903150842.GF825275@fedora \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.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.