Skip to content

KVM: arm/arm64: vgic: Improvements and optimizations

Christoffer Dall kvm kvmarm linux-arm-kernel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 5 repliesIn review
  2. v19 patches 18 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/putarch/arm/include/asm/kvm_asm.h arch/arm/kvm/arm.c arch/arm64/include/asm/kvm_asm.h +8 more+106 -161 reply
2/10KVM: arm/arm64: vgic: Avoid flushing vgic state when there's no pending IRQvirt/kvm/arm/vgic/vgic.c+17 -01 reply
3/10KVM: arm/arm64: vgic: Get rid of live_lrsinclude/kvm/arm_vgic.h virt/kvm/arm/hyp/vgic-v2-sr.c virt/kvm/arm/hyp/vgic-v3-sr.c+22 -610 replies
4/10KVM: arm/arm64: vgic: Only set underflow when actually out of LRsvirt/kvm/arm/vgic/vgic.c+6 -41 reply
5/10KVM: arm/arm64: vgic: Get rid of unnecessary process_maintenance operationvirt/kvm/arm/vgic/vgic-v2.c virt/kvm/arm/vgic/vgic-v3.c virt/kvm/arm/vgic/vgic.c +1 more+25 -961 reply
6/10KVM: arm/arm64: vgic: Get rid of unnecessary save_maint_int_statevirt/kvm/arm/hyp/vgic-v2-sr.c virt/kvm/arm/hyp/vgic-v3-sr.c+0 -690 replies
7/10KVM: arm/arm64: vgic: Get rid of MISR and EISR fieldsinclude/kvm/arm_vgic.h virt/kvm/arm/hyp/vgic-v2-sr.c virt/kvm/arm/hyp/vgic-v3-sr.c+0 -80 replies
8/10KVM: arm/arm64: vgic: Implement early VGIC init functionalityvirt/kvm/arm/vgic/vgic-init.c+56 -400 replies
9/10KVM: arm/arm64: vgic: Don't check vgic_initialized in sync/flushvirt/kvm/arm/vgic/vgic.c+0 -60 replies
10/10KVM: arm/arm64: vgic: Improve sync_hwstate performancevirt/kvm/arm/vgic/vgic-v2.c virt/kvm/arm/vgic/vgic-v3.c virt/kvm/arm/vgic/vgic.c+16 -81 reply

Reviews trailers per patch

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

PatchMarc Zyngier
1/10R-b
2/10R-b
3/10A-b
4/10A-b
5/10R-b
6/10A-b
7/10A-b
8/10A-b
9/10A-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/10] KVM: arm/arm64: vgic: Improvements and optimizations

We can improve the performance of our VGIC implementation a bit and clean up a lot of the implementation while we're at it.

At first, patch 1 may seem excessive for a single register, the VMCR, but while it adds complexity it does move logic out of the critical path and into the vcpu_load/put hooks, which are executed much more rarely. It also provides an infrastructure to move more things into the vgic_load/put functions later one.

Avoiding the need to take a spinlock in the common case where there are no virtual interrupts in flight are actually measurable and well worth the effort.

The implementation cleanups boil down to maintaining a single count of the used LRs instead of an additional bitmap, avoiding the need to deal with the MISR and EISR fields, and doing an early init of the VGIC to avoid a number of vgic_initialized() checks.

Tested on Mustang and TC2, and Thunder-X.

Changelogs are in the patches.

Patches also available on:
git://git.kernel.org/pub/scm/linux/kernel/git/cdall/linux.git gic-optimize-v2

Thanks,
-Christoffer

Christoffer Dall (9):
KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/put
KVM: arm/arm64: vgic: Get rid of live_lrs
KVM: arm/arm64: vgic: Only set underflow when actually out of LRs
KVM: arm/arm64: vgic: Get rid of unnecessary process_maintenance
operation
KVM: arm/arm64: vgic: Get rid of unnecessary save_maint_int_state
KVM: arm/arm64: vgic: Get rid of MISR and EISR fields
KVM: arm/arm64: vgic: Implement early VGIC init functionality
KVM: arm/arm64: vgic: Don't check vgic_initialized in sync/flush
KVM: arm/arm64: vgic: Improve sync_hwstate performance

Shih-Wei Li (1):
KVM: arm/arm64: vgic: Avoid flushing vgic state when there's no
pending IRQ

 arch/arm/include/asm/kvm_asm.h   |   3 ++
 arch/arm/kvm/arm.c               |  11 ++--
 arch/arm64/include/asm/kvm_asm.h |   2 +
 include/kvm/arm_vgic.h           |   9 ++--
 virt/kvm/arm/hyp/vgic-v2-sr.c    |  78 +++-------------------------
 virt/kvm/arm/hyp/vgic-v3-sr.c    |  79 +++++++---------------------
 virt/kvm/arm/vgic/vgic-init.c    | 108 ++++++++++++++++++++++++---------------
 virt/kvm/arm/vgic/vgic-v2.c      |  90 ++++++++++++++------------------
 virt/kvm/arm/vgic/vgic-v3.c      |  80 ++++++++++++++---------------
 virt/kvm/arm/vgic/vgic.c         |  60 ++++++++++++++++------
 virt/kvm/arm/vgic/vgic.h         |   8 ++-
 11 files changed, 234 insertions(+), 294 deletions(-)
Signature · 1 line
2.9.0