[PATCH 0/3] Introduce new vcpu ioctls KVM_(GET|SET)_MANY_REGS

darkhan
2020-11-20T12:56:58Z

The ultimate goal is to introduce new vcpu ioctls KVM_(GET|SET)_MANY_REGS.
To introduce these ioctls, implementations of KVM_(GET|SET)_ONE_REG have
to be refactored. Specifically, KVM_(GET|SET)_ONE_REG should be handled in
a generic kvm_vcpu_ioctl function.

New KVM APIs KVM_(GET|SET)_MANY_REGS make it possible to bulk read/write
vCPU registers at one ioctl call. These ioctls can be very useful when
vCPU state serialization/deserialization is required (e.g. live update of
kvm, live migration of guests), hence all registers have to be
saved/restored. KVM_(GET|SET)_MANY_REGS will help avoid performance
overhead associated with syscall (ioctl in our case) handling. Tests
conducted on AWS Graviton2 Processors (64-bit ARM Neoverse cores) show
that average save/restore time of all vCPU registers can be optimized
~3.5 times per vCPU with new ioctls. Test results can be found in Table 1.
+---------+-------------+---------------+
| | kvm_one_reg | kvm_many_regs |
+---------+-------------+---------------+
| get all | 123 usec | 33 usec |
+---------+-------------+---------------+
| set all | 120 usec | 36 usec |
+---------+-------------+---------------+
Table 1. Test results

The patches are based out of kvm/queue.

Darkhan Mukashov (3):
Documentation: KVM: change description of vcpu ioctls
KVM_(GET|SET)_ONE_REG
KVM: handle vcpu ioctls KVM_(GET|SET)_ONE_REG in a generic function
KVM: introduce new vcpu ioctls KVM_GET_MANY_REGS and KVM_SET_MANY_REGS

Documentation/virt/kvm/api.rst | 80 ++++++++++++++++++++++++++++--
arch/arm64/include/asm/kvm_host.h | 5 +-
arch/arm64/kvm/arm.c | 25 +++-------
arch/arm64/kvm/guest.c | 6 ++-
arch/mips/include/asm/kvm_host.h | 6 +++
arch/mips/kvm/mips.c | 32 ++++++------
arch/powerpc/include/asm/kvm_ppc.h | 2 -
arch/powerpc/kvm/powerpc.c | 20 ++------
arch/s390/include/asm/kvm_host.h | 6 +++
arch/s390/kvm/kvm-s390.c | 38 +++++++-------
arch/x86/kvm/x86.c | 12 +++++
include/linux/kvm_host.h | 18 +++++++
include/uapi/linux/kvm.h | 11 ++++
virt/kvm/kvm_main.c | 62 +++++++++++++++++++++++
14 files changed, 244 insertions(+), 79 deletions(-)

--
2.17.1