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

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



On Tue, Oct 01, 2019 at 02:54:19PM +0100, Hongyan Xia wrote:
> On 30/09/2019 11:33, Hongyan Xia wrote:
> > From: Wei Liu <wei.liu2@xxxxxxxxxx>
> > 
> > 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 |  2 +-
> >   7 files changed, 45 insertions(+), 20 deletions(-)
> > 
> > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> > index dbdf6b1bc2..e9bf47efce 100644
> > --- a/xen/arch/x86/domain.c
> > +++ b/xen/arch/x86/domain.c
> > @@ -69,6 +69,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);
> > @@ -1580,12 +1581,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);
> > +        rpt = map_xen_pagetable_new(rpt_mfn);
> > +        rpt[root_table_offset(PERDOMAIN_VIRT_START)] =
> >               l4e_from_page(v->domain->arch.perdomain_l3_pg,
> >                             __PAGE_HYPERVISOR_RW);
> > +        UNMAP_XEN_PAGETABLE_NEW(rpt);
> > +        mapcache_override_current(NULL);
> > +    }
> >       if ( unlikely(v->arch.dr7 & DR7_ACTIVE_MASK) )
> >           activate_debugregs(v);
> 
> I am having second thoughts on whether I should include this patch for now.
> Obviously the per-domain mapcache in its current form cannot be used here
> during the context switch. However, I also don't want to use PMAP because it
> is just a bootstrapping mechanism and may result in heavy lock contention
> here.
> 
> I am inclined to drop it for now and include this after we have a
> context-switch safe mapping mechanism, as the commit message suggests.
> 

Dropping this patch is of course fine. Then you need to consider how to
make the rest of the series remain applicable to staging.

I guess the plan in the short term is too keep a global mapping for each
root page table, right?

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®.