From patchwork Fri Jul 18 20:26:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 33907 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3663120CA0 for ; Fri, 18 Jul 2014 20:28:42 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf21008684pde.3 for ; Fri, 18 Jul 2014 13:28:41 -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:message-id:date:from:user-agent :mime-version:to:references:in-reply-to:cc:subject:precedence :list-id:list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=nV4t5GZN12BsZ6b7hlyHtq57ztym3ql4wK6Q1iPlvW4=; b=AHTRd3Q51OuGyWa7zGbfZB9lRor3Stvtcz7WG827U1ej0PGaT4FbPNJlY7LrLDmKRh 6mvxDBBmRXJujSuoW1/5c3Rm33rmxUifEQhX5p2XkxTveDzTbISJFtlxI1eOAUe2kK4W 5it3wZDNxvU2ABcXgeTQDJyd7grjQCo1IcRLLI1YoKbkZbhV/7CAUjdLtJa7PxiJdPpd 3Hu2TePE6WI1UUfkRPUH+mVR69t3SvRnW7coYmEYN93o+OMtAUQicZnboTSK0tjOH3X8 WmjZoRqOmk7+LG0sfKHayhyH7pAxIDWCoRX+gLWgqIEvhTw08k/gzdX00VbfvAvFzrnd 0bQg== X-Gm-Message-State: ALoCoQnuwYwllgiR4qAHwJ52lpBUrMwZnbFB9eQyS1lf9QODNxaRIlCggWrrIoq9ybnRNIscLAKO X-Received: by 10.66.252.166 with SMTP id zt6mr3464638pac.1.1405715321303; Fri, 18 Jul 2014 13:28:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.38 with SMTP id j35ls399046qge.89.gmail; Fri, 18 Jul 2014 13:28:41 -0700 (PDT) X-Received: by 10.221.56.5 with SMTP id wa5mr5893139vcb.25.1405715321083; Fri, 18 Jul 2014 13:28:41 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id c2si6866258vcn.74.2014.07.18.13.28.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 13:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so8109883vcb.22 for ; Fri, 18 Jul 2014 13:28:40 -0700 (PDT) X-Received: by 10.221.47.9 with SMTP id uq9mr9505164vcb.48.1405715320782; Fri, 18 Jul 2014 13:28:40 -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 tc5csp39363vcb; Fri, 18 Jul 2014 13:28:40 -0700 (PDT) X-Received: by 10.50.117.42 with SMTP id kb10mr42967563igb.37.1405715319987; Fri, 18 Jul 2014 13:28:39 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id j5si7908353igx.37.2014.07.18.13.28.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 18 Jul 2014 13:28:39 -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 1X8Ejw-00017c-66; Fri, 18 Jul 2014 20:26:48 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X8Ejv-00017X-4i for xen-devel@lists.xen.org; Fri, 18 Jul 2014 20:26:47 +0000 Received: from [85.158.143.35:45031] by server-3.bemta-4.messagelabs.com id 35/69-09960-60389C35; Fri, 18 Jul 2014 20:26:46 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-12.tower-21.messagelabs.com!1405715205!18682510!1 X-Originating-IP: [74.125.82.45] 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 6833 invoked from network); 18 Jul 2014 20:26:45 -0000 Received: from mail-wg0-f45.google.com (HELO mail-wg0-f45.google.com) (74.125.82.45) by server-12.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 18 Jul 2014 20:26:45 -0000 Received: by mail-wg0-f45.google.com with SMTP id x12so4038511wgg.16 for ; Fri, 18 Jul 2014 13:26:45 -0700 (PDT) X-Received: by 10.180.82.97 with SMTP id h1mr35376177wiy.30.1405715205396; Fri, 18 Jul 2014 13:26:45 -0700 (PDT) Received: from [192.168.0.24] (cpc8-cmbg15-2-0-cust169.5-4.cable.virginm.net. [86.30.140.170]) by mx.google.com with ESMTPSA id v14sm16647000wjw.38.2014.07.18.13.26.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 13:26:44 -0700 (PDT) Message-ID: <53C982FF.7070608@linaro.org> Date: Fri, 18 Jul 2014 21:26:39 +0100 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Ian Campbell References: <53C920DD.6060300@linaro.org> <1405701560.14973.1.camel@kazak.uk.xensource.com> In-Reply-To: <1405701560.14973.1.camel@kazak.uk.xensource.com> Cc: jgross@suse.com, Stefano Stabellini , Dario Faggioli , Tim Deegan , george.dunlap@citrix.com, xen-devel Subject: Re: [Xen-devel] Xen crashing when killing a domain with no VCPUs 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: , 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.177 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: On 18/07/14 17:39, Ian Campbell wrote: > On Fri, 2014-07-18 at 14:27 +0100, Julien Grall wrote: >> Hi all, >> >> I've been played with the function alloc_vcpu on ARM. And I hit one case >> where this function can failed. >> >> During domain creation, the toolstack will call DOMCTL_max_vcpus which may >> fail, for instance because alloc_vcpu didn't succeed. In this case, the >> toolstack will call DOMCTL_domaindestroy. And I got the below stack trace. >> >> It can be reproduced on Xen 4.5 (and I also suspect Xen 4.4) by returning >> in an error in vcpu_initialize. >> >> I'm not sure how to correctly fix it. > > I think a simple check at the head of the function would be ok. > > Alternatively perhaps in sched_mode_domain, which could either detect > this or could detect a domain in pool0 being moved to pool0 and short > circuit. I was thinking about the small fix below. If it's fine for everyone, I can send a patch next week. Regards, diff --git a/xen/common/schedule.c b/xen/common/schedule.c index e9eb0bc..c44d047 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -311,7 +311,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c) } /* Do we have vcpus already? If not, no need to update node-affinity */ - if ( d->vcpu ) + if ( d->vcpu && d->vcpu[0] != NULL ) domain_update_node_affinity(d); domain_unpause(d);