From patchwork Wed Jun 1 21:24:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9148171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC26960467 for ; Wed, 1 Jun 2016 21:26:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD28625819 for ; Wed, 1 Jun 2016 21:26:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A22EB25D97; Wed, 1 Jun 2016 21:26:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0B5AC26B39 for ; Wed, 1 Jun 2016 21:26:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8Dcb-0001uO-Vd; Wed, 01 Jun 2016 21:24:13 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8Dca-0001uI-MN for xen-devel@lists.xenproject.org; Wed, 01 Jun 2016 21:24:12 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 0B/75-06230-B725F475; Wed, 01 Jun 2016 21:24:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsXSnM/Rolsd5B9 u8Lpb1uL7lslMDowehz9cYQlgjGLNzEvKr0hgzTjWsI214ABPxdY3UQ2Ms7m6GDk5JAQUJbY2 bmTuYuQAsi0lXq0p6GLk4hASuMkkcWXOX2aQGmEBNYnHTfeZQGwRgSSJT/PfsEEUbWWUOHrkA gtIgk1AX2L3i09gRbwCthI35vxhB7FZBFQklm95xQpiiwpESzzZPYEdokZQ4uTMJywgizkF3C UO3K0GCTMLqEv8mXeJGcKWl9j+dg7UDXoS0+7PY5nAyD8LSfcsJC2zkLQsYGRexahenFpUllq ka6yXVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iREYgAxAsIOx45/TIUZJDiYlUd6N wv7hQnxJ+SmVGYnFGfFFpTmpxYcY1Tk4BDYs/hsuxZKXn5eqJMGrHAhUJliUmp5akZaZA4wQm EoJDh4lEd77AUBp3uKCxNzizHSI1ClGRSlxXk+QPgGQREZpHlwbLCovMcpKCfMyAt0kxFOQWp SbWYIq/4pRnINRSZjXGGQKT2ZeCdz0V0CLmYAWx2f4gCwuSURISTUwzll4VEhre1ZI98snHQ9 eReUvvrPNb5aS6oe97tcaVrFwlk9c2nQgxMjPeYlRv8sr66rgpZa6L/fKi98w5hFrvL2/WF7d y+C/p9wLrS1iN55NnS28fat38u0P5zq6jD9xh9d/WVJTUH3sFaPF+fY9cxOdW5iufd8oudAyj 2GDUqnYrsiDOZrqSizFGYmGWsxFxYkAb+h/8MUCAAA= X-Env-Sender: amc96@hermes.cam.ac.uk X-Msg-Ref: server-5.tower-21.messagelabs.com!1464816251!16964098!1 X-Originating-IP: [131.111.8.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57010 invoked from network); 1 Jun 2016 21:24:11 -0000 Received: from ppsw-32.csi.cam.ac.uk (HELO ppsw-32.csi.cam.ac.uk) (131.111.8.132) by server-5.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Jun 2016 21:24:11 -0000 X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from host-92-20-247-223.as13285.net ([92.20.247.223]:51668 helo=[192.168.1.6]) by ppsw-32.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (PLAIN:amc96) (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1b8DcY-000VHV-1c (Exim 4.86_36-e07b163) (return-path ); Wed, 01 Jun 2016 22:24:10 +0100 To: Aaron Cornelius , Xen-devel References: <2D1D4CC433A3D1448C10AC5545A3471DF1378C0B@Quimby.dw.local> <2D1D4CC433A3D1448C10AC5545A3471DF1378C9B@Quimby.dw.local> From: Andrew Cooper Message-ID: Date: Wed, 1 Jun 2016 22:24:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <2D1D4CC433A3D1448C10AC5545A3471DF1378C9B@Quimby.dw.local> Subject: Re: [Xen-devel] Xen 4.7 crash X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 01/06/2016 21:45, Aaron Cornelius wrote: >> >>> However, since I only have 1 domain active at a time, I'm not sure why I >> should run out of VM IDs. >> >> Sounds like a VMID resource leak. Check to see whether it is freed properly >> in domain_destroy(). >> >> ~Andrew > That would be my assumption. But as far as I can tell, arch_domain_destroy() calls pwm_teardown() which calls p2m_free_vmid(), and none of the functionality related to freeing a VM ID appears to have changed in years. The VMID handling looks suspect. It can be called repeatedly during domain destruction, and it will repeatedly clear the same bit out of the vmid_mask. Having said that, I can't explain why that bug would result in the symptoms you are seeing. It is also possibly that your issue is memory corruption from a separate source. Can you see about instrumenting p2m_alloc_vmid()/p2m_free_vmid() (with vmid_alloc_lock held) to see which vmid is being allocated/freed ? After the initial boot of the system, you should see the same vmid being allocated and freed for each of your domains. ~Andrew diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 838d004..7adb39a 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1393,7 +1393,10 @@ static void p2m_free_vmid(struct domain *d) struct p2m_domain *p2m = &d->arch.p2m; spin_lock(&vmid_alloc_lock); if ( p2m->vmid != INVALID_VMID ) - clear_bit(p2m->vmid, vmid_mask); + { + ASSERT(test_and_clear_bit(p2m->vmid, vmid_mask)); + p2m->vmid = INVALID_VMID; + } spin_unlock(&vmid_alloc_lock); }