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>, "Dario Faggioli" <dfaggioli@suse.com>,
"Julien Grall" <julien.grall@arm.com>,
"Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 1/6] xen/domain: Reduce the quantity of initialisation for system domains
Date: Wed, 28 Feb 2018 14:14:23 +0000 [thread overview]
Message-ID: <1519827268-18199-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1519827268-18199-1-git-send-email-andrew.cooper3@citrix.com>
* System domains don't need watchdog initialisation or iomem/irq rangesets,
and will not plausibly be a xenstore or hardware domain.
* The idle domain doesn't need scheduler initialisation (and in particular,
removing this path allows for substantial scheduler cleanup), and isn't
liable to ever need late_hwdom_init().
Move all of these initialisations pass the DOMCRF_dummy early exit, and into
non-idle paths. rangeset_domain_initialise() remains because it makes no
allocations, but does initialise a linked list and spinlock. The poolid
parameter can be dropped as sched_init_domain()'s parameter is now
unconditionally 0.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: George Dunlap <George.Dunlap@eu.citrix.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>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Dario Faggioli <dfaggioli@suse.com>
---
xen/common/domain.c | 63 +++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 33 deletions(-)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index e1c003d..e0b024c 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -268,7 +268,6 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
enum { INIT_xsm = 1u<<0, INIT_watchdog = 1u<<1, INIT_rangeset = 1u<<2,
INIT_evtchn = 1u<<3, INIT_gnttab = 1u<<4, INIT_arch = 1u<<5 };
int err, init_status = 0;
- int poolid = CPUPOOLID_NONE;
if ( (d = alloc_domain_struct()) == NULL )
return ERR_PTR(-ENOMEM);
@@ -283,9 +282,6 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
goto fail;
init_status |= INIT_xsm;
- watchdog_domain_init(d);
- init_status |= INIT_watchdog;
-
atomic_set(&d->refcnt, 1);
spin_lock_init_prof(d, domain_lock);
spin_lock_init_prof(d, page_alloc_lock);
@@ -313,35 +309,38 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
else
d->guest_type = guest_type_pv;
- if ( domid == 0 || domid == hardware_domid )
- {
- if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED )
- panic("The value of hardware_dom must be a valid domain ID");
- d->is_pinned = opt_dom0_vcpus_pin;
- d->disable_migrate = 1;
- old_hwdom = hardware_domain;
- hardware_domain = d;
- }
-
- if ( domcr_flags & DOMCRF_xs_domain )
- {
- d->is_xenstore = 1;
- d->disable_migrate = 1;
- }
-
rangeset_domain_initialise(d);
init_status |= INIT_rangeset;
- d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
- d->irq_caps = rangeset_new(d, "Interrupts", 0);
- if ( (d->iomem_caps == NULL) || (d->irq_caps == NULL) )
- goto fail;
-
if ( domcr_flags & DOMCRF_dummy )
return d;
if ( !is_idle_domain(d) )
{
+ watchdog_domain_init(d);
+ init_status |= INIT_watchdog;
+
+ if ( domid == 0 || domid == hardware_domid )
+ {
+ if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED )
+ panic("The value of hardware_dom must be a valid domain ID");
+ d->is_pinned = opt_dom0_vcpus_pin;
+ d->disable_migrate = 1;
+ old_hwdom = hardware_domain;
+ hardware_domain = d;
+ }
+
+ if ( domcr_flags & DOMCRF_xs_domain )
+ {
+ d->is_xenstore = 1;
+ d->disable_migrate = 1;
+ }
+
+ d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
+ d->irq_caps = rangeset_new(d, "Interrupts", 0);
+ if ( !d->iomem_caps || !d->irq_caps )
+ goto fail;
+
if ( (err = xsm_domain_create(XSM_HOOK, d, ssidref)) != 0 )
goto fail;
@@ -366,8 +365,6 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
goto fail;
init_status |= INIT_gnttab;
- poolid = 0;
-
err = -ENOMEM;
d->pbuf = xzalloc_array(char, DOMAIN_PBUF_SIZE);
@@ -379,14 +376,14 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
goto fail;
init_status |= INIT_arch;
- if ( (err = sched_init_domain(d, poolid)) != 0 )
- goto fail;
-
- if ( (err = late_hwdom_init(d)) != 0 )
- goto fail;
-
if ( !is_idle_domain(d) )
{
+ if ( (err = sched_init_domain(d, 0)) != 0 )
+ goto fail;
+
+ if ( (err = late_hwdom_init(d)) != 0 )
+ goto fail;
+
spin_lock(&domlist_update_lock);
pd = &domain_list; /* NB. domain_list maintained in order of domid. */
for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
--
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-02-28 14:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 14:14 [PATCH 0/6] Assorted improvements to domain creation Andrew Cooper
2018-02-28 14:14 ` Andrew Cooper [this message]
2018-02-28 15:22 ` [PATCH 1/6] xen/domain: Reduce the quantity of initialisation for system domains George Dunlap
2018-03-01 10:10 ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 2/6] xen/credit2: Move repl_timer into struct csched2_dom Andrew Cooper
2018-02-28 15:26 ` George Dunlap
2018-03-01 10:12 ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 3/6] xen/sched: Improvements to the {alloc, free}_domdata() interfaces Andrew Cooper
2018-02-28 15:40 ` George Dunlap
2018-02-28 16:31 ` Meng Xu
2018-03-01 10:39 ` Dario Faggioli
2018-03-05 18:20 ` Andrew Cooper
2018-02-28 14:14 ` [PATCH 4/6] xen/sched: Remove {init, destroy}_domain() interfaces Andrew Cooper
2018-02-28 16:22 ` George Dunlap
2018-02-28 16:33 ` Andrew Cooper
2018-03-01 11:08 ` Dario Faggioli
2018-02-28 16:34 ` Meng Xu
2018-03-01 11:00 ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 5/6] xen/domain: Call sched_destroy_domain() in the domain_create() error path Andrew Cooper
2018-02-28 16:24 ` George Dunlap
2018-03-01 13:25 ` Dario Faggioli
2018-03-01 13:27 ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 6/6] xen/domain: Use IS_ERR_OR_NULL() when checking the return value of domain_create() Andrew Cooper
2018-02-28 16:36 ` George Dunlap
2018-03-07 19:12 ` [PATCH v2 6/6] xen/domain: Added debug safety in the domain_create() failure path Andrew Cooper
2018-03-08 9:04 ` Jan Beulich
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=1519827268-18199-2-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=dfaggioli@suse.com \
--cc=julien.grall@arm.com \
--cc=roger.pau@citrix.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).