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

Re: [Xen-devel] [PATCH RFC 39/55] x86: switch root_pgt to mfn_t and use new APIs



On Tue, Mar 19, 2019 at 04:45:24PM +0000, Nuernberger, Stefan wrote:
> On Thu, 2019-02-07 at 16:44 +0000, Wei Liu wrote:
> > This then requires moving declaration of root page table mfn into
> > mm.h
> > and modify setup_cpu_root_pgt to have a single exit path.
> > 
> > We also need to force map_domain_page to use direct map when
> > switching
> > per-domain mappings. This is contrary to our end goal of removing
> > direct map, but this will be removed once we make map_domain_page
> > context-switch safe in another (large) patch series.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> > ---
> >  xen/arch/x86/domain.c           | 15 ++++++++++++---
> >  xen/arch/x86/domain_page.c      |  2 +-
> >  xen/arch/x86/mm.c               |  2 +-
> >  xen/arch/x86/pv/domain.c        |  2 +-
> >  xen/arch/x86/smpboot.c          | 40 +++++++++++++++++++++++++++--
> > -----------
> >  xen/include/asm-x86/mm.h        |  2 ++
> >  xen/include/asm-x86/processor.h |  1 -
> >  7 files changed, 44 insertions(+), 20 deletions(-)
> > 
> > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> > index 32dc4253ff..603495e55a 100644
> > --- a/xen/arch/x86/domain.c
> > +++ b/xen/arch/x86/domain.c
> > @@ -68,6 +68,7 @@
> >  #include <asm/pv/domain.h>
> >  #include <asm/pv/mm.h>
> >  #include <asm/spec_ctrl.h>
> > +#include <asm/setup.h>
> >  
> >  DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
> >  
> > @@ -1589,12 +1590,20 @@ void paravirt_ctxt_switch_from(struct vcpu
> > *v)
> >  
> >  void paravirt_ctxt_switch_to(struct vcpu *v)
> >  {
> > -    root_pgentry_t *root_pgt = this_cpu(root_pgt);
> > +    mfn_t rpt_mfn = this_cpu(root_pgt_mfn);
> >  
> > -    if ( root_pgt )
> > -        root_pgt[root_table_offset(PERDOMAIN_VIRT_START)] =
> > +    if ( !mfn_eq(rpt_mfn, INVALID_MFN) )
> > +    {
> > +        root_pgentry_t *rpt;
> > +
> > +        mapcache_override_current(INVALID_VCPU);
> 
> Can you elaborate why this is required? A comment might help. I assume
> this forces the root pt to be mapped in idle domain context instead of
> current vcpu?
> 


Sure. Frankly this change is not something I like.


  /*
   * XXX We're manipulating live page tables here. map_domain_page
   * relies on this exact snippet to work. For now, force
   * map_domain_page to use direct map. This hack can be removed once we
   * have per-cpu map_domain_page implementation.
   */

If we would rather not have this for now, we can apply this series up to
the patch to switch from xenheap to domheap.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.