Re: [Xen-devel] [PATCH 5/6] xen/domain: Call sched_destroy_domain() in the domain_create() error path

2018-03-01 Thread Dario Faggioli
On Wed, 2018-02-28 at 14:14 +, Andrew Cooper wrote:
> If domain_create() fails, complete_domain_destroy() doesn't get
> called,
> meaning that sched_destroy_domain() is missed.  In practice, this can
> only
> fail because of exceptional late_hwdom_init() issues at the moment.
> 
> Make sched_destroy_domain() idempotent, and call it in the fail path.
> 
> Signed-off-by: Andrew Cooper 
>
Reviewed-by: Dario Faggioli 

Regards,
Dario
-- 
<> (Raistlin Majere)
-
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

signature.asc
Description: This is a digitally signed message part
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 5/6] xen/domain: Call sched_destroy_domain() in the domain_create() error path

2018-03-01 Thread Dario Faggioli
On Wed, 2018-02-28 at 14:14 +, Andrew Cooper wrote:
> If domain_create() fails, complete_domain_destroy() doesn't get
> called,
> meaning that sched_destroy_domain() is missed.  In practice, this can
> only
> fail because of exceptional late_hwdom_init() issues at the moment.
> 
> Make sched_destroy_domain() idempotent, and call it in the fail path.
> 
> Signed-off-by: Andrew Cooper 
>
Reviewed-by: Dario Faggioli 

Regards,
Dario
-- 
<> (Raistlin Majere)
-
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

signature.asc
Description: This is a digitally signed message part
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 5/6] xen/domain: Call sched_destroy_domain() in the domain_create() error path

2018-02-28 Thread George Dunlap
On 02/28/2018 02:14 PM, Andrew Cooper wrote:
> If domain_create() fails, complete_domain_destroy() doesn't get called,
> meaning that sched_destroy_domain() is missed.  In practice, this can only
> fail because of exceptional late_hwdom_init() issues at the moment.
> 
> Make sched_destroy_domain() idempotent, and call it in the fail path.
> 
> Signed-off-by: Andrew Cooper 

Reviewed-by: George Dunlap 

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

[Xen-devel] [PATCH 5/6] xen/domain: Call sched_destroy_domain() in the domain_create() error path

2018-02-28 Thread Andrew Cooper
If domain_create() fails, complete_domain_destroy() doesn't get called,
meaning that sched_destroy_domain() is missed.  In practice, this can only
fail because of exceptional late_hwdom_init() issues at the moment.

Make sched_destroy_domain() idempotent, and call it in the fail path.

Signed-off-by: Andrew Cooper 
---
CC: George Dunlap 
CC: Jan Beulich 
CC: Konrad Rzeszutek Wilk 
CC: Stefano Stabellini 
CC: Tim Deegan 
CC: Wei Liu 
CC: Dario Faggioli 
CC: Roger Pau Monné 
---
 xen/common/domain.c   |  3 +++
 xen/common/schedule.c | 14 --
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index e0b024c..3cefe76 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -404,6 +404,9 @@ struct domain *domain_create(domid_t domid, unsigned int 
domcr_flags,
 hardware_domain = old_hwdom;
 atomic_set(>refcnt, DOMAIN_DESTROYED);
 xfree(d->pbuf);
+
+sched_destroy_domain(d);
+
 if ( init_status & INIT_arch )
 arch_domain_destroy(d);
 if ( init_status & INIT_gnttab )
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 5f596f0..64524f4 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -436,16 +436,18 @@ int sched_init_domain(struct domain *d, int poolid)
 
 void sched_destroy_domain(struct domain *d)
 {
-ASSERT(d->cpupool != NULL || is_idle_domain(d));
 ASSERT(d->domain_id < DOMID_FIRST_RESERVED);
 
-SCHED_STAT_CRANK(dom_destroy);
-TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);
+if ( d->cpupool )
+{
+SCHED_STAT_CRANK(dom_destroy);
+TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);
 
-sched_free_domdata(dom_scheduler(d), d->sched_priv);
-d->sched_priv = NULL;
+sched_free_domdata(dom_scheduler(d), d->sched_priv);
+d->sched_priv = NULL;
 
-cpupool_rm_domain(d);
+cpupool_rm_domain(d);
+}
 }
 
 void vcpu_sleep_nosync(struct vcpu *v)
-- 
2.1.4


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