All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/io: Check for replay-enabled in bdrv_drain_all_begin()
@ 2022-12-20 17:46 Peter Maydell
  2022-12-20 18:45 ` Fabiano Rosas
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2022-12-20 17:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-block, Kevin Wolf, Hanna Reitz, Fam Zheng, Stefan Hajnoczi,
	Fabiano Rosas

In commit da0bd74434 we refactored bdrv_drain_all_begin() to pull out
the non-polling part into bdrv_drain_all_begin_nopoll().  This change
broke record-and-replay, because the "return early if replay enabled"
check is now in the sub-function bdrv_drain_all_begin_nopoll(), and
so it only causes us to return from that function, and not from the
calling bdrv_drain_all_begin().

Fix the regression by checking whether replay is enabled in both
functions.

The breakage and fix can be tested via 'make check-avocado': the
tests/avocado/reverse_debugging.py:ReverseDebugging_X86_64.test_x86_64_pc
tests/avocado/reverse_debugging.py:ReverseDebugging_AArch64.test_aarch64_virt
tests were both broken by this.

Fixes: da0bd744344adb1f285 ("block: Factor out bdrv_drain_all_begin_nopoll()")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Thanks to Fabiano for doing the bisect on this.
---
 block/io.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/block/io.c b/block/io.c
index d87788dfbbf..a09b1b34abf 100644
--- a/block/io.c
+++ b/block/io.c
@@ -506,6 +506,15 @@ void bdrv_drain_all_begin(void)
         return;
     }
 
+    /*
+     * bdrv queue is managed by record/replay,
+     * waiting for finishing the I/O requests may
+     * be infinite
+     */
+    if (replay_events_enabled()) {
+        return;
+    }
+
     bdrv_drain_all_begin_nopoll();
 
     /* Now poll the in-flight requests */
-- 
2.25.1



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

* Re: [PATCH] block/io: Check for replay-enabled in bdrv_drain_all_begin()
  2022-12-20 17:46 [PATCH] block/io: Check for replay-enabled in bdrv_drain_all_begin() Peter Maydell
@ 2022-12-20 18:45 ` Fabiano Rosas
  2022-12-21 14:14   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Fabiano Rosas @ 2022-12-20 18:45 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: qemu-block, Kevin Wolf, Hanna Reitz, Fam Zheng, Stefan Hajnoczi

Peter Maydell <peter.maydell@linaro.org> writes:

> In commit da0bd74434 we refactored bdrv_drain_all_begin() to pull out
> the non-polling part into bdrv_drain_all_begin_nopoll().  This change
> broke record-and-replay, because the "return early if replay enabled"
> check is now in the sub-function bdrv_drain_all_begin_nopoll(), and
> so it only causes us to return from that function, and not from the
> calling bdrv_drain_all_begin().
>
> Fix the regression by checking whether replay is enabled in both
> functions.
>
> The breakage and fix can be tested via 'make check-avocado': the
> tests/avocado/reverse_debugging.py:ReverseDebugging_X86_64.test_x86_64_pc
> tests/avocado/reverse_debugging.py:ReverseDebugging_AArch64.test_aarch64_virt
> tests were both broken by this.
>
> Fixes: da0bd744344adb1f285 ("block: Factor out bdrv_drain_all_begin_nopoll()")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Tested-by: Fabiano Rosas <farosas@suse.de>


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

* Re: [PATCH] block/io: Check for replay-enabled in bdrv_drain_all_begin()
  2022-12-20 18:45 ` Fabiano Rosas
@ 2022-12-21 14:14   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2022-12-21 14:14 UTC (permalink / raw)
  To: Fabiano Rosas
  Cc: qemu-devel, qemu-block, Kevin Wolf, Hanna Reitz, Fam Zheng,
	Stefan Hajnoczi

On Tue, 20 Dec 2022 at 18:46, Fabiano Rosas <farosas@suse.de> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
> > In commit da0bd74434 we refactored bdrv_drain_all_begin() to pull out
> > the non-polling part into bdrv_drain_all_begin_nopoll().  This change
> > broke record-and-replay, because the "return early if replay enabled"
> > check is now in the sub-function bdrv_drain_all_begin_nopoll(), and
> > so it only causes us to return from that function, and not from the
> > calling bdrv_drain_all_begin().
> >
> > Fix the regression by checking whether replay is enabled in both
> > functions.
> >
> > The breakage and fix can be tested via 'make check-avocado': the
> > tests/avocado/reverse_debugging.py:ReverseDebugging_X86_64.test_x86_64_pc
> > tests/avocado/reverse_debugging.py:ReverseDebugging_AArch64.test_aarch64_virt
> > tests were both broken by this.
> >
> > Fixes: da0bd744344adb1f285 ("block: Factor out bdrv_drain_all_begin_nopoll()")
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>
> Tested-by: Fabiano Rosas <farosas@suse.de>

Thanks; I've applied this to git since it unbreaks 'make check'.

-- PMM


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

end of thread, other threads:[~2022-12-21 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 17:46 [PATCH] block/io: Check for replay-enabled in bdrv_drain_all_begin() Peter Maydell
2022-12-20 18:45 ` Fabiano Rosas
2022-12-21 14:14   ` Peter Maydell

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.