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>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Julien Grall" <julien.grall@arm.com>,
"Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 5/5] xen/domain: Make rangeset_domain_destroy() idempotent
Date: Mon, 3 Sep 2018 15:47:00 +0100 [thread overview]
Message-ID: <1535986020-15906-6-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1535986020-15906-1-git-send-email-andrew.cooper3@citrix.com>
... and move it into the common __domain_destroy() path.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
xen/common/domain.c | 9 +++------
xen/common/rangeset.c | 3 +++
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index d1c1993..2f2f152 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -272,6 +272,8 @@ static void __domain_destroy(struct domain *d)
xfree(d->pbuf);
+ rangeset_domain_destroy(d);
+
free_cpumask_var(d->dirty_cpumask);
xsm_free_security_domain(d);
@@ -286,7 +288,7 @@ struct domain *domain_create(domid_t domid,
bool is_priv)
{
struct domain *d, **pd, *old_hwdom = NULL;
- enum { INIT_watchdog = 1u<<1, INIT_rangeset = 1u<<2,
+ enum { INIT_watchdog = 1u<<1,
INIT_evtchn = 1u<<3, INIT_gnttab = 1u<<4, INIT_arch = 1u<<5 };
int err, init_status = 0;
@@ -350,7 +352,6 @@ struct domain *domain_create(domid_t domid,
goto fail;
rangeset_domain_initialise(d);
- init_status |= INIT_rangeset;
/* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */
if ( is_system_domain(d) && !is_idle_domain(d) )
@@ -475,8 +476,6 @@ struct domain *domain_create(domid_t domid,
evtchn_destroy_final(d);
radix_tree_destroy(&d->pirq_tree, free_pirq_struct);
}
- if ( init_status & INIT_rangeset )
- rangeset_domain_destroy(d);
if ( init_status & INIT_watchdog )
watchdog_domain_destroy(d);
@@ -882,8 +881,6 @@ static void complete_domain_destroy(struct rcu_head *head)
watchdog_domain_destroy(d);
- rangeset_domain_destroy(d);
-
sched_destroy_domain(d);
/* Free page used by xen oprofile buffer. */
diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 7788cdd..e3857ab 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -482,6 +482,9 @@ void rangeset_domain_destroy(
{
struct rangeset *r;
+ if ( list_head_is_null(&d->rangesets) )
+ return;
+
while ( !list_empty(&d->rangesets) )
{
r = list_entry(d->rangesets.next, struct rangeset, rangeset_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-09-03 14:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-03 14:46 [PATCH 0/5] xen/domain: Cleanup to the domain_create() error paths Andrew Cooper
2018-09-03 14:46 ` [PATCH 1/5] xen/domain: Prepare data for is_{pv, hvm}_domain() as early as possible Andrew Cooper
2018-09-03 16:03 ` Jan Beulich
2018-09-04 12:17 ` Andrew Cooper
2018-09-04 12:53 ` Jan Beulich
2018-09-03 16:47 ` Wei Liu
2018-09-03 14:46 ` [PATCH 2/5] xen/domain: Break __domain_destroy() out of domain_create() and complete_domain_destroy() Andrew Cooper
2018-09-03 16:05 ` Jan Beulich
2018-09-03 16:54 ` Wei Liu
2018-09-03 16:58 ` Andrew Cooper
2018-09-03 17:01 ` Wei Liu
2018-09-03 17:05 ` Andrew Cooper
2018-09-03 17:07 ` Wei Liu
2018-09-03 14:46 ` [PATCH 3/5] xen/domain: Call lock_profile_deregister_struct() from common code Andrew Cooper
2018-09-03 16:05 ` Jan Beulich
2018-09-03 16:56 ` Wei Liu
2018-09-03 14:46 ` [PATCH 4/5] xen/domain: Fold xsm_free_security_domain() paths together Andrew Cooper
2018-09-03 16:08 ` Jan Beulich
2018-09-03 16:57 ` Wei Liu
2018-09-07 20:48 ` [Non-DoD Source] " DeGraaf, Daniel G
2018-09-03 14:47 ` Andrew Cooper [this message]
2018-09-03 16:09 ` [PATCH 5/5] xen/domain: Make rangeset_domain_destroy() idempotent Jan Beulich
2018-09-03 16:57 ` Wei Liu
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=1535986020-15906-6-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.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).