Re: [PATCH v3 31/31] KVM: MMU: make spte an in-out argument in make_spte

From: Paolo Bonzini
Date: Wed Sep 29 2021 - 07:15:02 EST


On 29/09/21 01:20, David Matlack wrote:
bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
struct kvm_memory_slot *slot,
unsigned int pte_access, gfn_t gfn, kvm_pfn_t pfn,
- u64 old_spte, bool speculative, bool can_unsync,
- bool host_writable, u64 *new_spte)
+ bool speculative, bool can_unsync,
+ bool host_writable, u64 *sptep)
I'd prefer a different name since `sptep` has specific meaning
throughout the mmu code. (It's the address of the spte in the page
table.)

Case in point, I was going to suggest we can get rid of struct
kvm_mmu_page since it can be derived from the sptep and then realized
how wrong that was:).

Instead of receiving the new spte as a parameter what do you think about
changing make_spte to return the new spte? I think that would make the
code more readable (but won't reduce the number of arguments because
you'd have to add wrprot).


You have a point. I've dropped this patch for now.

Paolo