Re: [PATCH v2 1/4] KVM: x86/mmu: Add optimized helper to retrieve an SPTE's index

From: David Matlack
Date: Fri Jun 24 2022 - 19:41:45 EST


On Fri, Jun 24, 2022 at 09:30:36PM +0000, Sean Christopherson wrote:
> Add spte_index() to dedup all the code that calculates a SPTE's index
> into its parent's page table and/or spt array. Opportunistically tweak
> the calculation to avoid pointer arithmetic, which is subtle (subtract in
> 8-byte chunks) and less performant (requires the compiler to generate the
> subtraction).
>
> Suggested-by: David Matlack <dmatlack@xxxxxxxxxx>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

Thanks for the cleanup. I did a git-grep to look for any other users to
convert to spte_index() and didn't find any.

Reviewed-by: David Matlack <dmatlack@xxxxxxxxxx>