Re: [PATCH] KVM: x86: Use the correct size of struct kvm_vcpu_pv_apf_data and fix the documentation

From: Sean Christopherson
Date: Wed Oct 18 2023 - 11:46:27 EST


On Wed, Oct 18, 2023, Xiaoyao Li wrote:
> On 10/18/2023 1:28 AM, Sean Christopherson wrote:
> > On Fri, Oct 13, 2023, Xiaoyao Li wrote:
> > > Fix the kvm_gfn_to_hva_cache_init() to use the correct size though KVM
> > > only touches fist 8 bytes.
> >
> > This isn't a fix. There's actually meaningful value in precisely initializing the
> > cache as it guards against KVM writing into the padding, e.g. this WARN would fire:
> >
> > if (WARN_ON_ONCE(len + offset > ghc->len))
> > return -EINVAL;
> >
> > So it's a bit odd, but I would prefer to keep the current behavior of mapping only
> > the first 8 bytes.
> >
> > Here's what I'm thinking to clean up the enabled field (compile tested only,
> > haven't touched the docs other than the obvious removal):
>
> It looks better.
>
> Will you send out a formal patch yourself? or leave it to me?

Your call, I don't have a preference. Just let me know which option you choose.