Re: [PATCH 2/3] kvm: mmu: Separate generating and setting mmio ptes

From: Paolo Bonzini
Date: Wed Feb 05 2020 - 09:37:41 EST


On 05/02/20 14:37, Vitaly Kuznetsov wrote:
>> +static void mark_mmio_spte(struct kvm_vcpu *vcpu, u64 *sptep, u64 gfn,
>> + unsigned int access)
>> +{
>> + u64 mask = make_mmio_spte(vcpu, gfn, access);
>> + unsigned int gen = get_mmio_spte_generation(mask);
>> +
>> + access = mask & ACC_ALL;
>> +
>> trace_mark_mmio_spte(sptep, gfn, access, gen);
> 'access' and 'gen' are only being used for tracing, would it rather make
> sense to rename&move it to the newly introduced make_mmio_spte()? Or do
> we actually need tracing for both?

You would have the same issue with sptep.

> Also, I dislike re-purposing function parameters.

Yes, "trace_mark_mmio_spte(sptep, gfn, mask & ACC_ALL, gen);" is
slightly better.

Paolo