linux-stable/Documentation/virtual/kvm
Paolo Bonzini 460df4c1fc KVM: race-free exit from KVM_RUN without POSIX signals
The purpose of the KVM_SET_SIGNAL_MASK API is to let userspace "kick"
a VCPU out of KVM_RUN through a POSIX signal.  A signal is attached
to a dummy signal handler; by blocking the signal outside KVM_RUN and
unblocking it inside, this possible race is closed:

          VCPU thread                     service thread
   --------------------------------------------------------------
        check flag
                                          set flag
                                          raise signal
        (signal handler does nothing)
        KVM_RUN

However, one issue with KVM_SET_SIGNAL_MASK is that it has to take
tsk->sighand->siglock on every KVM_RUN.  This lock is often on a
remote NUMA node, because it is on the node of a thread's creator.
Taking this lock can be very expensive if there are many userspace
exits (as is the case for SMP Windows VMs without Hyper-V reference
time counter).

As an alternative, we can put the flag directly in kvm_run so that
KVM can see it:

          VCPU thread                     service thread
   --------------------------------------------------------------
                                          raise signal
        signal handler
          set run->immediate_exit
        KVM_RUN
          check run->immediate_exit

Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-02-17 12:27:37 +01:00
..
arm arm/arm64: KVM: Add forwarded physical interrupts documentation 2015-10-22 23:01:43 +02:00
devices KVM: arm/arm64: Documentation: Update arm-vgic-v3.txt 2017-01-30 13:47:33 +00:00
00-INDEX KVM: Add halt polling documentation 2016-11-28 11:48:47 +11:00
api.txt KVM: race-free exit from KVM_RUN without POSIX signals 2017-02-17 12:27:37 +01:00
cpuid.txt Documentation/kvm: Update cpuid documentation for steal time and pv eoi 2013-09-24 19:12:16 +02:00
halt-polling.txt KVM: Add halt polling documentation 2016-11-28 11:48:47 +11:00
hypercalls.txt KVM: x86: add KVM_HC_CLOCK_PAIRING hypercall 2017-02-07 18:16:45 +01:00
locking.txt kvm: x86: mmu: Update documentation for fast page fault mechanism 2017-01-09 14:46:12 +01:00
mmu.txt One of the largest releases for KVM... Hardly any generic improvement, 2016-03-16 09:55:35 -07:00
msr.txt Documentation/virtual/kvm: Support the vCPU preemption check 2016-11-22 12:48:09 +01:00
nested-vmx.txt KVM: nVMX: Documentation 2011-07-12 13:15:22 +03:00
ppc-pv.txt Doc:kvm: Fix typo in Doc/virtual/kvm 2015-10-11 15:35:23 -06:00
review-checklist.txt docs: fix locations of several documents that got moved 2016-10-24 08:12:35 -02:00
s390-diag.txt KVM: s390: add documentation for diag 501 2014-04-22 13:24:51 +02:00
timekeeping.txt KVM: doc: Fix typo in doc/virtual/kvm 2013-12-31 17:24:54 -02:00