From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
David Hildenbrand <david@redhat.com>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, qemu-stable@nongnu.org
Subject: Re: [PATCH v4 1/4] target/s390x: Fix missing interrupts for small CKC values
Date: Thu, 27 Nov 2025 22:54:17 +0100 [thread overview]
Message-ID: <46efeae205376fca9b23944f6c453d19c27b540a.camel@linux.ibm.com> (raw)
In-Reply-To: <115d74c6536473d1a3ec8d9431f186b0d09c2aff.camel@linux.ibm.com>
On Thu, 2025-11-27 at 19:00 +0100, Ilya Leoshkevich wrote:
> On Thu, 2025-11-27 at 17:43 +0100, Thomas Huth wrote:
> > On 16/10/2025 19.58, Ilya Leoshkevich wrote:
> > > Suppose TOD clock value is 0x1111111111111111 and clock-
> > > comparator
> > > value is 0, in which case clock-comparator interruption should
> > > occur
> > > immediately.
> > >
> > > With the current code, tod2time(env->ckc - td->base.low) ends up
> > > being
> > > a very large number, so this interruption never happens.
> > >
> > > Fix by firing the timer immediately if env->ckc < td->base.low.
> > >
> > > Cc: qemu-stable@nongnu.org
> > > Reviewed-by: Thomas Huth <thuth@redhat.com>
> > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > > ---
> >
> > Hi Ilya,
> >
> > this patch unfortunately broke reverse debugging on the s390x
> > target.
> > Something like this used to work before:
> >
> > qemu-img create -f qcow2 /tmp/disk.qcow2 2G
> > ./qemu-system-s390x -nographic \
> > -icount shift=6,rr=record,rrfile=replay.bin,rrsnapshot=init \
> > -net none -drive file=/tmp/disk.qcow2,if=none
> > ./qemu-system-s390x -nographic \
> > -icount shift=6,rr=replay,rrfile=replay.bin,rrsnapshot=init \
> > -net none -drive file=/tmp/disk.qcow2,if=none
> >
> > With this commit and later, the replay hangs somewhere in an
> > endless
> > loop.
> > Do you have any ideas what could go wrong here?
> >
> > Thanks,
> > Thomas
>
> [...]
>
> Hi Thomas,
>
> Thanks for letting me know, I will look at this ASAP.
>
> Best regards,
> Ilya
Intermediate finding:
update_ckc_timer() is called only during replay, but not during normal
runs or record. The call chain during replay is as follows:
main()
qemu_init()
qmp_x_exit_preconfig()
replay_vmstate_init()
load_snapshot()
qemu_loadvm_state()
qemu_loadvm_state_main()
qemu_loadvm_section_start_full()
vmstate_load()
vmstate_load_state()
cpu_post_load()
tcg_s390_tod_updated()
update_ckc_timer()
The end result is that during record CHECKPOINT_CLOCK_VIRTUAL is not
written to replay.bin. But during replay it's expected here:
if (replay_mode != REPLAY_MODE_NONE
&& timer_list->clock->type == QEMU_CLOCK_VIRTUAL
&& !(ts->attributes & QEMU_TIMER_ATTR_EXTERNAL)
&& !replay_checkpoint(CHECKPOINT_CLOCK_VIRTUAL)) {
qemu_mutex_unlock(&timer_list->active_timers_lock);
goto out;
}
The lack of it prevents the timer callback from running. So the timer
associated with s390x_tod_timer() remains active forever and causes the
rr_cpu_thread_fn() to loop.
IIUC these things really have to be symmetric between record and
replay, so we probably need to add this call to some strategic location
during record.
I will continue tomorrow.
next prev parent reply other threads:[~2025-11-27 21:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 17:58 [PATCH v4 0/3] target/s390x: Fix missing clock-comparator interrupts Ilya Leoshkevich
2025-10-16 17:58 ` [PATCH v4 1/4] target/s390x: Fix missing interrupts for small CKC values Ilya Leoshkevich
2025-11-27 16:43 ` Thomas Huth
2025-11-27 18:00 ` Ilya Leoshkevich
2025-11-27 21:54 ` Ilya Leoshkevich [this message]
2025-10-16 17:58 ` [PATCH v4 2/4] target/s390x: Fix missing clock-comparator interrupts after reset Ilya Leoshkevich
2025-10-16 17:58 ` [PATCH v4 3/4] target/s390x: Use address generation for register branch targets Ilya Leoshkevich
2025-10-16 18:13 ` Thomas Weißschuh
2025-10-16 17:58 ` [PATCH v4 4/4] tests/tcg/s390x: Test SET CLOCK COMPARATOR Ilya Leoshkevich
2025-10-29 9:55 ` [PATCH PING v4 0/3] target/s390x: Fix missing clock-comparator interrupts Ilya Leoshkevich
2025-10-29 12:19 ` Thomas Huth
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=46efeae205376fca9b23944f6c453d19c27b540a.camel@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=richard.henderson@linaro.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).