From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Tim Deegan <tim@xen.org>, Julien Grall <julien.grall@arm.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 1/7] xen/domain: Drop DOMCRF_dummy
Date: Fri, 9 Mar 2018 13:18:36 +0000 [thread overview]
Message-ID: <1520601522-2886-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1520601522-2886-1-git-send-email-andrew.cooper3@citrix.com>
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
on domid alone.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Tim Deegan <tim@xen.org>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Julien Grall <julien.grall@arm.com>
---
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)
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-03-09 13:18 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 13:18 [PATCH 0/7] xen: More assorted improvements to domain creation Andrew Cooper
2018-03-09 13:18 ` Andrew Cooper [this message]
2018-03-09 14:12 ` [PATCH 1/7] xen/domain: Drop DOMCRF_dummy Wei Liu
2018-03-09 16:46 ` Jan Beulich
2018-03-11 20:01 ` Julien Grall
2018-03-09 13:18 ` [PATCH 2/7] xen/domain: Drop all DOMCRF_* constants Andrew Cooper
2018-03-09 14:12 ` Wei Liu
2018-03-09 14:14 ` Andrew Cooper
2018-03-09 14:16 ` Wei Liu
2018-03-09 16:48 ` Jan Beulich
2018-03-11 20:02 ` Julien Grall
2018-03-09 13:18 ` [PATCH 3/7] RFC arm/domain: Reject invalid combinations of domain creation flags Andrew Cooper
2018-03-11 19:59 ` Julien Grall
2018-03-12 16:32 ` Wei Liu
2018-03-13 14:42 ` Julien Grall
2018-03-15 20:02 ` Andrew Cooper
2018-03-09 13:18 ` [PATCH 4/7] x86/domain: Remove unused parameters from {hvm, pv}_domain_initialise() Andrew Cooper
2018-03-09 14:13 ` Wei Liu
2018-03-09 16:49 ` Jan Beulich
2018-03-13 12:05 ` Roger Pau Monné
2018-03-15 20:09 ` Andrew Cooper
2018-03-16 10:58 ` Jan Beulich
2018-03-09 13:18 ` [PATCH 5/7] x86/domain: Optimise the order of actions in arch_domain_create() Andrew Cooper
2018-03-09 14:43 ` Wei Liu
2018-03-09 16:54 ` Jan Beulich
2018-03-15 20:15 ` Andrew Cooper
2018-03-16 7:40 ` Jan Beulich
2018-03-13 12:18 ` Roger Pau Monné
2018-03-09 13:18 ` [PATCH 6/7] xen/domain: Pass the full domctl_createdomain struct to create_domain() Andrew Cooper
2018-03-09 14:50 ` Wei Liu
2018-03-09 17:00 ` Jan Beulich
2018-03-09 17:06 ` Andrew Cooper
2018-03-12 12:57 ` Jan Beulich
2018-03-11 20:08 ` Julien Grall
2018-03-09 13:18 ` [PATCH 7/7] xen/mm: Clean up share_xen_page_with_guest() API Andrew Cooper
2018-03-09 14:53 ` Wei Liu
2018-03-11 20:29 ` Julien Grall
2018-03-13 12:28 ` Roger Pau Monné
2018-03-13 14:39 ` Jan Beulich
2018-03-15 20:25 ` Andrew Cooper
2018-03-16 7:43 ` Jan Beulich
2018-03-16 8:58 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1520601522-2886-2-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).