]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
xen/domain: Introduce arch_init_idle_domain()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 18 Jul 2024 19:54:05 +0000 (20:54 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 Jul 2024 10:14:50 +0000 (11:14 +0100)
The idle domain causes a large amount of complexity in domain_create() because
of x86's need to initialise d->arch.ctxt_switch in arch_domain_create().

In order to address this, introduce an optional hook to perform extra
initialisation of the idle domain.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/common/domain.c
xen/include/xen/sched.h

index 7b47696dd3d8ac3ee6045e694ab000c9c1b7f32b..f1d54845ec5eafbf9404b1b85ff07b4da720f6dd 100644 (file)
@@ -686,6 +686,9 @@ struct domain *domain_create(domid_t domid,
 
     rangeset_domain_initialise(d);
 
+    if ( is_idle_domain(d) )
+        arch_init_idle_domain(d);
+
     /* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */
     if ( is_system_domain(d) && !is_idle_domain(d) )
         return d;
index 2dcd1d1a4f8a2c33a79ad741a9039e4f09906009..90666576c2f8e37507eda614b48f406427cdcf83 100644 (file)
@@ -728,6 +728,11 @@ struct domain *domain_create(domid_t domid,
                              struct xen_domctl_createdomain *config,
                              unsigned int flags);
 
+#ifndef arch_init_idle_domain
+/* Optional, if there's any construction necessary for DOMID_IDLE */
+static inline void arch_init_idle_domain(struct domain *d) {}
+#endif
+
 /*
  * rcu_lock_domain_by_id() is more efficient than get_domain_by_id().
  * This is the preferred function if the returned domain reference