[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC] icount: don't adjust virtual time backwards after warp
From: |
Nicholas Piggin |
Subject: |
[PATCH RFC] icount: don't adjust virtual time backwards after warp |
Date: |
Sun, 25 Jun 2023 18:37:31 +1000 |
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
- [PATCH RFC] icount: don't adjust virtual time backwards after warp,
Nicholas Piggin <=