Leave inner main_loop faster on pending requests
If there is any pending request that requires us to leave the inner loop if main_loop, makes sure we do this as soon as possible by enforcing non-blocking IO processing. At this change, move variable definitions out of the inner loop to improve readability. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
38145df24c
commit
8e1b90ecc5
11
vl.c
11
vl.c
|
@ -1402,18 +1402,21 @@ qemu_irq qemu_system_powerdown;
|
||||||
|
|
||||||
static void main_loop(void)
|
static void main_loop(void)
|
||||||
{
|
{
|
||||||
|
bool nonblocking = false;
|
||||||
|
#ifdef CONFIG_PROFILER
|
||||||
|
int64_t ti;
|
||||||
|
#endif
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
qemu_main_loop_start();
|
qemu_main_loop_start();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
do {
|
do {
|
||||||
bool nonblocking = false;
|
|
||||||
#ifdef CONFIG_PROFILER
|
|
||||||
int64_t ti;
|
|
||||||
#endif
|
|
||||||
#ifndef CONFIG_IOTHREAD
|
#ifndef CONFIG_IOTHREAD
|
||||||
nonblocking = cpu_exec_all();
|
nonblocking = cpu_exec_all();
|
||||||
|
if (!vm_can_run()) {
|
||||||
|
nonblocking = true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
ti = profile_getclock();
|
ti = profile_getclock();
|
||||||
|
|
Loading…
Reference in New Issue