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

[Xen-devel] [PATCH] move domain to cpupool0 before destroying it

  • To: xen-devel@xxxxxxxxxxxxx, JBeulich@xxxxxxxx
  • From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
  • Date: Thu, 15 May 2014 06:59:54 +0200
  • Cc: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
  • Delivery-date: Thu, 15 May 2014 05:00:35 +0000
  • Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer; b=cL0Cw8A402+C/fGa2w5txwK9pvTTvxgFH6wDxX5gZ+KjhpNfglMpPOd4 Dpkg4WlAuxlZSeHR8T6FuOzeo6RMv/gSZ0EXGPDQzRzQQ3uhE/GmeMutg Beh/7EQGK7nka1OCqNUXeWGgIxYxzp0JQko7l+2eRIgONW6LuWNsUZ0O+ hLDST6Hu3YcIWVOSyDlLKHKZlZDpk7up1lkVz3P553FUivqW/egFnNzvA fu0aJA/TRK/Jv33iWFHOejPp7Q0wS;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Currently when a domain is destroyed it is removed from the domain_list
before all of it's resources, including the cpupool membership, are freed.
This can lead to a situation where the domain is still member of a cpupool
without for_each_domain_in_cpupool() (or even for_each_domain()) being
able to find it any more. This in turn can result in rejection of removing
the last cpu from a cpupool, because there seems to be still a domain in
the cpupool, even if it can't be found by scanning through all domains.

This situation can be avoided by moving the domain to be destroyed to
cpupool0 first and then remove it from this cpupool BEFORE deleting it from
the domain_list. As cpupool0 is always active and a domain without any cpupool
membership is implicitly regarded as belonging to cpupool0, this poses no

Signed-off-by: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
 xen/common/domain.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 4291e29..d4bcf6b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -593,6 +593,8 @@ int domain_kill(struct domain *d)
             BUG_ON(rc != -EAGAIN);
+        if ( sched_move_domain(d, cpupool0) )
+            return -EAGAIN;
         for_each_vcpu ( d, v )
         d->is_dying = DOMDYING_dead;
@@ -775,8 +777,6 @@ static void complete_domain_destroy(struct rcu_head *head)
-    cpupool_rm_domain(d);
     /* Free page used by xen oprofile buffer. */
@@ -823,6 +823,8 @@ void domain_destroy(struct domain *d)
     if ( _atomic_read(old) != 0 )
+    cpupool_rm_domain(d);
     /* Delete from task list and task hashtable. */
     TRACE_1D(TRC_SCHED_DOM_REM, d->domain_id);

Xen-devel mailing list



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