Skip to content

KVM: arm64: ptdump: Shadow ptdump fixes

Wei-Lin Chang kvmarm linux-arm-kernel lkml stable 4 versions – Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 1 replyApplied
  2. v32 patches 4 repliesSuperseded
  3. v26 patches 17 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches6 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: arm64: ptdump: Check the page tables aren't freed when accessingarch/arm64/kvm/ptdump.c+33 -100 replies
2/2KVM: arm64: ptdump: Fix shadow ptdump sleep-in-atomic-context problemarch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_mmu.h arch/arm64/kvm/nested.c +1 more+21 -300 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchVincent DonnefortItaru Kitayama
1/2R-b T-b T-b
2/2T-b

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

Read the v4 thread

Cover letter [PATCH v4 0/2] KVM: arm64: ptdump: Shadow ptdump fixes

Hi,

This is v4 of fixing the sleep-in-atomic problem of the shadow ptdump. This version relaxes a few write_lock to read_lock, and collected tags. Please see the details below.

* Changes from v3 [1]:

- Take read_lock instead of write_lock when getting pgt metadata. (Vincent)

- Collected Tested-bys and Reviewed-by from Vincent and Itaru.

    (Thanks!)

Below is mostly the same content from the v3 cover letter:

The approach taken now is simply creating a file for each nested mmu.

The ptdump files are created alongside the nested mmus in kvm_vcpu_init_nested(), in a sleepable context, and removed when the VM is destroyed (kvm_destroy_vm_debugfs(), before the nested mmus are freed in kvm_destroy_nested()). This allows us to store the kvm_s2_mmu pointers in the ptdump code, after Marc's nested mmu lifecycle fixes [2].

For the shadow ptdump, for valid nested mmus the first line will show the nested context's VTTBR and VTCR values, and whether s2 is enabled or not. The ptdump then follows.

The first patch fixes mmu->pgt accesses after the VM MMU teardown in ptdump.c, the second patch switches from per nested context ptdumps to per nested mmu ptdumps.

Tested with CONFIG_PROVE_LOCKING, CONFIG_DEBUG_ATOMIC_SLEEP, and CONFIG_KASAN.

Series based on kvmarm/fixes.

Thanks!

[1]: https://lore.kernel.org/kvmarm/[email protected]/
[2]: https://lore.kernel.org/kvmarm/[email protected]/

Wei-Lin Chang (2):
KVM: arm64: ptdump: Check the page tables aren't freed when accessing
KVM: arm64: ptdump: Fix shadow ptdump sleep-in-atomic-context problem

 arch/arm64/include/asm/kvm_host.h |  4 --
 arch/arm64/include/asm/kvm_mmu.h  |  6 +--
 arch/arm64/kvm/nested.c           |  9 ++--
 arch/arm64/kvm/ptdump.c           | 75 ++++++++++++++++++++-----------
 4 files changed, 54 insertions(+), 40 deletions(-)
Signature · 1 line
2.43.0