Skip to content

KVM: arm/arm64: Fix locking issues

Andre Przywara kvm kvmarm linux-arm-kernel stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: arm/arm64: Properly protect VGIC locks from IRQsvirt/kvm/arm/vgic/vgic-debug.c virt/kvm/arm/vgic/vgic-its.c virt/kvm/arm/vgic/vgic.c+23 -140 replies
2/4KVM: arm/arm64: VGIC/ITS: Promote irq_lock() in update_affinityvirt/kvm/arm/vgic/vgic-its.c+3 -20 replies
3/4KVM: arm/arm64: VGIC/ITS: protect kvm_read_guest() calls with SRCU lockarch/arm/include/asm/kvm_mmu.h arch/arm64/include/asm/kvm_mmu.h virt/kvm/arm/vgic/vgic-its.c+40 -70 replies
4/4KVM: arm/arm64: VGIC/ITS save/restore: protect kvm_read_guest() callsvirt/kvm/arm/vgic/vgic-its.c virt/kvm/arm/vgic/vgic-v3.c+4 -40 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristoffer DallMarc Zyngier
SeriesA-b A-b
1/4
2/4
3/4
4/4

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

Read the v1 thread

Cover letter [PATCH 0/4] KVM: arm/arm64: Fix locking issues

Jan recently reported lockdep complaints regarding various locks in our VGIC emulation [1][2].
This boiled down to two separate issues:
- When promoting the vgic_irq->irq_lock to require IRQs being disabled, we forgot to amend some instances of this lock on the way. Also this needs to be applied to dependent locks as well. The first two patches fix that. The patch split is designed to simplify backporting. Those patches have been posted before, I am resending them as part of this series.
- Calling kvm_read_guest() requires us to be inside an SRCU critical section. On some architectures we are always in it when handling VCPU exits, but on ARM we need to lock it individually. Patches 3 and 4 fix that, the split is again made to ease backporting.
Each of the hunks fix an indiviual commit, but I refrained from splitting this down into eight patches just to put proper Fixes: tags on it. Eventually those commits are part of one out of two series, I put the respective kernel release version as a tag to the Cc: stable line.

I couldn't reproduce the full lockdep splat on my setup, but at least could show one instance and prove that these patches fixes that.

Thanks to Jan for reporting.

Cheers,
Andre.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/575718.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/575833.html

Andre Przywara (4):
KVM: ARM: Properly protect VGIC locks from IRQs
KVM: ARM: VGIC/ITS: Promote irq_lock() in update_affinity
KVM: arm/arm64: VGIC/ITS: protect kvm_read_guest() calls with SRCU lock
KVM: arm/arm64: VGIC/ITS save/restore: protect kvm_read_guest() calls

 arch/arm/include/asm/kvm_mmu.h   | 16 ++++++++++++++++
 arch/arm64/include/asm/kvm_mmu.h | 16 ++++++++++++++++
 virt/kvm/arm/vgic/vgic-debug.c   |  5 +++--
 virt/kvm/arm/vgic/vgic-its.c     | 34 +++++++++++++++++++---------------
 virt/kvm/arm/vgic/vgic-v3.c      |  4 ++--
 virt/kvm/arm/vgic/vgic.c         | 22 ++++++++++++++--------
 6 files changed, 70 insertions(+), 27 deletions(-)
Signature · 1 line
2.14.1