[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/7] xen/domain: Drop DOMCRF_dummy



Hi Andrew,

On 03/09/2018 01:18 PM, Andrew Cooper wrote:
At the moment, there is a tight coupling between the domid and the use of
DOMCRF_dummy.  Instead of using DOMCRF_dummy, base the one relevent decision

NIT: s/relevent/relevant/

on domid alone.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Acked-by: Julien Grall <julien.grall@xxxxxxx>

Cheers,

---
CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
---
  xen/arch/arm/mm.c       |  6 +++---
  xen/arch/x86/mm.c       |  6 +++---
  xen/common/domain.c     |  3 ++-
  xen/include/xen/sched.h | 11 +++++++----
  4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 3c328e2..ce83f69 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -520,7 +520,7 @@ void __init arch_init_memory(void)
       * Any Xen-heap pages that we will allow to be mapped will have
       * their domain field set to dom_xen.
       */
-    dom_xen = domain_create(DOMID_XEN, DOMCRF_dummy, 0, NULL);
+    dom_xen = domain_create(DOMID_XEN, 0, 0, NULL);
      BUG_ON(IS_ERR(dom_xen));
/*
@@ -528,14 +528,14 @@ void __init arch_init_memory(void)
       * This domain owns I/O pages that are within the range of the page_info
       * array. Mappings occur at the priv of the caller.
       */
-    dom_io = domain_create(DOMID_IO, DOMCRF_dummy, 0, NULL);
+    dom_io = domain_create(DOMID_IO, 0, 0, NULL);
      BUG_ON(IS_ERR(dom_io));
/*
       * Initialise our COW domain.
       * This domain owns sharable pages.
       */
-    dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
+    dom_cow = domain_create(DOMID_COW, 0, 0, NULL);
      BUG_ON(IS_ERR(dom_cow));
  }
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 9b55944..c275d4b 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -271,7 +271,7 @@ void __init arch_init_memory(void)
       * Hidden PCI devices will also be associated with this domain
       * (but be [partly] controlled by Dom0 nevertheless).
       */
-    dom_xen = domain_create(DOMID_XEN, DOMCRF_dummy, 0, NULL);
+    dom_xen = domain_create(DOMID_XEN, 0, 0, NULL);
      BUG_ON(IS_ERR(dom_xen));
      INIT_LIST_HEAD(&dom_xen->arch.pdev_list);
@@ -280,14 +280,14 @@ void __init arch_init_memory(void)
       * This domain owns I/O pages that are within the range of the page_info
       * array. Mappings occur at the priv of the caller.
       */
-    dom_io = domain_create(DOMID_IO, DOMCRF_dummy, 0, NULL);
+    dom_io = domain_create(DOMID_IO, 0, 0, NULL);
      BUG_ON(IS_ERR(dom_io));
/*
       * Initialise our COW domain.
       * This domain owns sharable pages.
       */
-    dom_cow = domain_create(DOMID_COW, DOMCRF_dummy, 0, NULL);
+    dom_cow = domain_create(DOMID_COW, 0, 0, NULL);
      BUG_ON(IS_ERR(dom_cow));
/*
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 219a3e3..cd39a58 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -312,7 +312,8 @@ struct domain *domain_create(domid_t domid, unsigned int 
domcr_flags,
      rangeset_domain_initialise(d);
      init_status |= INIT_rangeset;
- if ( domcr_flags & DOMCRF_dummy )
+    /* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */
+    if ( is_system_domain(d) && !is_idle_domain(d) )
          return d;
if ( !is_idle_domain(d) )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 39f9386..aa5729b 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -491,9 +491,15 @@ extern spinlock_t domlist_update_lock;
  extern rcu_read_lock_t domlist_read_lock;
extern struct vcpu *idle_vcpu[NR_CPUS];
+
  #define is_idle_domain(d) ((d)->domain_id == DOMID_IDLE)
  #define is_idle_vcpu(v)   (is_idle_domain((v)->domain))
+static inline bool is_system_domain(const struct domain *d)
+{
+    return d->domain_id >= DOMID_FIRST_RESERVED;
+}
+
  #define DOMAIN_DESTROYED (1u << 31) /* assumes atomic_t is >= 32 bits */
  #define put_domain(_d) \
    if ( atomic_dec_and_test(&(_d)->refcnt) ) domain_destroy(_d)
@@ -531,7 +537,7 @@ void domain_update_node_affinity(struct domain *d);
/*
   * Create a domain: the configuration is only necessary for real domain
- * (i.e !DOMCRF_dummy, excluded idle domain).
+ * (domid < DOMID_FIRST_RESERVED).
   */
  struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
                               uint32_t ssidref,
@@ -546,9 +552,6 @@ struct domain *domain_create(domid_t domid, unsigned int 
domcr_flags,
                          by tboot */
  #define _DOMCRF_s3_integrity  2
  #define DOMCRF_s3_integrity   (1U<<_DOMCRF_s3_integrity)
- /* DOMCRF_dummy: Create a dummy domain (not scheduled; not on domain list) */
-#define _DOMCRF_dummy         3
-#define DOMCRF_dummy          (1U<<_DOMCRF_dummy)
   /* DOMCRF_oos_off: dont use out-of-sync optimization for shadow page tables 
*/
  #define _DOMCRF_oos_off         4
  #define DOMCRF_oos_off          (1U<<_DOMCRF_oos_off)


--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.