Hi Julien,

> -----Original Message-----
> From: Julien Grall <[email protected]>
> Subject: Re: [PATCH] xen/arm: Reduce redundant clear root pages when
> teardown p2m
> 
> Hi Henry,
> 
> >       PROGRESS(p2m):
> > +        /*
> > +         * We are about to free the intermediate page-tables, so clear the
> > +         * root to prevent any walk to use them.
> > +         */
> > +        p2m_clear_root_pages(&d->arch.p2m);
> 
> The commit message suggests this should only be called once. However,
> you will still end up to call p2m_clear_root_pages() multiple time if
> p2m_teardown() is preempted.

Thanks for confirming this, would adding another PROGRESS stage
such as PROGRESS(p2m_clean) before PROGRESS(p2m) seem ok to you?

> 
> >           ret = p2m_teardown(d, true);
> >           if ( ret )
> >               return ret;
> > diff --git a/xen/arch/arm/include/asm/p2m.h
> b/xen/arch/arm/include/asm/p2m.h
> > index 91df922e1c..bf5183e53a 100644
> > --- a/xen/arch/arm/include/asm/p2m.h
> > +++ b/xen/arch/arm/include/asm/p2m.h
> > @@ -281,6 +281,7 @@ int p2m_set_entry(struct p2m_domain *p2m,
> >
> >   bool p2m_resolve_translation_fault(struct domain *d, gfn_t gfn);
> >
> > +void p2m_clear_root_pages(struct p2m_domain *p2m);
> >   void p2m_invalidate_root(struct p2m_domain *p2m);
> >
> >   /*
> > diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> > index 948f199d84..0c942c5923 100644
> > --- a/xen/arch/arm/p2m.c
> > +++ b/xen/arch/arm/p2m.c
> > @@ -1314,6 +1314,18 @@ static void p2m_invalidate_table(struct
> p2m_domain *p2m, mfn_t mfn)
> >       p2m->need_flush = true;
> >   }
> >
> >       /*
> >        * The domain will not be scheduled anymore, so in theory we should
> >        * not need to flush the TLBs. Do it for safety purpose.
> 
> This flush needs to be moved in p2m_clear_root_pages().

Sure, will move this in v2.

Kind regards,
Henry

> 
> Cheers,
> 
> --
> Julien Grall

Reply via email to