linux/arch/s390
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
..
appldata Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
boot Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
configs s390: update defconfigs 2017-01-16 07:27:48 +01:00
crypto Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
hypfs s390: hypfs: make inode explicitly non-modular 2016-10-31 17:55:40 +01:00
include s390/ctl_reg: make __ctl_load a full memory barrier 2017-01-16 07:27:48 +01:00
kernel Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2017-01-02 09:08:45 -08:00
kvm KVM: race-free exit from KVM_RUN without POSIX signals 2017-02-17 12:27:37 +01:00
lib s390/lib: add missing memory barriers to string inline assemblies 2016-12-14 16:33:41 +01:00
mm KVM: s390: Fix RRBE return code not being CC 2017-01-30 11:19:17 +01:00
net bpf: xdp: Allow head adjustment in XDP prog 2016-12-08 14:25:13 -05:00
numa s390/numa: pin all possible cpus to nodes early 2016-12-07 07:23:33 +01:00
oprofile s390/dumpstack: restore reliable indicator for call traces 2016-10-17 14:44:30 +02:00
pci s390/pci: query fmb length 2016-12-14 16:33:41 +01:00
tools KVM: s390: instruction-execution-protection support 2017-01-30 11:17:28 +01:00
defconfig s390: update defconfigs 2017-01-16 07:27:48 +01:00
Kbuild s390/numa: add core infrastructure 2015-08-03 18:40:25 +02:00
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-12-13 16:33:33 -08:00
Kconfig.debug arch: consolidate CONFIG_STRICT_DEVM in lib/Kconfig.debug 2016-01-09 06:30:49 -08:00
Makefile s390: add assembler include path for vx-insn.h 2016-09-06 11:00:04 +02:00