lkml.org 
[lkml]   [2023]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v8 07/15] KVM: pfncache: include page offset in uhva and use it consistently
    From
    Date
    On Wed, 2023-11-22 at 16:54 +0800, Xu Yilun wrote:
    >
    > > @@ -259,13 +258,25 @@ static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa,
    > >                         ret = -EFAULT;
    > >                         goto out;
    > >                 }
    > > +
    > > +               hva_change = true;
    > > +       } else {
    > > +               /*
    > > +                * No need to do any re-mapping if the only thing that has
    > > +                * changed is the page offset. Just page align it to allow the
    > > +                * new offset to be added in.
    >
    > I don't understand how the uhva('s offset) could be changed when both gpa and
    > slot are not changed. Maybe I have no knowledge of xen, but in later
    > patch you said your uhva would never change...

    It doesn't change on a normal refresh with kvm_gpc_refresh(), which is
    just for revalidation after memslot changes or MMU invalidation.

    But it can change if the gpc is being reinitialized with a new address
    (perhaps because the guest has made another hypercall to set the
    address, etc.)

    That new address could happen to be in the *same* page as the previous
    one. In fact the xen_shinfo_test explicitly tests that case, IIRC.

    And kvm_gpc_activate() also happens to use __kvm_gpc_refresh()
    internally.
    [unhandled content-type:application/pkcs7-signature]
    \
     
     \ /
      Last update: 2023-11-22 10:13    [W:7.197 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site