Re: [PATCH v2] KVM: MMU: Make the definition of 'INVALID_GPA' common.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 14, 2022, Yu Zhang wrote:
> On Wed, Dec 14, 2022 at 11:10:54AM +0000, David Woodhouse wrote:
> > On Tue, 2022-12-13 at 17:04 +0800, Yu Zhang wrote:
> > > --- a/arch/x86/kvm/xen.c
> > > +++ b/arch/x86/kvm/xen.c
> > > @@ -41,7 +41,7 @@ static int kvm_xen_shared_info_init(struct kvm *kvm, gfn_t gfn)
> > >         int ret = 0;
> > >         int idx = srcu_read_lock(&kvm->srcu);
> > >  
> > > -       if (gfn == GPA_INVALID) {
> > > +       if (gfn == INVALID_GPA) {
> > >                 kvm_gpc_deactivate(gpc);
> > >                 goto out;
> > >         }
> > > @@ -659,7 +659,7 @@ int kvm_xen_hvm_get_attr(struct kvm *kvm, struct kvm_xen_hvm_attr *data)
> > >                 if (kvm->arch.xen.shinfo_cache.active)
> > >                         data->u.shared_info.gfn = gpa_to_gfn(kvm->arch.xen.shinfo_cache.gpa);
> > >                 else
> > > -                       data->u.shared_info.gfn = GPA_INVALID;
> > > +                       data->u.shared_info.gfn = INVALID_GPA;
> > >                 r = 0;
> > >                 break;
> > 
> > Strictly, those are INVALID_GFN not INVALID_GPA but I have so far
> > managed to pretend not to notice...
> > 
> > If we're bikeshedding the naming then I might have suggested
> > INVALID_PAGE but that already exists as an hpa_t type.
> 
> Thanks, David. INVALID_GFN sounds more reasonable for me.
> 
> But I am not sure if adding INVALID_GFN is necessary. Because for now
> only kvm_xen_shared_info_init() and kvm_xen_hvm_get_attr() use INVALID_GPA
> as a GFN. 
> 
> Any suggestion? Thanks!

It's not strictly necessary, but it's an easy change and I can't think of any
reason not to add INVALID_GFN.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux