From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, hreitz@redhat.com, borntraeger@linux.ibm.com,
pbonzini@redhat.com, qemu-s390x@nongnu.org,
qemu-devel@nongnu.org, qemu-stable@nongnu.org
Subject: [PATCH for-11.2] block: Restore fast path for non-serialising requests
Date: Mon, 30 Nov 2026 11:35:01 +0100 [thread overview]
Message-ID: <20261130103501.38910-1-kwolf@redhat.com> (raw)
Commit 0bd5a1b3d60c added a bdrv_wait_serialising_requests_locked() call
without the fast path for bs->serialising_in_flight == 0, which was
present in the bdrv_wait_serialising_requests() it replaced (removed in
cf4f672c11d6). This causes performance regressions when there are no
serialising requests in flight: Instead of just comparing the counter,
this now has to iterate through the whole list of tracked requests.
Add the fast path back in bdrv_wait_serialising_requests_locked().
Now that all users of bs->serialising_in_flight hold the mutex, more
changes could be made (e.g. it doesn't have to be atomic any more, or it
could be changed to keep a separate list of serialising requests), but
given how late we're in the release cycle, this is left for another day.
Cc: qemu-stable@nongnu.org
Fixes: 0bd5a1b3d60c ('block: Fix corruption from broken RMW atomicity')
Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
Paolo had suggested moving the check to bdrv_find_conflicting_request(),
and while I think this should be semantically equivalent, I decided to
keep the exact shape of the patch that Christian actually tested to be
on the safe side.
For 12.0, I think having a list of serialising requests instead of a
counter would be the better solution anyway.
block/io.c | 4 ++++
1 file changed, 4 insertions(+)
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,
--
2.56.1
next reply other threads:[~2026-11-30 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 10:35 Kevin Wolf [this message]
2026-11-30 10:51 ` [PATCH for-11.2] block: Restore fast path for non-serialising requests Christian Borntraeger
2026-12-01 14:17 ` Eric Blake
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=20261130103501.38910-1-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=hreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=qemu-stable@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.