qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Thomas Huth <thuth@redhat.com>,
	 qemu-devel@nongnu.org, qemu-s390x@nongnu.org
Subject: Re: [RFC PATCH] tests/functional/s390x: Add reverse debugging test for s390x
Date: Sun, 30 Nov 2025 16:47:19 +0000	[thread overview]
Message-ID: <87zf838o2w.fsf@draig.linaro.org> (raw)
In-Reply-To: <8efd73b100f7e78b1a5bbbe89bc221397a0a115a.camel@linux.ibm.com> (Ilya Leoshkevich's message of "Sat, 29 Nov 2025 22:33:39 +0100")

Ilya Leoshkevich <iii@linux.ibm.com> writes:

> On Fri, 2025-11-28 at 18:25 +0100, Ilya Leoshkevich wrote:
>> 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;
>>  }
>
> Interestingly enough, this patch fails only under load, e.g., if I run
> make check -j"$(nproc)" or if I run your test in isolation, but with
> stress-ng cpu in background. The culprit appears to be:
>
> s390_tod_load()
>   qemu_s390_tod_set()
>     async_run_on_cpu(tcg_s390_tod_updated)
>
> Depending on the system load, this additional tcg_s390_tod_updated()
> may or may not end up being called during handle_backward(). If it
> does, we get an infinite loop again, because now we need two
> checkpoints.
>
> I have a feeling that this code may be violating some record-replay
> requirement, but I can't quite put my finger on it. For example,
> async_run_on_cpu() does not sound like something deterministic, but
> then again it just queues work for rr_cpu_thread_fn(), which is
> supposed to be deterministic.

The the async_run_on_cpu is called from the vcpu thread in response to a
deterministic event at a known point in time it should be fine. If it
came from another thread that is not synchronised via replay_lock then
things will go wrong.

But this is a VM load save helper?

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2025-11-30 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 13:39 [RFC PATCH] tests/functional/s390x: Add reverse debugging test for s390x Thomas Huth
2025-11-28 17:25 ` Ilya Leoshkevich
2025-11-29 21:33   ` Ilya Leoshkevich
2025-11-30 16:47     ` Alex Bennée [this message]
2025-11-30 18:32       ` Ilya Leoshkevich
2025-11-30 19:03         ` Ilya Leoshkevich
2025-11-30 22:59           ` Ilya Leoshkevich
2025-12-01 10:36             ` Alex Bennée
2025-12-01 11:17               ` Ilya Leoshkevich
2025-12-01 11:57                 ` Ilya Leoshkevich
2025-12-01 12:43                 ` Alex Bennée

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=87zf838o2w.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=iii@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    /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 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).