All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH for-next 4/8] x86/domain: push some code down to hvm_domain_initialise
Date: Mon, 24 Apr 2017 15:55:29 +0100	[thread overview]
Message-ID: <20170424145528.exvcuvgw6ga6nxq6@citrix.com> (raw)
In-Reply-To: <58FDEB2602000078001537AD@prv-mh.provo.novell.com>

On Mon, Apr 24, 2017 at 04:10:14AM -0600, Jan Beulich wrote:
> >>> On 10.04.17 at 15:27, <wei.liu2@citrix.com> wrote:
> > We want to have a single entry point to initialise hvm guest.  The
> > timing to set hap bit and create per domain mapping is deferred, but
> > that's not a problem.
> > 
> > No functional change.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> >  xen/arch/x86/domain.c         | 11 ++---------
> >  xen/arch/x86/hvm/hvm.c        | 25 +++++++++++++++++--------
> >  xen/include/asm-x86/hvm/hvm.h |  2 +-
> >  3 files changed, 20 insertions(+), 18 deletions(-)
> > 
> > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> > index ddebff6187..af060d8239 100644
> > --- a/xen/arch/x86/domain.c
> > +++ b/xen/arch/x86/domain.c
> > @@ -587,14 +587,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
> >          d->arch.emulation_flags = emflags;
> >      }
> >  
> > -    if ( is_hvm_domain(d) )
> > -    {
> > -        d->arch.hvm_domain.hap_enabled =
> > -            hvm_funcs.hap_supported && (domcr_flags & DOMCRF_hap);
> > -
> > -        rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
> 
> I'm not really certain it is a good idea to move this last one, as I can't
> immediately spot uses of it from the hvm/ subtree.
> 

I think the sole purpose of this call is to create perdomain_l3_pg (when
nr is 0), which is then referenced in monitor table creation. Moving
this doesn't seem to cause problem.

> > -    }
> > -    else if ( is_idle_domain(d) )
> > +    if ( is_idle_domain(d) )
> >          rc = 0;
> >      else
> 
> This now needs to be "else if ( !is_hvm_domain(d) )" afaict.
> 

I see what you mean. 

> > @@ -615,10 +615,17 @@ int hvm_domain_initialise(struct domain *d)
> >  
> >      hvm_init_cacheattr_region_list(d);
> >  
> > -    rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
> > +    d->arch.hvm_domain.hap_enabled =
> > +        hvm_funcs.hap_supported && (domcr_flags & DOMCRF_hap);
> > +
> > +    rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
> >      if ( rc != 0 )
> >          goto fail0;
> >  
> > +    rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
> > +    if ( rc != 0 )
> > +        goto fail1;
> 
> Is the order of these required to be that way? The various failN
> labels would seem to not require re-numbering if you swapped
> the last two actions.
> 

The mapping needs to be created before updating paging mode. I don't
think the order is important in this function.

Wei.

> Jan
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-04-24 14:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 13:27 [PATCH for-next 0/8] Refactor x86/domain.c Wei Liu
2017-04-10 13:27 ` [PATCH for-next 1/8] xen.h: fix comment for vcpu_guest_context Wei Liu
2017-04-24  9:51   ` Jan Beulich
2017-04-24 10:24     ` Julien Grall
2017-04-24 10:42     ` Wei Liu
2017-04-24 12:29       ` Jan Beulich
2017-04-24 12:55         ` Wei Liu
2017-04-10 13:27 ` [PATCH for-next 2/8] x86/domain: factor out pv_vcpu_initialise Wei Liu
2017-04-24  9:57   ` Jan Beulich
2017-04-24 11:16     ` Wei Liu
2017-04-10 13:27 ` [PATCH for-next 3/8] x86/domain: factor out pv_vcpu_destroy Wei Liu
2017-04-24  9:59   ` Jan Beulich
2017-04-10 13:27 ` [PATCH for-next 4/8] x86/domain: push some code down to hvm_domain_initialise Wei Liu
2017-04-10 15:19   ` Andrew Cooper
2017-04-25 12:15     ` Wei Liu
2017-04-24 10:10   ` Jan Beulich
2017-04-24 14:55     ` Wei Liu [this message]
2017-04-10 13:27 ` [PATCH for-next 5/8] x86/domain: factor out pv_domain_destroy Wei Liu
2017-04-10 15:04   ` Andrew Cooper
2017-04-10 15:12     ` Wei Liu
2017-04-10 15:16       ` Andrew Cooper
2017-04-10 15:22         ` Wei Liu
2017-04-10 15:27           ` Andrew Cooper
2017-04-24 10:11   ` Jan Beulich
2017-04-10 13:27 ` [PATCH for-next 6/8] x86/domain: factor out pv_domain_initialise Wei Liu
2017-04-24 10:20   ` Jan Beulich
2017-04-25 13:37     ` Wei Liu
2017-04-10 13:27 ` [PATCH for-next 7/8] x86/domain: move PV specific code to pv/domain.c Wei Liu
2017-04-24 12:39   ` Jan Beulich
2017-04-24 14:24     ` Wei Liu
2017-04-24 15:57       ` Jan Beulich
2017-04-10 13:27 ` [PATCH for-next 8/8] x86/domain: move HVM specific code to hvm/domain.c Wei Liu
2017-04-24 12:41   ` Jan Beulich
2017-04-24 13:12     ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170424145528.exvcuvgw6ga6nxq6@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.