[RFC PATCH] tests/functional/s390x: Add reverse debugging test for s390x

Thomas Huth posted 1 patch 20 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251128133949.181828-1-thuth@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Thomas Huth <thuth@redhat.com>
tests/functional/reverse_debugging.py        |  4 +++-
tests/functional/s390x/meson.build           |  1 +
tests/functional/s390x/test_reverse_debug.py | 21 ++++++++++++++++++++
3 files changed, 25 insertions(+), 1 deletion(-)
create mode 100755 tests/functional/s390x/test_reverse_debug.py
[RFC PATCH] tests/functional/s390x: Add reverse debugging test for s390x
Posted by Thomas Huth 20 hours ago
From: Thomas Huth <thuth@redhat.com>

We just have to make sure that we can set the endianness to big endian,
then we can also run this test on s390x.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 Marked as RFC since it depends on the fix for this bug (so it cannot
 be merged yet):
 https://lore.kernel.org/qemu-devel/a0accce9-6042-4a7b-a7c7-218212818891@redhat.com/

 tests/functional/reverse_debugging.py        |  4 +++-
 tests/functional/s390x/meson.build           |  1 +
 tests/functional/s390x/test_reverse_debug.py | 21 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100755 tests/functional/s390x/test_reverse_debug.py

diff --git a/tests/functional/reverse_debugging.py b/tests/functional/reverse_debugging.py
index 86fca8d81f1..8b9507674a0 100644
--- a/tests/functional/reverse_debugging.py
+++ b/tests/functional/reverse_debugging.py
@@ -64,7 +64,7 @@ def vm_get_icount(vm):
 
     @skipIfMissingImports("pygdbmi") # Required by GDB class
     @skipIfMissingEnv("QEMU_TEST_GDB")
-    def reverse_debugging(self, gdb_arch, shift=7, args=None):
+    def reverse_debugging(self, gdb_arch, shift=7, args=None, big_endian=False):
         from qemu_test import GDB
 
         # create qcow2 for snapshots
@@ -99,6 +99,8 @@ def reverse_debugging(self, gdb_arch, shift=7, args=None):
             gdb_cmd = os.getenv('QEMU_TEST_GDB')
             gdb = GDB(gdb_cmd)
             try:
+                if big_endian:
+                    gdb.cli("set endian big")
                 self.reverse_debugging_run(gdb, vm, port, gdb_arch, last_icount)
             finally:
                 self.log.info('exiting gdb and qemu')
diff --git a/tests/functional/s390x/meson.build b/tests/functional/s390x/meson.build
index 70cd36e2913..0f03e1c9db8 100644
--- a/tests/functional/s390x/meson.build
+++ b/tests/functional/s390x/meson.build
@@ -6,6 +6,7 @@ test_s390x_timeouts = {
 
 tests_s390x_system_quick = [
   'vmstate',
+  'reverse_debug',
 ]
 
 tests_s390x_system_thorough = [
diff --git a/tests/functional/s390x/test_reverse_debug.py b/tests/functional/s390x/test_reverse_debug.py
new file mode 100755
index 00000000000..0767dc91678
--- /dev/null
+++ b/tests/functional/s390x/test_reverse_debug.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+'''
+Reverse debugging test for s390x
+'''
+
+from reverse_debugging import ReverseDebugging
+
+
+class ReverseDebuggingS390x(ReverseDebugging):
+
+    def test_revdbg(self):
+        self.set_machine('s390-ccw-virtio')
+        self.reverse_debugging(gdb_arch='s390:64-bit', shift=6,
+                               big_endian=True, args=('-no-shutdown',))
+
+
+if __name__ == '__main__':
+    ReverseDebugging.main()
-- 
2.51.1
Re: [RFC PATCH] tests/functional/s390x: Add reverse debugging test for s390x
Posted by Ilya Leoshkevich 16 hours ago
On Fri, 2025-11-28 at 14:39 +0100, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> We just have to make sure that we can set the endianness to big
> endian,
> then we can also run this test on s390x.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  Marked as RFC since it depends on the fix for this bug (so it cannot
>  be merged yet):
>  
> https://lore.kernel.org/qemu-devel/a0accce9-6042-4a7b-a7c7-218212818891@redhat.com
> /
> 
>  tests/functional/reverse_debugging.py        |  4 +++-
>  tests/functional/s390x/meson.build           |  1 +
>  tests/functional/s390x/test_reverse_debug.py | 21
> ++++++++++++++++++++
>  3 files changed, 25 insertions(+), 1 deletion(-)
>  create mode 100755 tests/functional/s390x/test_reverse_debug.py

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>


I have a simple fix which helps with your original report, but not
with this test. I'm still investigating.

--- a/target/s390x/machine.c
+++ b/target/s390x/machine.c
@@ -52,6 +52,14 @@ static int cpu_pre_save(void *opaque)
         kvm_s390_vcpu_interrupt_pre_save(cpu);
     }
 
+    if (tcg_enabled()) {
+        /*
+         * Ensure symmetry with cpu_post_load() with respect to
+         * CHECKPOINT_CLOCK_VIRTUAL.
+         */
+        tcg_s390_tod_updated(CPU(cpu), RUN_ON_CPU_NULL);
+    }
+
     return 0;
 }