qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com,
	qemu-block@nongnu.org, hreitz@redhat.com
Subject: Re: [PATCH 8.0 regression 0/8] block: remove bdrv_co_get_geometry coroutines from I/O hot path
Date: Tue, 11 Apr 2023 17:01:17 +0200	[thread overview]
Message-ID: <ZDV2PWaYQRVs4/3B@redhat.com> (raw)
In-Reply-To: <20230407153303.391121-1-pbonzini@redhat.com>

Am 07.04.2023 um 17:32 hat Paolo Bonzini geschrieben:
> The introduction of the graph lock is causing blk_get_geometry, a hot
> function used in the I/O path, to create a coroutine for the call to
> bdrv_co_refresh_total_sectors.
> 
> In theory the call to bdrv_co_refresh_total_sectors should only matter
> in the rare case of host CD-ROM devices, whose size changes when a medium
> is added or removed.  However, the call is actually keyed by a field in
> BlockDriver, drv->has_variable_length, and the field is true in the common
> case of the raw driver!  This is because the host CD-ROM is usually
> layered below the raw driver.
> 
> So, this series starts by moving has_variable_length from BlockDriver to
> BlockLimits.  This is patches 1-4, which also include a fix for a small
> latent bug (patch 3).
> 
> The second half of the series then cleans up the functions to retrieve
> the BlockDriverState's size (patches 5-7) to limit the amount of duplicated
> code introduced by the hand-written wrappers of patch 8.  The final result
> is that blk_get_geometry will not anymore create a coroutine.
> 
> This series applies to qemu.git, or to the block-next branch if commit
> d8fbf9aa85ae ("block/export: Fix graph locking in blk_get_geometry()
> call", 2023-03-27) is cherry picked.  Commit d8fbf9aa85ae is also where
> bdrv_co_get_geometry() was introduced and with it the performance
> regression.  It is quite a recent change, and therefore this is
> probably a regression in 8.0 that had not been detected yet (except by
> Stefan who talked to Kevin and me about it yesterday).  I'm not sure how
> we can avoid the regression, if not by disabling completely the graph lock
> (!) or applying this large series.
> 
> I'm throwing this out before disappearing for a couple days for Easter;
> I have only tested it with qemu-iotests and "make check-unit".

Thanks, fixed up patch 8 to make the non-coroutine wrappers almost exact
copies of the coroutine version (including fixing the bug that Eric
found), and applied to the block branch.

I'm not sure if the functions actually need to be coroutine_mixed_fn,
because coroutines should already call blk_co_get_geometry(), but we can
clean that up later.

Kevin



      parent reply	other threads:[~2023-04-11 15:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 15:32 [PATCH 8.0 regression 0/8] block: remove bdrv_co_get_geometry coroutines from I/O hot path Paolo Bonzini
2023-04-07 15:32 ` [PATCH 1/8] block: move has_variable_length to BlockLimits Paolo Bonzini
2023-04-07 19:38   ` Eric Blake
2023-04-07 15:32 ` [PATCH 2/8] block: remove has_variable_length from filters Paolo Bonzini
2023-04-07 19:40   ` Eric Blake
2023-04-07 15:32 ` [PATCH 3/8] block: refresh bs->total_sectors on reopen Paolo Bonzini
2023-04-07 19:42   ` Eric Blake
2023-04-07 15:32 ` [PATCH 4/8] block: remove has_variable_length from BlockDriver Paolo Bonzini
2023-04-07 19:48   ` Eric Blake
2023-04-07 15:33 ` [PATCH 5/8] migration/block: replace uses of blk_nb_sectors that do not check result Paolo Bonzini
2023-04-07 19:49   ` Eric Blake
2023-04-07 15:33 ` [PATCH 6/8] block-backend: inline bdrv_co_get_geometry Paolo Bonzini
2023-04-07 19:58   ` Eric Blake
2023-04-07 15:33 ` [PATCH 7/8] block-backend: ignore inserted state in blk_co_nb_sectors Paolo Bonzini
2023-04-07 20:00   ` Eric Blake
2023-04-07 15:33 ` [PATCH 8/8] block, block-backend: write some hot coroutine wrappers by hand Paolo Bonzini
2023-04-07 20:04   ` Eric Blake
2023-04-07 20:32     ` Paolo Bonzini
2023-04-11 15:01 ` 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=ZDV2PWaYQRVs4/3B@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).