]> xenbits.xensource.com Git - xen.git/commitdiff
xen/domain: Call arch_domain_create() as early as possible in domain_create()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 19 Mar 2018 16:50:46 +0000 (16:50 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 31 Aug 2018 11:06:53 +0000 (12:06 +0100)
This is in preparation to set up d->max_cpus and d->vcpu[] in domain_create(),
and allow later parts of domain construction to have access to the values.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/domain.c

index be51426e4986962ae96c4ad3b52248e40f7dcfde..81435321f903e6fa0b0e5fc2be38b1c1fb4fb176 100644 (file)
@@ -322,6 +322,22 @@ struct domain *domain_create(domid_t domid,
         else
             d->guest_type = guest_type_pv;
 
+        if ( !is_hardware_domain(d) )
+            d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
+        else
+            d->nr_pirqs = extra_hwdom_irqs ? nr_static_irqs + extra_hwdom_irqs
+                                           : arch_hwdom_irqs(domid);
+        d->nr_pirqs = min(d->nr_pirqs, nr_irqs);
+
+        radix_tree_init(&d->pirq_tree);
+    }
+
+    if ( (err = arch_domain_create(d, config)) != 0 )
+        goto fail;
+    init_status |= INIT_arch;
+
+    if ( !is_idle_domain(d) )
+    {
         watchdog_domain_init(d);
         init_status |= INIT_watchdog;
 
@@ -352,16 +368,6 @@ struct domain *domain_create(domid_t domid,
         d->controller_pause_count = 1;
         atomic_inc(&d->pause_count);
 
-        if ( !is_hardware_domain(d) )
-            d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
-        else
-            d->nr_pirqs = extra_hwdom_irqs ? nr_static_irqs + extra_hwdom_irqs
-                                           : arch_hwdom_irqs(domid);
-        if ( d->nr_pirqs > nr_irqs )
-            d->nr_pirqs = nr_irqs;
-
-        radix_tree_init(&d->pirq_tree);
-
         if ( (err = evtchn_init(d, config->max_evtchn_port)) != 0 )
             goto fail;
         init_status |= INIT_evtchn;
@@ -376,14 +382,7 @@ struct domain *domain_create(domid_t domid,
         d->pbuf = xzalloc_array(char, DOMAIN_PBUF_SIZE);
         if ( !d->pbuf )
             goto fail;
-    }
 
-    if ( (err = arch_domain_create(d, config)) != 0 )
-        goto fail;
-    init_status |= INIT_arch;
-
-    if ( !is_idle_domain(d) )
-    {
         if ( (err = sched_init_domain(d, 0)) != 0 )
             goto fail;