qemu-e2k/target-i386
Paolo Bonzini b5fc314bcb target-i386: yield to another VCPU on PAUSE
After commit b1bbfe7 (aio / timers: On timer modification, qemu_notify
or aio_notify, 2013-08-21) FreeBSD guests report a huge slowdown.

The problem shows up as soon as FreeBSD turns out its periodic (~1 ms)
tick, but the timers are only the trigger for a pre-existing problem.

Before the offending patch, setting a timer did a timer_settime system call.

After, setting the timer exits the event loop (which uses poll) and
reenters it with a new deadline.  This does not cause any slowdown; the
difference is between one system call (timer_settime and a signal
delivery (SIGALRM) before the patch, and two system calls afterwards
(write to a pipe or eventfd + calling poll again when re-entering the
event loop).

Unfortunately, the exit/enter causes the main loop to grab the iothread
lock, which in turns kicks the VCPU thread out of execution.  This
causes TCG to execute the next VCPU in its round-robin scheduling of
VCPUS.  When the second VCPU is mostly unused, FreeBSD runs a "pause"
instruction in its idle loop which only burns cycles without any
progress.  As soon as the timer tick expires, the first VCPU runs
the interrupt handler but very soon it sets it again---and QEMU
then goes back doing nothing in the second VCPU.

The fix is to make the pause instruction do "cpu_loop_exit".

Reported-by: Luigi Rizzo <rizzo@iet.unipi.it>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-11-21 17:39:20 +01:00
..
arch_dump.c
arch_memory_mapping.c target-i386: Fix compiler warning (integer constant is too large) 2013-10-02 22:55:28 +04:00
cc_helper_template.h
cc_helper.c
cpu-qom.h target-i386: forward CPUID cache leaves when -cpu host is used 2013-09-20 12:38:40 +02:00
cpu.c Merge remote-tracking branch 'qemu-kvm/uq/master' into staging 2013-10-18 10:03:24 -07:00
cpu.h x86: fix migration from pre-version 12 2013-10-02 18:58:23 +03:00
excp_helper.c
fpu_helper.c
gdbstub.c
helper.c Merge remote-tracking branch 'mjt/trivial-patches' into staging 2013-09-23 11:52:55 -05:00
helper.h target-i386: yield to another VCPU on PAUSE 2013-11-21 17:39:20 +01:00
int_helper.c
ioport-user.c
kvm_i386.h
kvm-stub.c target-i386: Fix build by providing stub kvm_arch_get_supported_cpuid() 2013-11-21 17:39:11 +01:00
kvm.c Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5 2013-08-29 17:21:51 -05:00
machine.c fix steal time MSR vmsd callback to proper opaque type 2013-09-20 12:37:52 +02:00
Makefile.objs Makefile.target: CONFIG_NO_* variables removed 2013-10-16 18:21:00 +02:00
mem_helper.c
misc_helper.c target-i386: yield to another VCPU on PAUSE 2013-11-21 17:39:20 +01:00
ops_sse_header.h
ops_sse.h
seg_helper.c
shift_helper_template.h
smm_helper.c
svm_helper.c
svm.h
TODO
topology.h
translate.c target-i386: yield to another VCPU on PAUSE 2013-11-21 17:39:20 +01:00