qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] tests/avocado: reverse_debugging drain console to prevent hang
@ 2023-11-16 11:53 Nicholas Piggin
  2023-11-16 11:53 ` [PATCH 2/3] chardev: report blocked write to chardev backend Nicholas Piggin
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Nicholas Piggin @ 2023-11-16 11:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Marc-André Lureau, Paolo Bonzini,
	Pavel Dovgalyuk, Cleber Rosa, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beraldo Leal, Ani Sinha,
	Daniel P . Berrangé, Thomas Huth, John Snow, qemu-ppc,
	Alex Bennée

Like replay_linux.py, reverse_debugging.py starts the vm with console
set but does not interact with it (e.g., with wait_for_console_pattern).
In this situation, the console should have a drainer attached so the
socket does not fill. replay_linux.py has a drainer, but it is missing
from reverse_debugging.py.

Per analysis in Link: this can cause the console socket/pipe to fill and
QEMU get stuck in qemu_chr_write_buffer, leading to strange test case
failures (ppc64 fails because it prints a lot to console in early bios).
Attaching a drainer prevents this.

Note, this commit does not fix bugs introduced by the commits referenced
in the first two Fixes: tags, but together those commits conspire to
irritate the problem and cause test case failure, which this commit
fixes.

Link: https://lore.kernel.org/qemu-devel/ZVT-bY9YOr69QTPX@redhat.com/
Fixes: 1d4796cd0083 ("python/machine: use socketpair() for console connections")
Fixes: 761a13b23946 ("tests/avocado: ppc64 reverse debugging tests for pseries and powernv")
Fixes: be52eca30978 ("tests/acceptance: add reverse debugging test")
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 tests/avocado/reverse_debugging.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py
index fc47874eda..128d85bc0e 100644
--- a/tests/avocado/reverse_debugging.py
+++ b/tests/avocado/reverse_debugging.py
@@ -12,6 +12,7 @@
 
 from avocado import skipIf
 from avocado_qemu import BUILD_DIR
+from avocado.utils import datadrainer
 from avocado.utils import gdb
 from avocado.utils import process
 from avocado.utils.network.ports import find_free_port
@@ -52,6 +53,10 @@ def run_vm(self, record, shift, args, replay_path, image_path, port):
         if args:
             vm.add_args(*args)
         vm.launch()
+        console_drainer = datadrainer.LineLogger(vm.console_socket.fileno(),
+                                    logger=self.log.getChild('console'),
+                                    stop_check=(lambda : not vm.is_running()))
+        console_drainer.start()
         return vm
 
     @staticmethod
-- 
2.42.0



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

end of thread, other threads:[~2023-11-22 10:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 11:53 [PATCH 1/3] tests/avocado: reverse_debugging drain console to prevent hang Nicholas Piggin
2023-11-16 11:53 ` [PATCH 2/3] chardev: report blocked write to chardev backend Nicholas Piggin
2023-11-20 12:06   ` Marc-André Lureau
2023-11-20 13:35     ` Nicholas Piggin
2023-11-21  9:39       ` Marc-André Lureau
2023-11-21  9:42         ` Daniel P. Berrangé
2023-11-21  9:44         ` Thomas Huth
2023-11-21 11:47           ` Marc-André Lureau
2023-11-22  9:55             ` Alex Bennée
2023-11-22 10:38             ` Thomas Huth
2023-11-22 10:42               ` Daniel P. Berrangé
2023-11-16 11:53 ` [PATCH 3/3] tests/avocado: Enable reverse_debugging.py tests in gitlab CI Nicholas Piggin
2023-11-16 12:33   ` Thomas Huth
2023-11-16 18:11   ` Thomas Huth
2023-11-17  7:35     ` Nicholas Piggin
2023-11-21  8:56       ` Thomas Huth
2023-11-21  9:14         ` Daniel P. Berrangé
2023-11-21  9:40           ` Thomas Huth
2023-11-16 13:26 ` [PATCH 1/3] tests/avocado: reverse_debugging drain console to prevent hang Ani Sinha
2023-11-16 13:31   ` Ani Sinha
2023-11-16 13:39     ` Ani Sinha

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).