Skip to content

KVM: arm64: Optimise FPSIMD context switching

Dave Martin kvmarm linux-arch linux-arm-kernel lkml 9 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v11 Latest19 patches 6 repliesIn review
  2. v1018 patches 50 repliesSuperseded
  3. v916 patches 2 repliesSuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v716 patches21 repliesSuperseded
v615 patches15 repliesSuperseded
v514 patches15 repliesSuperseded
v3 RFC4 patches4 repliesSuperseded
v2 RFC3 patches10 repliesSuperseded
v1 RFC4 patches0 repliesSuperseded

Patches in v11 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19arm64: fpsimd: Fix TIF_FOREIGN_FPSTATE after invalidating cpu regsarch/arm64/kernel/fpsimd.c+2 -50 replies
2/19thread_info: Add update_thread_flag() helpersinclude/linux/sched.h include/linux/thread_info.h+17 -01 reply
3/19arm64: Use update{,_tsk}_thread_flag()arch/arm64/kernel/fpsimd.c+8 -100 replies
4/19KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_changeinclude/linux/kvm_host.h virt/kvm/Kconfig virt/kvm/kvm_main.c+18 -10 replies
5/19KVM: arm64: Convert lazy FPSIMD context switch trap to Carch/arm64/kvm/hyp/entry.S arch/arm64/kvm/hyp/switch.c+46 -350 replies
6/19arm64: fpsimd: Generalise context saving for non-task contextsarch/arm64/kernel/fpsimd.c+14 -120 replies
7/19arm64: fpsimd: Avoid FPSIMD context leakage for the init taskarch/arm64/include/asm/thread_info.h+7 -61 reply
8/19arm64: fpsimd: Eliminate task->mm checksarch/arm64/include/asm/processor.h arch/arm64/kernel/fpsimd.c+19 -254 replies
9/19arm64/sve: Refactor user SVE trap maintenance for external usearch/arm64/kernel/fpsimd.c+15 -150 replies
10/19KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flagsarch/arm64/include/asm/kvm_asm.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/debug.c +3 more+18 -190 replies
11/19KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashingarch/arm/include/asm/kvm_host.h arch/arm64/include/asm/fpsimd.h arch/arm64/include/asm/kvm_host.h +6 more+192 -310 replies
12/19arm64/sve: Move read_zcr_features() out of cpufeature.harch/arm64/include/asm/cpufeature.h arch/arm64/include/asm/fpsimd.h arch/arm64/include/asm/processor.h +2 more+32 -290 replies
13/19arm64/sve: Switch sve_pffr() argument from task to threadarch/arm64/kernel/fpsimd.c+5 -50 replies
14/19arm64/sve: Move sve_pffr() to fpsimd.h and make inlinearch/arm64/include/asm/fpsimd.h arch/arm64/include/asm/processor.h arch/arm64/kernel/fpsimd.c+24 -130 replies
15/19KVM: arm64: Save host SVE context as appropriatearch/arm/include/asm/kvm_host.h arch/arm64/Kconfig arch/arm64/include/asm/kvm_host.h +3 more+47 -20 replies
16/19KVM: arm64: Remove eager host SVE state savingarch/arm/include/asm/kvm_host.h arch/arm64/include/asm/kvm_host.h arch/arm64/kernel/fpsimd.c +1 more+0 -370 replies
17/19KVM: arm64: Remove redundant *exit_code changes in fpsimd_guest_exit()arch/arm64/kvm/hyp/switch.c+4 -120 replies
18/19KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()arch/arm64/kvm/hyp/switch.c+8 -40 replies
19/19KVM: arm64: Invoke FPSIMD context switch trap from Carch/arm64/kvm/hyp/entry.S arch/arm64/kvm/hyp/hyp-entry.S arch/arm64/kvm/hyp/switch.c+13 -510 replies

Reviews trailers per patch

All 19 patches have a Reviewed-by or Acked-by.

PatchChristoffer DallAlex BennéeCatalin MarinasMarc ZyngierPeter Zijlstra (Intel)Steven Rostedt (VMware)
1/19R-b R-b R-b
2/19R-b A-b A-b A-b A-b
3/19R-b A-b A-b
4/19R-b R-b
5/19R-b R-b
6/19R-b A-b A-b
7/19R-b R-b
8/19R-b R-b R-b
9/19R-b A-b A-b
10/19A-b R-b R-b
11/19R-b R-b A-b R-b
12/19R-b A-b A-b
13/19R-b A-b A-b
14/19R-b A-b A-b
15/19R-b A-b
16/19A-b R-b A-b A-b
17/19A-b R-b A-b
18/19A-b R-b R-b
19/19R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v11 thread

