From patchwork Fri Aug 8 13:06:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 35121 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 10A382118A for ; Fri, 8 Aug 2014 13:09:22 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id v10sf4997298pde.2 for ; Fri, 08 Aug 2014 06:09:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-post:list-help :list-subscribe:mime-version:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive :content-type:content-transfer-encoding; bh=0kl22VG1KspjOaGsjnNqKA2LI7JoLRkxD9eUEc28Eic=; b=g88ufFsrJMyHNi+DF/bmHl/3wkZiaGtHqB+IPhhoP+dGTIavjMwCoPB6dI4w4wIx8q fMJ8Tk161Kd5W8N1H8FeN04EY1JQkFR+i/06819sjb1dRq5CVEwFixS5rFesPzTsjma1 4lbwjU9J2qNS9kJaPdcNJ4qWDnuX6FFqhUnlYMaztlEedEbdze4TrA016DOhtuUiWlWb RqXkR3zGHY56XzO/FxMEClmcCqPAWrwOFSaKlpfro8taRc1v4KjgMM6SUqa1iNMj5GTr UTa46zJV42fPrl9rgx1SbxAwg/cK0YQaJr8dV9eigl3CNHk5zTKi7Glu/U3x85bfKQWC t31Q== X-Gm-Message-State: ALoCoQkR9KSuHNpjEjIvTzTpBPjNoG+s71Q5vweJ7nVeCbYtaaPsTStiu1E6uxuGnV962bO/7xaE X-Received: by 10.66.241.104 with SMTP id wh8mr8162260pac.33.1407503362267; Fri, 08 Aug 2014 06:09:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.100 with SMTP id l91ls538259qge.69.gmail; Fri, 08 Aug 2014 06:09:22 -0700 (PDT) X-Received: by 10.220.190.134 with SMTP id di6mr1549607vcb.43.1407503362111; Fri, 08 Aug 2014 06:09:22 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id oc9si2855828vcb.105.2014.08.08.06.09.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 08 Aug 2014 06:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ik5so8296150vcb.34 for ; Fri, 08 Aug 2014 06:09:22 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr6641806vdb.27.1407503362004; Fri, 08 Aug 2014 06:09:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp121437vcb; Fri, 8 Aug 2014 06:09:21 -0700 (PDT) X-Received: by 10.42.84.76 with SMTP id k12mr11975823icl.18.1407503361252; Fri, 08 Aug 2014 06:09:21 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id lo8si3554391igb.35.2014.08.08.06.09.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Aug 2014 06:09:21 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFjsp-0006zL-3h; Fri, 08 Aug 2014 13:06:59 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFjsn-0006zF-JT for xen-devel@lists.xenproject.org; Fri, 08 Aug 2014 13:06:57 +0000 Received: from [193.109.254.147:43995] by server-9.bemta-14.messagelabs.com id 2D/F5-31535-07BC4E35; Fri, 08 Aug 2014 13:06:56 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1407503216!14575740!1 X-Originating-IP: [74.125.82.175] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28958 invoked from network); 8 Aug 2014 13:06:56 -0000 Received: from mail-we0-f175.google.com (HELO mail-we0-f175.google.com) (74.125.82.175) by server-4.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 8 Aug 2014 13:06:56 -0000 Received: by mail-we0-f175.google.com with SMTP id t60so5653102wes.34 for ; Fri, 08 Aug 2014 06:06:55 -0700 (PDT) X-Received: by 10.180.99.4 with SMTP id em4mr4201400wib.8.1407503215485; Fri, 08 Aug 2014 06:06:55 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id q2sm7037093wia.19.2014.08.08.06.06.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Aug 2014 06:06:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Fri, 8 Aug 2014 14:06:48 +0100 Message-Id: <1407503208-20218-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 Cc: Juergen Gross , Keir Fraser , ian.campbell@citrix.com, Ian Jackson , Dario Faggioli , Julien Grall , tim@xen.org, George Dunlap , stefano.stabellini@citrix.com, Jan Beulich Subject: [Xen-devel] [PATCH v3] xen: domain_update_node_affinity: Bail out early if no VCPUs are allocated X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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);