All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-11.2] block: Restore fast path for non-serialising requests
@ 2026-11-30 10:35 Kevin Wolf
  2026-11-30 10:51 ` Christian Borntraeger
  2026-12-01 14:17 ` Eric Blake
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2026-11-30 10:35 UTC (permalink / raw)
  To: qemu-block
  Cc: kwolf, hreitz, borntraeger, pbonzini, qemu-s390x, qemu-devel,
	qemu-stable

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 10:35 [PATCH for-11.2] block: Restore fast path for non-serialising requests Kevin Wolf
2026-11-30 10:51 ` Christian Borntraeger
2026-12-01 14:17 ` Eric Blake

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.