1
0
Fork 0
alistair23-linux/arch/arm/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
..
hyp arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU 2016-11-04 17:56:28 +00:00
Kconfig ARM: KVM: Support vGICv3 ITS 2016-11-14 10:32:54 +00:00
Makefile KVM: arm/arm64: vgic: Implement VGICv3 CPU interface access 2017-01-30 13:47:25 +00:00
arm.c KVM: race-free exit from KVM_RUN without POSIX signals 2017-02-17 12:27:37 +01:00
coproc.c ARM: KVM: Support vgic-v3 2016-09-22 13:22:21 +02:00
coproc.h ARM: KVM: Rename struct coproc_reg::is_64 to is_64bit 2016-02-29 18:34:22 +00:00
coproc_a7.c
coproc_a15.c
emulate.c arm: KVM: Add Virtual Abort injection helper 2016-09-08 12:53:00 +02:00
guest.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
handle_exit.c arm: KVM: Drop unreachable HYP abort handlers 2016-09-08 12:53:00 +02:00
init.S arm: KVM: Allow hyp teardown 2016-07-03 23:41:27 +02:00
interrupts.S
irq.h KVM: arm/arm64: Enable irqchip routing 2016-07-22 18:52:01 +01:00
mmio.c arm/arm64: KVM: Remove external abort test from MMIO handling 2016-09-08 12:53:00 +02:00
mmu.c arm/arm64: KVM: Get rid of KVM_MEMSLOT_INCOHERENT 2017-01-30 13:47:38 +00:00
perf.c
psci.c
reset.c KVM: arm/arm64: Initialize the emulated EL1 physical timer 2017-02-08 15:13:34 +00:00
trace.h
vgic-v3-coproc.c KVM: arm/arm64: vgic: Implement VGICv3 CPU interface access 2017-01-30 13:47:25 +00:00