* [PATCH RFC] icount: don't adjust virtual time backwards after warp
@ 2023-06-25 8:37 Nicholas Piggin
2023-06-26 11:08 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Piggin @ 2023-06-25 8:37 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Nicholas Piggin, qemu-devel
With icount shift=auto, the QEMU_CLOCK_VIRTUAL can be adjusted backwards
after a warp, resulting in the machine observing time going backwards.
Linux on powerpc can't handle this, and it results in lockup due to a
time delta underflowing.
This patch seems to solve it, no more backwards time observed. Is it a
reasonable way to address it?
Thanks,
Nick
---
softmmu/icount.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/softmmu/icount.c b/softmmu/icount.c
index 7ae6544909..a6d605dfad 100644
--- a/softmmu/icount.c
+++ b/softmmu/icount.c
@@ -273,6 +273,9 @@ static void icount_warp_rt(void)
*/
int64_t cur_icount = icount_get_locked();
int64_t delta = clock - cur_icount;
+ if (delta < 0) {
+ warp_delta = 0;
+ }
warp_delta = MIN(warp_delta, delta);
}
qatomic_set_i64(&timers_state.qemu_icount_bias,
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] icount: don't adjust virtual time backwards after warp
2023-06-25 8:37 [PATCH RFC] icount: don't adjust virtual time backwards after warp Nicholas Piggin
@ 2023-06-26 11:08 ` Paolo Bonzini
2023-06-26 11:09 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2023-06-26 11:08 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: qemu-devel
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] icount: don't adjust virtual time backwards after warp
2023-06-26 11:08 ` Paolo Bonzini
@ 2023-06-26 11:09 ` Paolo Bonzini
2023-06-27 0:23 ` Nicholas Piggin
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2023-06-26 11:09 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: qemu-devel
On Mon, Jun 26, 2023 at 1:08 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
> Queued, thanks.
Hmm, almost, can you provide the Signed-off-by?
Thanks,
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] icount: don't adjust virtual time backwards after warp
2023-06-26 11:09 ` Paolo Bonzini
@ 2023-06-27 0:23 ` Nicholas Piggin
0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Piggin @ 2023-06-27 0:23 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Mon Jun 26, 2023 at 9:09 PM AEST, Paolo Bonzini wrote:
> On Mon, Jun 26, 2023 at 1:08 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
> > Queued, thanks.
>
> Hmm, almost, can you provide the Signed-off-by?
Sure, give me a bit and I'll make up a better changelog and patch.
Thanks,
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-27 0:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25 8:37 [PATCH RFC] icount: don't adjust virtual time backwards after warp Nicholas Piggin
2023-06-26 11:08 ` Paolo Bonzini
2023-06-26 11:09 ` Paolo Bonzini
2023-06-27 0:23 ` Nicholas Piggin
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.