From: Kevin Wolf <kwolf@redhat.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: qemu-block@nongnu.org, qemu-s390x <qemu-s390x@nongnu.org>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: performance regression due to 0bd5a1b3d60c "block: Fix corruption from broken RMW atomicity"
Date: Fri, 27 Nov 2026 11:36:31 +0100 [thread overview]
Message-ID: <awldLyF7qI9lRPft@redhat.com> (raw)
In-Reply-To: <5fa22932-3a6c-4b77-af53-a2d187e7603f@linux.ibm.com>
Am 26.11.2026 um 16:43 hat Christian Borntraeger geschrieben:
> the fix
> - 0bd5a1b3d60c ("block: Fix corruption from broken RMW atomicity")
> results in a pretty hefty performance regression for my nvme disk via virtio-blk and
> multiple iothreads.
>
> I uses AI to analyze and summarize and the result was seem legit from what I
> can tell, so I paste this is verbatim.
> I verified that 0bd5a1b3d60c is bad and 0bd5a1b3d60c^ is good.
Do you see any difference after commit cf4f672c (the commit right after
0bd5a1b3d60c)? Some checks are temporarily duplicated, but I expected
that after the second commit, there shouldn't be any visible difference.
In your use case, are serialising requests actually present?
> ## Description of problem
> Since commit 0bd5a1b3d60c ("block: Fix corruption from broken RMW atomicity")
> and the follow-up cf4f672c11d6 ("block: Remove now redundant
> bdrv_wait_serialising_requests() calls"), tracked_request_begin()
> unconditionally calls bdrv_wait_serialising_requests_locked(). The
> `bs->serialising_in_flight` fast path that bdrv_wait_serialising_requests()
> used to provide is gone.
Yes, that's a good point, and we could simply add this condition to
bdrv_wait_serialising_requests_locked() if the walk is expensive.
In fact, I suppose we could optimise even the case that does have
serialising requests by keeping a separate list of serialising requests
so that we don't have to iterate over all the non-serialising requests,
too. Though maybe it's not expected to have both serialising and a lot
of non-serialising requests at the same time on the same disk.
Anyway, can you try out if the below patch helps? (Only compile tested.)
serialising_in_flight doesn't actually have to be atomic any more, but
it's the simplest change we can make for 11.2.
Kevin
diff --git a/block/io.c b/block/io.c
index e4568d4d244..5e2734e540a 100644
--- a/block/io.c
+++ b/block/io.c
@@ -703,6 +703,10 @@ bdrv_wait_serialising_requests_locked(BdrvTrackedRequest *self)
{
BdrvTrackedRequest *req;
+ if (!qatomic_read(&self->bs->serialising_in_flight)) {
+ return;
+ }
+
while ((req = bdrv_find_conflicting_request(self))) {
/*
* If this request is the active owner of the data blocks it accesses,
next prev parent reply other threads:[~2026-11-27 10:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 15:43 performance regression due to 0bd5a1b3d60c "block: Fix corruption from broken RMW atomicity" Christian Borntraeger
2026-11-27 10:36 ` Kevin Wolf [this message]
2026-11-27 11:33 ` Paolo Bonzini
2026-11-27 13:58 ` Kevin Wolf
2026-11-30 9:32 ` Christian Borntraeger
2026-11-27 11:33 ` Christian Borntraeger
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=awldLyF7qI9lRPft@redhat.com \
--to=kwolf@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@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.