Revert wrong fixes for -icount in the iothread case
This reverts commits 225d02cd and c9f7383c. While some parts of the latter could be saved, I preferred a smooth, complete revert. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
This commit is contained in:
parent
ab33fcda9f
commit
1ece93a91b
24
qemu-timer.c
24
qemu-timer.c
@ -110,9 +110,12 @@ static int64_t cpu_get_clock(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_IOTHREAD
|
||||||
static int64_t qemu_icount_delta(void)
|
static int64_t qemu_icount_delta(void)
|
||||||
{
|
{
|
||||||
if (use_icount == 1) {
|
if (!use_icount) {
|
||||||
|
return 5000 * (int64_t) 1000000;
|
||||||
|
} else if (use_icount == 1) {
|
||||||
/* When not using an adaptive execution frequency
|
/* When not using an adaptive execution frequency
|
||||||
we tend to get badly out of sync with real time,
|
we tend to get badly out of sync with real time,
|
||||||
so just delay for a reasonable amount of time. */
|
so just delay for a reasonable amount of time. */
|
||||||
@ -121,6 +124,7 @@ static int64_t qemu_icount_delta(void)
|
|||||||
return cpu_get_icount() - cpu_get_clock();
|
return cpu_get_icount() - cpu_get_clock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* enable cpu_get_ticks() */
|
/* enable cpu_get_ticks() */
|
||||||
void cpu_enable_ticks(void)
|
void cpu_enable_ticks(void)
|
||||||
@ -1147,17 +1151,15 @@ void quit_timers(void)
|
|||||||
|
|
||||||
int qemu_calculate_timeout(void)
|
int qemu_calculate_timeout(void)
|
||||||
{
|
{
|
||||||
|
#ifndef CONFIG_IOTHREAD
|
||||||
int timeout;
|
int timeout;
|
||||||
|
|
||||||
|
if (!vm_running)
|
||||||
|
timeout = 5000;
|
||||||
|
else {
|
||||||
|
/* XXX: use timeout computed from timers */
|
||||||
int64_t add;
|
int64_t add;
|
||||||
int64_t delta;
|
int64_t delta;
|
||||||
|
|
||||||
/* When using icount, making forward progress with qemu_icount when the
|
|
||||||
guest CPU is idle is critical. We only use the static io-thread timeout
|
|
||||||
for non icount runs. */
|
|
||||||
if (!use_icount || !vm_running) {
|
|
||||||
return 5000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Advance virtual time to the next event. */
|
/* Advance virtual time to the next event. */
|
||||||
delta = qemu_icount_delta();
|
delta = qemu_icount_delta();
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
@ -1179,7 +1181,11 @@ int qemu_calculate_timeout(void)
|
|||||||
if (timeout < 0)
|
if (timeout < 0)
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return timeout;
|
return timeout;
|
||||||
|
#else /* CONFIG_IOTHREAD */
|
||||||
|
return 1000;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user