Paolo Bonzini ad3610919e kvm: x86: avoid atomic operations on APICv vmentry
On some benchmarks (e.g. netperf with ioeventfd disabled), APICv
posted interrupts turn out to be slower than interrupt injection via
KVM_REQ_EVENT.

This patch optimizes a bit the IRR update, avoiding expensive atomic
operations in the common case where PI.ON=0 at vmentry or the PIR vector
is mostly zero.  This saves at least 20 cycles (1%) per vmexit, as
measured by kvm-unit-tests' inl_from_qemu test (20 runs):

              | enable_apicv=1  |  enable_apicv=0
              | mean     stdev  |  mean     stdev
    ----------|-----------------|------------------
    before    | 5826     32.65  |  5765     47.09
    after     | 5809     43.42  |  5777     77.02

Of course, any change in the right column is just placebo effect. :)
The savings are bigger if interrupts are frequent.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-03 12:27:51 +01:00
..
2016-07-23 11:04:23 -07:00
2016-09-20 09:26:20 +02:00
2016-09-20 09:26:20 +02:00
2016-10-11 15:06:33 -07:00
2016-10-20 14:54:11 +02:00
2016-07-14 09:03:57 +02:00
2016-06-16 00:05:00 +02:00
2016-01-15 17:56:32 -08:00
2016-07-14 09:02:47 +02:00
2016-06-14 11:16:28 +02:00
2016-09-20 09:26:15 +02:00