[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201027214300.1342-1-sean.j.christopherson@intel.com>
Date: Tue, 27 Oct 2020 14:42:57 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Ben Gardon <bgardon@...gle.com>
Subject: [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(-)
--
2.28.0
Powered by blists - more mailing lists