All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/3] KVM: arm64: Optimise FPSIMD context switching
@ 2018-04-06 15:01 ` Dave Martin
  0 siblings, 0 replies; 28+ messages in thread
From: Dave Martin @ 2018-04-06 15:01 UTC (permalink / raw)
  To: kvmarm; +Cc: Marc Zyngier, linux-arm-kernel, Ard Biesheuvel

This is a respin of my attempt to improve FPSIMD context handling for
KVM, building on the previous RFC [1].

These patches are based on torvalds/master, but it should be sufficient
to cherry-pick commit 20b8547277a6 ("arm64: fpsimd: Split cpu field out
from struct fpsimd_state") onto v4.16.

See the individual patches for detailed explanation.

Some things (still) definitely aren't right yet:

 * Handling of the host SVE state is incomplete: the Hyp code still
   needs to be taught how to save back the host SVE state in the right
   place.  This will eliminate redundant work in some scenarios and
   obviate the need for sve_flush_cpu_state().

   As such, this series breaks the kernel for CONFIG_ARM64_SVE=y.

   Nevertheless, this series gets the code into a shape where fixing
   host SVE handling should be relatively straightforward.  I will
   follow up with patches to sort that out.

 * TIF_SVE is probably not set/cleared in exactly the correct places
   (not tested/exercised, because SVE in general doesn't work here yet).

 * task_fpsimd_save() now appears misnamed, but in lieu of having
   decided on a better name I've just exported this function from
   fpsimd.c for now.

I did try to come up with a diagram to explain the context switching
flow in the final patch, but it proved hard (sorry Marc).  I'm open to
suggestions, but the best option for now is to go look at the code
(which is now in a much cleaner state).

Somewhat tested on the ARM Fast model (with and without VHE) and Juno r0
(non-VHE ... until the firmware bricked itself, but I'm pretty sure that
was unrelated).

Any comments, testing, benchmarks appreciated!

Cheers
---Dave

[1] [RFC PATCH 0/4] KVM: arm64: Optimise FPSIMD context switching
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-March/567958.html


Christoffer Dall (1):
  KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change

Dave Martin (2):
  KVM: arm64: Convert lazy FPSIMD context switch trap to C
  KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

 arch/arm/include/asm/kvm_host.h   |  8 +++++
 arch/arm64/include/asm/fpsimd.h   |  5 ++++
 arch/arm64/include/asm/kvm_host.h | 18 ++++++++++++
 arch/arm64/kernel/fpsimd.c        | 31 +++++++++++++++-----
 arch/arm64/kvm/Kconfig            |  1 +
 arch/arm64/kvm/Makefile           |  2 +-
 arch/arm64/kvm/hyp/entry.S        | 57 ++++++++++++++---------------------
 arch/arm64/kvm/hyp/switch.c       | 62 +++++++++++++++++++++++++++++++--------
 include/linux/kvm_host.h          |  9 ++++++
 virt/kvm/Kconfig                  |  3 ++
 virt/kvm/arm/arm.c                |  4 +++
 virt/kvm/kvm_main.c               |  7 ++++-
 12 files changed, 150 insertions(+), 57 deletions(-)

-- 
2.1.4

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

end of thread, other threads:[~2018-04-09 10:57 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06 15:01 [RFC PATCH v2 0/3] KVM: arm64: Optimise FPSIMD context switching Dave Martin
2018-04-06 15:01 ` Dave Martin
2018-04-06 15:01 ` [RFC PATCH v2 1/3] KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change Dave Martin
2018-04-06 15:01   ` Dave Martin
2018-04-06 15:01 ` [RFC PATCH v2 2/3] KVM: arm64: Convert lazy FPSIMD context switch trap to C Dave Martin
2018-04-06 15:01   ` Dave Martin
2018-04-06 15:25   ` Marc Zyngier
2018-04-06 15:25     ` Marc Zyngier
2018-04-06 15:51     ` Dave Martin
2018-04-06 15:51       ` Dave Martin
2018-04-09  9:44       ` Christoffer Dall
2018-04-09  9:44         ` Christoffer Dall
2018-04-09 10:00         ` Marc Zyngier
2018-04-09 10:00           ` Marc Zyngier
2018-04-09 10:26           ` Christoffer Dall
2018-04-09 10:26             ` Christoffer Dall
2018-04-06 15:01 ` [RFC PATCH v2 3/3] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing Dave Martin
2018-04-06 15:01   ` Dave Martin
2018-04-07  9:54   ` Marc Zyngier
2018-04-07  9:54     ` Marc Zyngier
2018-04-09 10:55     ` Dave Martin
2018-04-09 10:55       ` Dave Martin
2018-04-09  9:48   ` Christoffer Dall
2018-04-09  9:48     ` Christoffer Dall
2018-04-09 10:23     ` Dave Martin
2018-04-09 10:23       ` Dave Martin
2018-04-09 10:57     ` Dave Martin
2018-04-09 10:57       ` Dave Martin

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.