From 12871eb88c88f63e6f46b3fc16c9422ef51ccbd8 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Mon, 15 May 2017 15:54:09 +0000 Subject: [PATCH] Revert "Use clock_gettime(CLOCK_VIRTUAL,...) for QEMU_CLOCK_VIRTUAL." This reverts commit abef7fdd33a2f84ed21cff7718c086c00d9d9530. With the origional commit applied, the system failes to progress past ATA probing and all jenkins test runs failed with timeouts over the weekend. --- cpus.c | 2 +- include/qemu/timer.h | 18 ------------------ qemu-timer.c | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/cpus.c b/cpus.c index fe0b528ce89..c1e74d98248 100644 --- a/cpus.c +++ b/cpus.c @@ -211,7 +211,7 @@ static int64_t cpu_get_clock_locked(void) ticks = timers_state.cpu_clock_offset; if (timers_state.cpu_ticks_enabled) { - ticks += get_virtual_clock(); + ticks += get_clock(); } return ticks; diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 86d1303922a..99392464a69 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -825,11 +825,6 @@ static inline int64_t get_clock(void) return muldiv64(ti.QuadPart, get_ticks_per_sec(), clock_freq); } -static inline int64_t get_virtual_clock(void) -{ - return get_clock(); -} - #else extern int use_rt_clock; @@ -849,19 +844,6 @@ static inline int64_t get_clock(void) return get_clock_realtime(); } } - -static inline int64_t get_virtual_clock(void) -{ -#ifdef CLOCK_VIRTUAL - struct timespec ts; - - clock_gettime(CLOCK_VIRTUAL, &ts); - return ts.tv_sec * 1000000000LL + ts.tv_nsec; -#else - return get_clock(); -#endif -} - #endif /* icount */ diff --git a/qemu-timer.c b/qemu-timer.c index 2463fe6f6ac..49da1d532f5 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -565,7 +565,7 @@ int64_t qemu_clock_get_ns(QEMUClockType type) default: case QEMU_CLOCK_VIRTUAL: if (use_icount) { - return cpu_get_icount(); + return (cpu_get_icount() << 4) | (cpu_get_clock() & 0xful); } else { return cpu_get_clock(); }