Re: [RFC PATCH v3 09/11] KVM: Add new members to struct kvm_gfn_range to operate on

From: Yu Zhao
Date: Sat Jul 15 2023 - 00:31:24 EST


On Thu, Jul 13, 2023 at 4:10 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> +Yu
>
> On Wed, Jun 28, 2023, isaku.yamahata@xxxxxxxxx wrote:
> > void kvm_mmu_init_memslot_memory_attributes(struct kvm *kvm,
> > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> > index 1a47cedae8a1..5ca0c8ee4292 100644
> > --- a/include/linux/kvm_host.h
> > +++ b/include/linux/kvm_host.h
> > @@ -260,7 +260,13 @@ struct kvm_gfn_range {
> > struct kvm_memory_slot *slot;
> > gfn_t start;
> > gfn_t end;
> > - pte_t pte;
> > + union {
> > + unsigned long attributes;
> > + pte_t pte;
> > + unsigned long callback_arg; /* needs a better name */
> > + };
>
> Making the union needs to be done in a separate patch. And coming back to this
> with fresh eyes, I think it makes sense to give the union a name. I think an
> anonymous union is actually worse in the long run, and there aren't _that_ many
> instances to update. E.g. that way a single build-time assertion can capture
> all uses, and it makes it more obvious that the usage is poking into a union.
>
> I'll post a patch separately so that it can be picked up for the MGLRU series
> (and maybe even merged ahead of both).

Thanks a lot, Sean. And sorry for having not addressed your comments
on v2 -- I'm wrapping up a few other projects and will be focusing on
addressing all pending comments in a couple of weeks.