From nobody Wed May 1 19:35:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603183929; cv=none; d=zohomail.com; s=zohoarc; b=DaeLi3RhHP+m4AHaYOX7Rnan2Ihp63sic+Zt8M+EcYpQaU9OSl7LmsMcojQ7JmERXIQywyCldOBUyRi3gVDK+po+e5npQA3tH8JMJGJ4w8j89wjeUBY0Ke+LMUb3lxzNy/MdAdFvgcLIC1iPEPnjnDVvzJ2M47/E3Gk2UhKcKRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603183929; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=arOgXeiLTKU2wh0YCFEyIQpNOe0gMByJ4Vpip6u4gUs=; b=GRIv/as80cDsSAPKZdr17VKJcrq0Cp9+b/eZHSPZnR5F2Z5WtLTPs2cAhiyjynqV0xgcdUlZ7tdkfTfZyZ4FTvw9zBgmvFpkkoXI8xVoSZ2Fv6wQTp9rHjT1M8IIamge5Da/iNGBQRrHgZAkOX+1PZtmrYuKEOF6/BFxyOwfUT0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603183929655289.8777649212684; Tue, 20 Oct 2020 01:52:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.8981.24164 (Exim 4.92) (envelope-from ) id 1kUnN3-00047p-AT; Tue, 20 Oct 2020 08:51:53 +0000 Received: by outflank-mailman (output) from mailman id 8981.24164; Tue, 20 Oct 2020 08:51:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kUnN3-00047i-7P; Tue, 20 Oct 2020 08:51:53 +0000 Received: by outflank-mailman (input) for mailman id 8981; Tue, 20 Oct 2020 08:51:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kUnN2-00047d-AQ for xen-devel@lists.xenproject.org; Tue, 20 Oct 2020 08:51:52 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 60b49909-be9c-4136-8178-d67340ccc431; Tue, 20 Oct 2020 08:51:50 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0D73AAF44; Tue, 20 Oct 2020 08:51:50 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kUnN2-00047d-AQ for xen-devel@lists.xenproject.org; Tue, 20 Oct 2020 08:51:52 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 60b49909-be9c-4136-8178-d67340ccc431; Tue, 20 Oct 2020 08:51:50 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0D73AAF44; Tue, 20 Oct 2020 08:51:50 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 60b49909-be9c-4136-8178-d67340ccc431 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603183910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=arOgXeiLTKU2wh0YCFEyIQpNOe0gMByJ4Vpip6u4gUs=; b=L6ns0KGI+kutmE2u3/upVcEkNBgS5qKkk/wTYpjsXQf0ks8A9ZP4ysy9Mev6klPJ/EyZu2 qWSrh4hIr+voFf7iC1c53YoXAm44SkWDbsQjQY0ty54UdehohZ9QNSAsbthCfyXEYQ6MRp gLOP65mdJW1GXL5i7oV+Iiz1DJtJfNw= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu Subject: [PATCH] tools/libs/ctrl: fix dumping of ballooned guest Date: Tue, 20 Oct 2020 10:51:43 +0200 Message-Id: <20201020085143.21303-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" A guest with memory < maxmem can't be dumped via xl dump-core without an error message today: xc: info: exceeded nr_pages (262144) losing pages In case the last page of the guest isn't allocated the loop in xc_domain_dumpcore_via_callback() will always spit out this message, as the number of already dumped pages is tested before the next page is checked to be valid. Signed-off-by: Juergen Gross --- Unfortunately this patch isn't a complete fix, while I believe it is needed. There is still a mismatch of exactly 1 page. I have no idea where this could come from. Signed-off-by: Juergen Gross --- tools/libs/ctrl/xc_core.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/libs/ctrl/xc_core.c b/tools/libs/ctrl/xc_core.c index e8c6fb96f9..d83e3726b6 100644 --- a/tools/libs/ctrl/xc_core.c +++ b/tools/libs/ctrl/xc_core.c @@ -818,16 +818,6 @@ xc_domain_dumpcore_via_callback(xc_interface *xch, { uint64_t gmfn; void *vaddr; - =20 - if ( j >=3D nr_pages ) - { - /* - * When live dump-mode (-L option) is specified, - * guest domain may increase memory. - */ - IPRINTF("exceeded nr_pages (%ld) losing pages", nr_pages); - goto copy_done; - } =20 if ( !auto_translated_physmap ) { @@ -847,6 +837,12 @@ xc_domain_dumpcore_via_callback(xc_interface *xch, continue; } =20 + if ( j >=3D nr_pages ) + { + j++; + continue; + } + p2m_array[j].pfn =3D i; p2m_array[j].gmfn =3D gmfn; } @@ -855,6 +851,12 @@ xc_domain_dumpcore_via_callback(xc_interface *xch, if ( !xc_core_arch_gpfn_may_present(&arch_ctxt, i) ) continue; =20 + if ( j >=3D nr_pages ) + { + j++; + continue; + } + gmfn =3D i; pfn_array[j] =3D i; } @@ -879,7 +881,15 @@ xc_domain_dumpcore_via_callback(xc_interface *xch, } } =20 -copy_done: + if ( j > nr_pages ) + { + /* + * When live dump-mode (-L option) is specified, + * guest domain may increase memory. + */ + IPRINTF("exceeded nr_pages (%ld) losing %ld pages", nr_pages, j - = nr_pages); + } + sts =3D dump_rtn(xch, args, dump_mem_start, dump_mem - dump_mem_start); if ( sts !=3D 0 ) goto out; --=20 2.26.2