Cover letter [PATCH v11 00/19] KVM: arm64: Optimise FPSIMD context switching

Note: Most of these patches are Arm-specific. People not Cc'd on the whole series can find it in the linux-arm-kernel archive [2].

Git: see [3]

This series aims to improve the way FPSIMD context is handled by KVM. Changes since the previous v10 [1] are minor, but one patch has been split.

** To Catalin Marinas, Alex Bennée: **

I have retained your Reviewed-bys on patches 7 and 8: these were split from patch 7 of v9. Although the code is (almost) the same as noted below, I advise you to take a look.

(all) reviewers please note:

* Patches 7 and 8 have been split from the previous patch 7, since the update to INIT_THREAD_INFO is logically a fix and deserves a Fixes: tag.

I have also moved the definition of INIT_THREAD_INFO to after the TIF_* definitions that it now depends on (mysteriously this wasn't causing a compile error anyway, but I've not dug into why).

* Other changes are all additions or rewordings of comments, and amendments commit messages.

Cheers
---Dave

[1] [PATCH v10 00/18] KVM: arm64: Optimise FPSIMD context switching
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/579899.html

[2] linux-arm-kernel archive
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/thread.html

[3] http://linux-arm.org/git?p=linux-dm.git;a=shortlog;h=refs/heads/kvm-vhe-fpsimd/v11

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

Dave Martin (18):
arm64: fpsimd: Fix TIF_FOREIGN_FPSTATE after invalidating cpu regs
thread_info: Add update_thread_flag() helpers
arm64: Use update{,_tsk}_thread_flag()
KVM: arm64: Convert lazy FPSIMD context switch trap to C
arm64: fpsimd: Generalise context saving for non-task contexts
arm64: fpsimd: Avoid FPSIMD context leakage for the init task
arm64: fpsimd: Eliminate task->mm checks
arm64/sve: Refactor user SVE trap maintenance for external use
KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flags
KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing arm64/sve: Move read_zcr_features() out of cpufeature.h arm64/sve: Switch sve_pffr() argument from task to thread arm64/sve: Move sve_pffr() to fpsimd.h and make inline
KVM: arm64: Save host SVE context as appropriate
KVM: arm64: Remove eager host SVE state saving
KVM: arm64: Remove redundant *exit_code changes in fpsimd_guest_exit()
KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()
KVM: arm64: Invoke FPSIMD context switch trap from C

 arch/arm/include/asm/kvm_host.h      |  10 +-
 arch/arm64/Kconfig                   |   7 ++
 arch/arm64/include/asm/cpufeature.h  |  29 ------
 arch/arm64/include/asm/fpsimd.h      |  21 +++++
 arch/arm64/include/asm/kvm_asm.h     |   3 -
 arch/arm64/include/asm/kvm_host.h    |  45 +++++++--
 arch/arm64/include/asm/processor.h   |  15 ++-
 arch/arm64/include/asm/thread_info.h |  13 +--
 arch/arm64/kernel/fpsimd.c           | 177 +++++++++++++++++------------------
 arch/arm64/kernel/ptrace.c           |   1 +
 arch/arm64/kvm/Kconfig               |   1 +
 arch/arm64/kvm/Makefile              |   2 +-
 arch/arm64/kvm/debug.c               |   8 +-
 arch/arm64/kvm/fpsimd.c              | 110 ++++++++++++++++++++++
 arch/arm64/kvm/hyp/debug-sr.c        |   6 +-
 arch/arm64/kvm/hyp/entry.S           |  43 ---------
 arch/arm64/kvm/hyp/hyp-entry.S       |  19 ----
 arch/arm64/kvm/hyp/switch.c          | 124 ++++++++++++++++--------
 arch/arm64/kvm/hyp/sysreg-sr.c       |   4 +-
 arch/arm64/kvm/sys_regs.c            |   9 +-
 include/linux/kvm_host.h             |   9 ++
 include/linux/sched.h                |   6 ++
 include/linux/thread_info.h          |  11 +++
 virt/kvm/Kconfig                     |   3 +
 virt/kvm/arm/arm.c                   |  14 ++-
 virt/kvm/kvm_main.c                  |   7 +-
 26 files changed, 437 insertions(+), 260 deletions(-)
 create mode 100644 arch/arm64/kvm/fpsimd.c
Signature · 1 line
2.1.4