From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated Date: Fri, 08 Aug 2014 14:08:23 +0100 Message-ID: <53E4CBC7.9080100@linaro.org> References: <1407503208-20218-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFjuI-00076g-1I for xen-devel@lists.xenproject.org; Fri, 08 Aug 2014 13:08:30 +0000 Received: by mail-we0-f180.google.com with SMTP id w61so5544553wes.25 for ; Fri, 08 Aug 2014 06:08:28 -0700 (PDT) In-Reply-To: <1407503208-20218-1-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Keir Fraser , ian.campbell@citrix.com, Ian Jackson , Dario Faggioli , tim@xen.org, George Dunlap , stefano.stabellini@citrix.com, Jan Beulich List-Id: xen-devel@lists.xenproject.org It's the V4 not V3. I used the wrong command line when generating this patch. Sorry. On 08/08/2014 02:06 PM, Julien Grall wrote: > The commit "move domain to cpupool0 before destroying it" make Xen crashes > when a domain is destroyed with d->vcpus allocated but no VCPU initialized. > > Assertion '!cpumask_empty(dom_cpumask)' failed at domain.c:452 > Xen call trace: > [<00207bd8>] domain_update_node_affinity+0x10c/0x238 (PC) > [<00000004>] 00000004 (LR) > [<00226870>] sched_move_domain+0x3cc/0x42c > [<0020925c>] domain_kill+0xc8/0x178 > [<00206a0c>] do_domctl+0xaac/0x15e4 > [<002529c0>] do_trap_hypervisor+0xc5c/0xf94 > [<002559f0>] return_from_trap+0/0x4 > > Bail out early if there is d->VCPU is not allocated or VCPU 0 has not been > initialized. > > Signed-off-by: Julien Grall > Cc: George Dunlap > Cc: Dario Faggioli > Cc: Juergen Gross > Cc: Ian Campbell > Cc: Ian Jackson > Cc: Jan Beulich > Cc: Keir Fraser > Cc: Tim Deegan > > --- > This patch should be backported to Xen 4.4 > > Changes in v4: > - Drop the check in common/schedule.c before calling > domain_update_node_affinity > - Comment the check in domain_update_node_affinity > > Changes in v3: > - Change commit message > - Bail out early rather than modifying the ASSERT > --- > xen/common/domain.c | 4 ++++ > xen/common/schedule.c | 4 +--- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/xen/common/domain.c b/xen/common/domain.c > index d7a84cf..ca6174a 100644 > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -415,6 +415,10 @@ void domain_update_node_affinity(struct domain *d) > struct vcpu *v; > unsigned int cpu; > > + /* Do we have vcpus already? If not, no need to update node-affinity */ > + if ( !d->vcpu || !d->vcpu[0] ) > + return; > + > if ( !zalloc_cpumask_var(&dom_cpumask) ) > return; > if ( !zalloc_cpumask_var(&dom_cpumask_soft) ) > diff --git a/xen/common/schedule.c b/xen/common/schedule.c > index 9a49769..55503e0 100644 > --- a/xen/common/schedule.c > +++ b/xen/common/schedule.c > @@ -310,9 +310,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c) > SCHED_OP(old_ops, free_vdata, vcpudata); > } > > - /* Do we have vcpus already? If not, no need to update node-affinity */ > - if ( d->vcpu ) > - domain_update_node_affinity(d); > + domain_update_node_affinity(d); > > domain_unpause(d); > > -- Julien Grall