All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/16] Move vcpu_load and vcpu_put calls to arch code
@ 2017-12-04 20:35 ` Christoffer Dall
  0 siblings, 0 replies; 152+ messages in thread
From: Christoffer Dall @ 2017-12-04 20:35 UTC (permalink / raw)
  To: kvm
  Cc: linux-mips, Marc Zyngier, James Hogan, Cornelia Huck, kvm-ppc,
	Paul Mackerras, Christian Borntraeger, linux-arm-kernel,
	Paolo Bonzini, linux-s390, kvmarm

From: Christoffer Dall <christoffer.dall@linaro.org>

Some architectures may decide to do different things during
kvm_arch_vcpu_load depending on the ioctl being executed.  For example,
arm64 is about to do significant work in vcpu load/put when running a
vcpu, but it's problematic to do this for any other vcpu ioctl than
KVM_RUN.

Further, while it may be possible to call kvm_arch_vcpu_load() for a
number of non-KVM_RUN ioctls, it makes the KVM/ARM code more difficult
to reason about, especially after my optimization series, because a lot
of things can now happen, where we have to consider if we're really in
the process of running a vcpu or not.

This series will first move the vcpu_load() and vcpu_put() calls in the
arch generic dispatch function into each case of the switch statement
and then, one-by-one, pushed the calls down into the architecture
specific code making the changes for each ioctl as required.

Based on v4.15-rc1

Patches also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/cdall/linux.git vcpu-load-put-v3

Changes since v2:
 - Clarified commit message on patch 1
 - Initialized ret to -EINVAL at declaration on patch 9
 - Added David Hildenbrand's reviewed-by tag

Changes since v1:
 - Fix PPC and S390 bugs from v1
 - Take the mutex in the main disaptcher function and make vcpu_load a
   void, which simplifies the patches overall.
 - Add a patch that moves vcpu_load for arm/arm64 after the first-run
   init function.

Thanks,
-Christoffer

Christoffer Dall (16):
  KVM: Take vcpu->mutex outside vcpu_load
  KVM: Prepare for moving vcpu_load/vcpu_put into arch specific code
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_run
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_regs
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_regs
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_sregs
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_mpstate
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_mpstate
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_translate
  KVM: Move vcpu_load to arch-specific
    kvm_arch_vcpu_ioctl_set_guest_debug
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_fpu
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_fpu
  KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl
  KVM: arm/arm64: Avoid vcpu_load for other vcpu ioctls than KVM_RUN
  KVM: arm/arm64: Move vcpu_load call after kvm_vcpu_first_run_init

 arch/arm64/kvm/guest.c        |  12 +++--
 arch/mips/kvm/mips.c          |  58 +++++++++++++++--------
 arch/powerpc/kvm/book3s.c     |  24 +++++++++-
 arch/powerpc/kvm/booke.c      |  51 +++++++++++++++-----
 arch/powerpc/kvm/powerpc.c    |  19 +++++---
 arch/s390/kvm/kvm-s390.c      |  90 +++++++++++++++++++++++++++--------
 arch/x86/kvm/vmx.c            |   4 +-
 arch/x86/kvm/x86.c            | 106 ++++++++++++++++++++++++++++++------------
 include/linux/kvm_host.h      |   2 +-
 virt/kvm/arm/arch_timer.c     |   4 --
 virt/kvm/arm/arm.c            |  68 ++++++++++++++++++---------
 virt/kvm/arm/vgic/vgic-init.c |  11 -----
 virt/kvm/kvm_main.c           |  17 ++-----
 13 files changed, 322 insertions(+), 144 deletions(-)

-- 
2.14.2

^ permalink raw reply	[flat|nested] 152+ messages in thread

end of thread, other threads:[~2017-12-12 16:47 UTC | newest]

Thread overview: 152+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-04 20:35 [PATCH v3 00/16] Move vcpu_load and vcpu_put calls to arch code Christoffer Dall
2017-12-04 20:35 ` Christoffer Dall
2017-12-04 20:35 ` Christoffer Dall
2017-12-04 20:35 ` Christoffer Dall
2017-12-04 20:35 ` [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-05 14:32   ` Christian Borntraeger
2017-12-05 14:32     ` Christian Borntraeger
2017-12-05 14:32     ` Christian Borntraeger
2017-12-11 11:51   ` Cornelia Huck
2017-12-11 11:51     ` Cornelia Huck
2017-12-11 11:51     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 02/16] KVM: Prepare for moving vcpu_load/vcpu_put into arch specific code Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 11:57   ` Cornelia Huck
2017-12-11 11:57     ` Cornelia Huck
2017-12-11 11:57     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 03/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_run Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-05 14:39   ` Christian Borntraeger
2017-12-05 14:39     ` Christian Borntraeger
2017-12-05 14:39     ` Christian Borntraeger
2017-12-11 12:02   ` Cornelia Huck
2017-12-11 12:02     ` Cornelia Huck
2017-12-11 12:02     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 04/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_regs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:21   ` David Hildenbrand
2017-12-08 16:21     ` David Hildenbrand
2017-12-08 16:21     ` David Hildenbrand
2017-12-11 12:07   ` Cornelia Huck
2017-12-11 12:07     ` Cornelia Huck
2017-12-11 12:07     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 05/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_regs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:22   ` David Hildenbrand
2017-12-08 16:22     ` David Hildenbrand
2017-12-08 16:22     ` David Hildenbrand
2017-12-08 16:22     ` David Hildenbrand
2017-12-11 12:09   ` Cornelia Huck
2017-12-11 12:09     ` Cornelia Huck
2017-12-11 12:09     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 06/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_sregs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:23   ` David Hildenbrand
2017-12-08 16:23     ` David Hildenbrand
2017-12-08 16:23     ` David Hildenbrand
2017-12-11 12:13   ` Cornelia Huck
2017-12-11 12:13     ` Cornelia Huck
2017-12-11 12:13     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 07/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-08 16:26   ` David Hildenbrand
2017-12-08 16:26     ` David Hildenbrand
2017-12-08 16:26     ` David Hildenbrand
2017-12-11  9:19     ` Christoffer Dall
2017-12-11  9:19       ` Christoffer Dall
2017-12-11  9:19       ` Christoffer Dall
2017-12-11  9:19       ` Christoffer Dall
2017-12-12 16:33       ` Paolo Bonzini
2017-12-12 16:33         ` Paolo Bonzini
2017-12-12 16:33         ` Paolo Bonzini
2017-12-12 16:33         ` Paolo Bonzini
2017-12-11 12:15   ` Cornelia Huck
2017-12-11 12:15     ` Cornelia Huck
2017-12-11 12:15     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 08/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_mpstate Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:23   ` Cornelia Huck
2017-12-11 12:23     ` Cornelia Huck
2017-12-11 12:23     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 09/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_mpstate Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:25   ` Cornelia Huck
2017-12-11 12:25     ` Cornelia Huck
2017-12-11 12:25     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 10/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_translate Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:29   ` Cornelia Huck
2017-12-11 12:29     ` Cornelia Huck
2017-12-11 12:29     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 11/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_guest_debug Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:39   ` Cornelia Huck
2017-12-11 12:39     ` Cornelia Huck
2017-12-11 12:39     ` Cornelia Huck
2017-12-11 12:39     ` Cornelia Huck
2017-12-11 15:18     ` Christoffer Dall
2017-12-11 15:18       ` Christoffer Dall
2017-12-11 15:18       ` Christoffer Dall
2017-12-11 15:18       ` Christoffer Dall
2017-12-12 16:36     ` Paolo Bonzini
2017-12-12 16:36       ` Paolo Bonzini
2017-12-12 16:36       ` Paolo Bonzini
2017-12-04 20:35 ` [PATCH v3 12/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_fpu Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:43   ` Cornelia Huck
2017-12-11 12:43     ` Cornelia Huck
2017-12-11 12:43     ` Cornelia Huck
2017-12-11 12:43     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 13/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_fpu Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 12:45   ` Cornelia Huck
2017-12-11 12:45     ` Cornelia Huck
2017-12-11 12:45     ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 14/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-11 13:12   ` Cornelia Huck
2017-12-11 13:12     ` Cornelia Huck
2017-12-11 13:12     ` Cornelia Huck
2017-12-11 15:22     ` Christoffer Dall
2017-12-11 15:22       ` Christoffer Dall
2017-12-11 15:22       ` Christoffer Dall
2017-12-12 16:47       ` Paolo Bonzini
2017-12-12 16:47         ` Paolo Bonzini
2017-12-12 16:47         ` Paolo Bonzini
2017-12-04 20:35 ` [PATCH v3 15/16] KVM: arm/arm64: Avoid vcpu_load for other vcpu ioctls than KVM_RUN Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35 ` [PATCH v3 16/16] KVM: arm/arm64: Move vcpu_load call after kvm_vcpu_first_run_init Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall
2017-12-04 20:35   ` Christoffer Dall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.