Skip to content

KVM: x86/mmu: Fix TLB flushing bugs in TDP MMU

Sean Christopherson kvm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 7 repliesIn review
  2. v12 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Collect a review. [Ben]
- Disallowing yielding instead of feeding "flush" into the TDP MMU. [Ben]
- Move the yielding logic to a separate patch since it's not strictly a bug fix and it's standalone anyways (the flush feedback loop was not).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: x86/mmu: Ensure TLBs are flushed when yielding during GFN range zaparch/x86/kvm/mmu/tdp_mmu.c+12 -110 replies
2/3KVM: x86/mmu: Ensure TLBs are flushed for TDP MMU during NX zappingarch/x86/kvm/mmu/mmu.c+7 -41 reply
3/3KVM: x86/mmu: Don't allow TDP MMU to yield when recovering NX pagesarch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/tdp_mmu.c arch/x86/kvm/mmu/tdp_mmu.h+26 -66 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchBen Gardon
1/3R-b
2/3R-b
3/3

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 0/3] KVM: x86/mmu: Fix TLB flushing bugs in TDP MMU

Two bug fixes and a clean up involving the TDP MMU, found by inspection.

Patch 1 fixes a bug where KVM yields, e.g. due to lock contention, without performing a pending TLB flush that was required from a previous root.

Patch 2 fixes a much more egregious bug where it fails to handle TDP MMU flushes in NX huge page recovery.

Patch 3 explicitly disallows yielding in the TDP MMU to prevent a similar bug to patch 1 from sneaking in.

v2:
- Collect a review. [Ben]
- Disallowing yielding instead of feeding "flush" into the TDP MMU. [Ben]
- Move the yielding logic to a separate patch since it's not strictly a bug fix and it's standalone anyways (the flush feedback loop was not).

v1:
- https://lkml.kernel.org/r/[email protected]

Sean Christopherson (3):
KVM: x86/mmu: Ensure TLBs are flushed when yielding during GFN range
zap
KVM: x86/mmu: Ensure TLBs are flushed for TDP MMU during NX zapping
KVM: x86/mmu: Don't allow TDP MMU to yield when recovering NX pages

 arch/x86/kvm/mmu/mmu.c     |  9 +++++----
 arch/x86/kvm/mmu/tdp_mmu.c | 26 ++++++++++++++------------
 arch/x86/kvm/mmu/tdp_mmu.h | 23 ++++++++++++++++++++++-
 3 files changed, 41 insertions(+), 17 deletions(-)
Signature · 1 line
2.31.0.291.g576ba9dcdaf-goog