x86: skip further initialization for idle domains 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; - 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; }