2023-09-14 19:56:50

by Paul Durrant

[permalink] [raw]
Subject: Re: [PATCH 5/8] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

On 14/09/2023 10:29, David Woodhouse wrote:
> On Thu, 2023-09-14 at 08:49 +0000, Paul Durrant wrote:
>>
>>  int kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, unsigned long len)
>>  {
>> -       return __kvm_gpc_refresh(gpc, gpc->gpa, len);
>> +       return __kvm_gpc_refresh(gpc, gpc->addr, len, gpc->addr_is_gpa);
>>  }
>>  EXPORT_SYMBOL_GPL(kvm_gpc_refresh);
>
> I think I have a slight preference for leaving kvm_gpc_refresh()
> working on a GPA unconditionally, thus calling __kvm_gpc_refresh() with
> the final argument set to true.
>
> Introduce another one-line wrapper kvm_gpc_refresh_hva() for the false
> case. And perhaps BUG_ON() calling the 'wrong' refresh function?

Hmm. That makes life harder for the code messing with the vcpu_info. I
would need to know which cache it was looking at, because it could be
the vcpu_info cache or shinfo cache, and if it's the shinfo cache it
would need to know how it was activated.

Paul