Re: [PATCH v2 01/15] KVM: Add member to struct kvm_gfn_range for target alias

From: Edgecombe, Rick P
Date: Thu Jun 06 2024 - 12:27:33 EST


On Thu, 2024-06-06 at 17:55 +0200, Paolo Bonzini wrote:
> On Thu, May 30, 2024 at 11:07 PM Rick Edgecombe
> <rick.p.edgecombe@xxxxxxxxx> wrote:
> > +       /* Unmmap the old attribute page. */
>
> Unmap

Oops, thanks.

>
> > +       if (range->arg.attributes & KVM_MEMORY_ATTRIBUTE_PRIVATE)
> > +               range->process = KVM_PROCESS_SHARED;
> > +       else
> > +               range->process = KVM_PROCESS_PRIVATE;
> > +
> >          return kvm_unmap_gfn_range(kvm, range);
> >   }
> >
> > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> > index c3c922bf077f..f92c8b605b03 100644
> > --- a/include/linux/kvm_host.h
> > +++ b/include/linux/kvm_host.h
> > @@ -260,11 +260,19 @@ union kvm_mmu_notifier_arg {
> >          unsigned long attributes;
> >   };
> >
> > +enum kvm_process {
> > +       BUGGY_KVM_INVALIDATION          = 0,
> > +       KVM_PROCESS_SHARED              = BIT(0),
> > +       KVM_PROCESS_PRIVATE             = BIT(1),
> > +       KVM_PROCESS_PRIVATE_AND_SHARED  = KVM_PROCESS_SHARED |
> > KVM_PROCESS_PRIVATE,
> > +};
>
> Only KVM_PROCESS_SHARED and KVM_PROCESS_PRIVATE are needed.

I guess you mean we can just use (KVM_PROCESS_SHARED |
KVM_PROCESS_PRIVATE). Sure.

>
> > +       /*
> > +        * If/when KVM supports more attributes beyond private .vs shared,
> > this
> > +        * _could_ set exclude_{private,shared} appropriately if the entire
> > target
>
> this could mask away KVM_PROCESS_{SHARED,PRIVATE} if the entire target...

Oops, thanks.