From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 1/4] x86: skip further initialization for idle domains Date: Wed, 28 Jan 2015 11:00:09 +0000 Message-ID: <54C8C139.8080306@citrix.com> References: <54C8A524020000780005A27E@mail.emea.novell.com> <54C8A77F020000780005A2AD@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGQM9-00016u-2q for xen-devel@lists.xenproject.org; Wed, 28 Jan 2015 11:00:21 +0000 In-Reply-To: <54C8A77F020000780005A2AD@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: Tim Deegan , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 28/01/15 08:10, Jan Beulich wrote: > While in the end not really found necessary, early versions of the > patches to follow pointed out that we needlessly set up paging for idle > domains. Arranging for that to be skipped made me notice that we can at > once skip vMCE setup for them. Leverage to adjustment to further > re-arrange the way FPU setup gets skipped. > > Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper > > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -427,12 +427,15 @@ int vcpu_initialise(struct vcpu *v) > if ( rc ) > return rc; > > - paging_vcpu_init(v); > + if ( !is_idle_domain(d) ) > + { > + paging_vcpu_init(v); > > - if ( (rc = vcpu_init_fpu(v)) != 0 ) > - return rc; > + if ( (rc = vcpu_init_fpu(v)) != 0 ) > + return rc; > > - vmce_init_vcpu(v); > + vmce_init_vcpu(v); > + } > > if ( has_hvm_container_domain(d) ) > { > @@ -559,12 +562,12 @@ int arch_domain_create(struct domain *d, > HYPERVISOR_COMPAT_VIRT_START(d) = > is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u; > > - if ( (rc = paging_domain_init(d, domcr_flags)) != 0 ) > - goto fail; > - paging_initialised = 1; > - > if ( !is_idle_domain(d) ) > { > + if ( (rc = paging_domain_init(d, domcr_flags)) != 0 ) > + goto fail; > + paging_initialised = 1; > + > d->arch.cpuids = xmalloc_array(cpuid_input_t, MAX_CPUID_INPUT); > rc = -ENOMEM; > if ( d->arch.cpuids == NULL ) > --- a/xen/arch/x86/i387.c > +++ b/xen/arch/x86/i387.c > @@ -303,12 +303,8 @@ void save_fpu_enable(void) > /* Initialize FPU's context save area */ > int vcpu_init_fpu(struct vcpu *v) > { > - int rc = 0; > + int rc; > > - /* Idle domain doesn't have FPU state allocated */ > - if ( is_idle_vcpu(v) ) > - goto done; > - > if ( (rc = xstate_alloc_save_area(v)) != 0 ) > return rc; > > @@ -318,13 +314,9 @@ int vcpu_init_fpu(struct vcpu *v) > { > v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse), 16); > if ( !v->arch.fpu_ctxt ) > - { > rc = -ENOMEM; > - goto done; > - } > } > > -done: > return rc; > } > > > >