« Previous | Next » 

Revision 3b2319a3

ID3b2319a30b5ae528787bf3769b1a28a863b53252

Added by Paolo Bonzini about 13 years ago

really fix -icount in the iothread case

The correct fix for -icount is to consider the biggest difference
between iothread and non-iothread modes. In the traditional model,
CPUs run before the iothread calls select (or WaitForMultipleObjects
for Win32). In the iothread model, CPUs run while the iothread
isn't holding the mutex, i.e. during those same calls.

So, the iothread should always block as long as possible to let
the CPUs run smoothly---the timeout might as well be infinite---and
either the OS or the CPU thread itself will let the iothread know
when something happens. At this point, the iothread wakes up and
interrupts the CPU.

This is exactly the approach that this patch takes: when cpu_exec_all
returns in -icount mode, and it is because a vm_clock deadline has
been met, it wakes up the iothread to process the timers. This is
really the "bulk" of fixing icount.

Signed-off-by: Paolo Bonzini <>
Tested-by: Edgar E. Iglesias <>
Signed-off-by: Edgar E. Iglesias <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences