2017-11-01 21:08:43 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
2012-10-13 16:46:48 +07:00
|
|
|
#ifndef _UAPI__LINUX_KVM_PARA_H
|
|
|
|
#define _UAPI__LINUX_KVM_PARA_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This header file provides a method for making a hypercall to the host
|
|
|
|
* Architectures should define:
|
|
|
|
* - kvm_hypercall0, kvm_hypercall1...
|
|
|
|
* - kvm_arch_para_features
|
|
|
|
* - kvm_para_available
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Return values for hypercalls */
|
|
|
|
#define KVM_ENOSYS 1000
|
|
|
|
#define KVM_EFAULT EFAULT
|
KVM: X86: Implement "send IPI" hypercall
Using hypercall to send IPIs by one vmexit instead of one by one for
xAPIC/x2APIC physical mode and one vmexit per-cluster for x2APIC cluster
mode. Intel guest can enter x2apic cluster mode when interrupt remmaping
is enabled in qemu, however, latest AMD EPYC still just supports xapic
mode which can get great improvement by Exit-less IPIs. This patchset
lets a guest send multicast IPIs, with at most 128 destinations per
hypercall in 64-bit mode and 64 vCPUs per hypercall in 32-bit mode.
Hardware: Xeon Skylake 2.5GHz, 2 sockets, 40 cores, 80 threads, the VM
is 80 vCPUs, IPI microbenchmark(https://lkml.org/lkml/2017/12/19/141):
x2apic cluster mode, vanilla
Dry-run: 0, 2392199 ns
Self-IPI: 6907514, 15027589 ns
Normal IPI: 223910476, 251301666 ns
Broadcast IPI: 0, 9282161150 ns
Broadcast lock: 0, 8812934104 ns
x2apic cluster mode, pv-ipi
Dry-run: 0, 2449341 ns
Self-IPI: 6720360, 15028732 ns
Normal IPI: 228643307, 255708477 ns
Broadcast IPI: 0, 7572293590 ns => 22% performance boost
Broadcast lock: 0, 8316124651 ns
x2apic physical mode, vanilla
Dry-run: 0, 3135933 ns
Self-IPI: 8572670, 17901757 ns
Normal IPI: 226444334, 255421709 ns
Broadcast IPI: 0, 19845070887 ns
Broadcast lock: 0, 19827383656 ns
x2apic physical mode, pv-ipi
Dry-run: 0, 2446381 ns
Self-IPI: 6788217, 15021056 ns
Normal IPI: 219454441, 249583458 ns
Broadcast IPI: 0, 7806540019 ns => 154% performance boost
Broadcast lock: 0, 9143618799 ns
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-23 13:39:54 +07:00
|
|
|
#define KVM_EINVAL EINVAL
|
2012-10-13 16:46:48 +07:00
|
|
|
#define KVM_E2BIG E2BIG
|
|
|
|
#define KVM_EPERM EPERM
|
2017-01-25 00:09:39 +07:00
|
|
|
#define KVM_EOPNOTSUPP 95
|
2012-10-13 16:46:48 +07:00
|
|
|
|
|
|
|
#define KVM_HC_VAPIC_POLL_IRQ 1
|
|
|
|
#define KVM_HC_MMU_OP 2
|
|
|
|
#define KVM_HC_FEATURES 3
|
|
|
|
#define KVM_HC_PPC_MAP_MAGIC_PAGE 4
|
2013-08-09 21:22:00 +07:00
|
|
|
#define KVM_HC_KICK_CPU 5
|
2014-05-29 04:52:12 +07:00
|
|
|
#define KVM_HC_MIPS_GET_CLOCK_FREQ 6
|
|
|
|
#define KVM_HC_MIPS_EXIT_VM 7
|
|
|
|
#define KVM_HC_MIPS_CONSOLE_OUTPUT 8
|
2017-01-25 00:09:39 +07:00
|
|
|
#define KVM_HC_CLOCK_PAIRING 9
|
2018-07-23 13:39:52 +07:00
|
|
|
#define KVM_HC_SEND_IPI 10
|
2019-06-11 19:23:48 +07:00
|
|
|
#define KVM_HC_SCHED_YIELD 11
|
2012-10-13 16:46:48 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* hypercalls use architecture specific
|
|
|
|
*/
|
|
|
|
#include <asm/kvm_para.h>
|
|
|
|
|
|
|
|
#endif /* _UAPI__LINUX_KVM_PARA_H */
|