Re: [PATCH v13 04/21] KVM: pfncache: add a mark-dirty helper

Paul Durrant
2024-02-20T08:59:44Z

On 19/02/2024 21:42, Sean Christopherson wrote:
> On Thu, Feb 15, 2024, Paul Durrant wrote:
>> +/**
>> + * kvm_gpc_mark_dirty_in_slot - mark a cached guest page as dirty.
>> + *
>> + * @gpc: struct gfn_to_pfn_cache object.
>
> Meh, just omit the kerneldoc comment.
>
>> + */
>> +static inline void kvm_gpc_mark_dirty_in_slot(struct gfn_to_pfn_cache *gpc)
>> +{
>> + lockdep_assert_held(&gpc->lock);
>> + if (gpc->memslot)
>> + mark_page_dirty_in_slot(gpc->kvm, gpc->memslot,
>> + gpc->gpa >> PAGE_SHIFT);
>
> It's kinda silly, but I think it's worth landing this below gpa_to_gfn() so that
> there's no need to open code the shift.
>
> And I have a (very) slight preference for an early return.
>
> static inline void kvm_gpc_mark_dirty_in_slot(struct gfn_to_pfn_cache *gpc)
> {
> lockdep_assert_held(&gpc->lock);
>
> if (!gpc->memslot)
> return;
>
> mark_page_dirty_in_slot(gpc->kvm, gpc->memslot, gpa_to_gfn(gpc->gpa));
> }
>

Ok. Will change.

>> +}
>> +
>> void kvm_sigset_activate(struct kvm_vcpu *vcpu);
>> void kvm_sigset_deactivate(struct kvm_vcpu *vcpu);
>>
>> --
>> 2.39.2
>>