]> xenbits.xensource.com Git - xen.git/commitdiff
x86: skip further initialization for idle domains
authorJan Beulich <jbeulich@suse.com>
Wed, 28 Jan 2015 15:38:20 +0000 (16:38 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 28 Jan 2015 15:38:20 +0000 (16:38 +0100)
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 <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/domain.c
xen/arch/x86/i387.c

index 50b361b47d5e25c07576eb1baabe351e5d1796d1..cfe7945ba597d733f4b78273323f9759552185fb 100644 (file)
@@ -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, unsigned int domcr_flags)
     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 )
index a372e0b503ba2ae51fe8111580f9f8ea71e88080..14f2a79e7b333d9d53918bfe2c7df8ac123f75e8 100644 (file)
@@ -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;
 }