From: "Jan Beulich" Subject: [PATCH 1/4] x86: skip further initialization for idle domains Date: Wed, 28 Jan 2015 08:10:23 +0000 Message-ID: <54C8A77F020000780005A2AD@mail.emea.novell.com> References: <54C8A524020000780005A27E@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1227837F.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGNhj-0003Dl-3F for xen-devel@lists.xenproject.org; Wed, 28 Jan 2015 08:10:27 +0000 In-Reply-To: <54C8A524020000780005A27E@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: xen-devel Cc: Andrew Cooper , Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1227837F.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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; =20 - paging_vcpu_init(v); + if ( !is_idle_domain(d) ) + { + paging_vcpu_init(v); =20 - if ( (rc =3D vcpu_init_fpu(v)) !=3D 0 ) - return rc; + if ( (rc =3D vcpu_init_fpu(v)) !=3D 0 ) + return rc; =20 - vmce_init_vcpu(v); + vmce_init_vcpu(v); + } =20 if ( has_hvm_container_domain(d) ) { @@ -559,12 +562,12 @@ int arch_domain_create(struct domain *d, HYPERVISOR_COMPAT_VIRT_START(d) =3D is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u; =20 - if ( (rc =3D paging_domain_init(d, domcr_flags)) !=3D 0 ) - goto fail; - paging_initialised =3D 1; - if ( !is_idle_domain(d) ) { + if ( (rc =3D paging_domain_init(d, domcr_flags)) !=3D 0 ) + goto fail; + paging_initialised =3D 1; + d->arch.cpuids =3D xmalloc_array(cpuid_input_t, MAX_CPUID_INPUT); rc =3D -ENOMEM; if ( d->arch.cpuids =3D=3D 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 =3D 0; + int rc; =20 - /* Idle domain doesn't have FPU state allocated */ - if ( is_idle_vcpu(v) ) - goto done; - if ( (rc =3D xstate_alloc_save_area(v)) !=3D 0 ) return rc; =20 @@ -318,13 +314,9 @@ int vcpu_init_fpu(struct vcpu *v) { v->arch.fpu_ctxt =3D _xzalloc(sizeof(v->arch.xsave_area->fpu_sse),= 16); if ( !v->arch.fpu_ctxt ) - { rc =3D -ENOMEM; - goto done; - } } =20 -done: return rc; } =20 --=__Part1227837F.1__= Content-Type: text/plain; name="x86-idle-domain-init.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-idle-domain-init.patch" x86: skip further initialization for idle domains=0A=0AWhile in the end = not really found necessary, early versions of the=0Apatches to follow = pointed out that we needlessly set up paging for idle=0Adomains. Arranging = for that to be skipped made me notice that we can at=0Aonce skip vMCE = setup for them. Leverage to adjustment to further=0Are-arrange the way FPU = setup gets skipped.=0A=0ASigned-off-by: Jan Beulich =0A= =0A--- a/xen/arch/x86/domain.c=0A+++ b/xen/arch/x86/domain.c=0A@@ -427,12 = +427,15 @@ int vcpu_initialise(struct vcpu *v)=0A if ( rc )=0A = return rc;=0A =0A- paging_vcpu_init(v);=0A+ if ( !is_idle_domain(d) = )=0A+ {=0A+ paging_vcpu_init(v);=0A =0A- if ( (rc =3D = vcpu_init_fpu(v)) !=3D 0 )=0A- return rc;=0A+ if ( (rc =3D = vcpu_init_fpu(v)) !=3D 0 )=0A+ return rc;=0A =0A- vmce_init_v= cpu(v);=0A+ vmce_init_vcpu(v);=0A+ }=0A =0A if ( has_hvm_cont= ainer_domain(d) )=0A {=0A@@ -559,12 +562,12 @@ int arch_domain_create(s= truct domain *d,=0A HYPERVISOR_COMPAT_VIRT_START(d) =3D=0A = is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u;=0A =0A- if ( = (rc =3D paging_domain_init(d, domcr_flags)) !=3D 0 )=0A- goto = fail;=0A- paging_initialised =3D 1;=0A-=0A if ( !is_idle_domain(d) = )=0A {=0A+ if ( (rc =3D paging_domain_init(d, domcr_flags)) = !=3D 0 )=0A+ goto fail;=0A+ paging_initialised =3D = 1;=0A+=0A d->arch.cpuids =3D xmalloc_array(cpuid_input_t, = MAX_CPUID_INPUT);=0A rc =3D -ENOMEM;=0A if ( d->arch.cpuids= =3D=3D NULL )=0A--- a/xen/arch/x86/i387.c=0A+++ b/xen/arch/x86/i387.c=0A@@= -303,12 +303,8 @@ void save_fpu_enable(void)=0A /* Initialize FPU's = context save area */=0A int vcpu_init_fpu(struct vcpu *v)=0A {=0A- int = rc =3D 0;=0A+ int rc;=0A =0A- /* Idle domain doesn't have FPU = state allocated */=0A- if ( is_idle_vcpu(v) )=0A- goto = done;=0A-=0A if ( (rc =3D xstate_alloc_save_area(v)) !=3D 0 )=0A = return rc;=0A =0A@@ -318,13 +314,9 @@ int vcpu_init_fpu(struct vcpu = *v)=0A {=0A v->arch.fpu_ctxt =3D _xzalloc(sizeof(v->arch.xsave_= area->fpu_sse), 16);=0A if ( !v->arch.fpu_ctxt )=0A- {=0A = rc =3D -ENOMEM;=0A- goto done;=0A- }=0A = }=0A =0A-done:=0A return rc;=0A }=0A =0A --=__Part1227837F.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part1227837F.1__=--