linux_dsm_epyc7002/arch/s390/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
..
diag.c KVM: s390: provide logging for diagnose 0x500 2016-06-10 12:07:26 +02:00
gaccess.c KVM: s390: Get rid of ar_t 2017-01-30 11:17:29 +01:00
gaccess.h KVM: s390: prepare to read random guest instructions 2017-01-30 11:19:16 +01:00
guestdbg.c KVM: s390: guestdbg: filter PER i-fetch on EXECUTE properly 2017-01-30 11:19:17 +01:00
intercept.c KVM: s390: detect some program check loops 2017-02-06 12:35:53 +01:00
interrupt.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
irq.h KVM: s390: irq routing for adapter interrupts. 2014-03-21 13:43:00 +01:00
Kconfig KVM: halt_polling: provide a way to qualify wakeups during poll 2016-05-13 17:29:23 +02:00
kvm-s390.c KVM: race-free exit from KVM_RUN without POSIX signals 2017-02-17 12:27:37 +01:00
kvm-s390.h KVM: s390: guestdbg: filter PER i-fetch on EXECUTE properly 2017-01-30 11:19:17 +01:00
Makefile KVM: s390: vsie: initial support for nested virtualization 2016-06-21 09:43:33 +02:00
priv.c KVM: s390: Get rid of ar_t 2017-01-30 11:17:29 +01:00
sigp.c KVM: s390: don't use CPUSTAT_WAIT to detect if a VCPU is idle 2016-06-21 09:43:45 +02:00
sthyi.c KVM: s390: Fix STHYI buffer alignment for diag224 2016-10-26 13:46:44 +02:00
trace-s390.h KVM: s390: obey kptr_restrict in traces 2015-12-15 17:06:32 +01:00
trace.h KVM: s390: trace and count all skey intercepts 2016-06-10 12:07:31 +02:00
vsie.c KVM: s390: instruction-execution-protection support 2017-01-30 11:17:28 +01:00