linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v3 0/4] KVM: arm64: Optimise FPSIMD context switching
Date: Mon,  9 Apr 2018 11:52:58 +0100	[thread overview]
Message-ID: <1523271182-22130-1-git-send-email-Dave.Martin@arm.com> (raw)

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

The only changes since RFC v2 are:

 * inclusion of the function bodies for the KVM run loop fp helper
   functions (git add lost during rebase ... oops).

 * update of the commit message on patch 4 to provide a bit more
   explanation of what _park_fp() does.


Blurb:

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 v2 0/3] KVM: arm64: Optimise FPSIMD context switching
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-April/570561.html


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

Dave Martin (3):
  arm64: fpsimd: Split cpu field out from struct fpsimd_state
  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    |  34 +++---------
 arch/arm64/include/asm/kvm_host.h  |  18 ++++++
 arch/arm64/include/asm/processor.h |   4 +-
 arch/arm64/kernel/fpsimd.c         |  66 +++++++++++++---------
 arch/arm64/kernel/ptrace.c         |  10 ++--
 arch/arm64/kernel/signal.c         |   3 +-
 arch/arm64/kernel/signal32.c       |   3 +-
 arch/arm64/kvm/Kconfig             |   1 +
 arch/arm64/kvm/Makefile            |   2 +-
 arch/arm64/kvm/fpsimd.c            | 109 +++++++++++++++++++++++++++++++++++++
 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 ++-
 17 files changed, 287 insertions(+), 113 deletions(-)
 create mode 100644 arch/arm64/kvm/fpsimd.c

-- 
2.1.4

             reply	other threads:[~2018-04-09 10:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09 10:52 Dave Martin [this message]
2018-04-09 10:52 ` [RFC PATCH v3 1/4] arm64: fpsimd: Split cpu field out from struct fpsimd_state Dave Martin
2018-04-09 10:53 ` [RFC PATCH v3 2/4] KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change Dave Martin
2018-04-09 10:53 ` [RFC PATCH v3 3/4] KVM: arm64: Convert lazy FPSIMD context switch trap to C Dave Martin
2018-04-09 10:53 ` [RFC PATCH v3 4/4] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing Dave Martin
2018-04-09 21:22   ` Christoffer Dall
2018-04-10 10:32     ` Dave Martin
2018-04-10 15:29       ` Christoffer Dall
2018-04-10 15:51         ` Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1523271182-22130-1-git-send-email-Dave.Martin@arm.com \
    --to=dave.martin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).