Skip to content

KVM: x86/mmu: Add macro for hugepage GFN mask

Sean Christopherson kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: x86/mmu: Add helper macro for computing hugepage GFN maskarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/paging_tmpl.h +1 more+5 -42 replies
2/3KVM: x86/mmu: Open code GFN "rounding" in TDP MMUarch/x86/kvm/mmu/tdp_iter.c+3 -81 reply
3/3KVM: x86/mmu: Use hugepage GFN mask to compute GFN offset maskarch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmutrace.h arch/x86/kvm/mmu/tdp_mmu.c +1 more+6 -62 replies

Reviews trailers per patch

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

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

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/3] KVM: x86/mmu: Add macro for hugepage GFN mask

Add a macro, which is probably long overdue, to replace open coded variants of "~(KVM_PAGES_PER_HPAGE(level) - 1)". The straw that broke the camel's back is the TDP MMU's round_gfn_for_level(), which goes straight for the optimized approach of using NEG instead of SUB+NOT (gcc uses NEG for both). The use of '-(...)' made me do a double take (more like a quadrupal take) when reading the TDP MMU code as my eyes/brain have been heavily trained to look for the more common '~(... - 1)'.

Sean Christopherson (3):
KVM: x86/mmu: Add helper macro for computing hugepage GFN mask
KVM: x86/mmu: Open code GFN "rounding" in TDP MMU
KVM: x86/mmu: Use hugepage GFN mask to compute GFN offset mask

 arch/x86/include/asm/kvm_host.h |  1 +
 arch/x86/kvm/mmu/mmu.c          |  4 ++--
 arch/x86/kvm/mmu/mmutrace.h     |  2 +-
 arch/x86/kvm/mmu/paging_tmpl.h  |  4 ++--
 arch/x86/kvm/mmu/tdp_iter.c     | 11 +++--------
 arch/x86/kvm/mmu/tdp_mmu.c      |  2 +-
 arch/x86/kvm/x86.c              |  6 +++---
 7 files changed, 13 insertions(+), 17 deletions(-)
Signature · 1 line
2.28.0