From nobody Mon Feb 9 00:31:03 2026 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=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1603992051; cv=none; d=zohomail.com; s=zohoarc; b=Y0VtSTQDtOHV8Auy+7re6lSd7QfWcO6BR5P3oAXMVeUAHUZKdB4onCCYlMoRbbpqnK1X3YtbKpQV/2pz3gJP70wjwHjlGdj6Ofs9yf7yYBhaYxUw6e7WPOZydsYHRYUiVNbAjJg4QPi+OGce5JimOlmzi7KEAki4DqNyYF8O1jQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603992051; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dcpi0RoPHtdIFCl+PLBz0qXMYWjsEXHpQRt3CZZau4g=; b=ga5qI9wwZeimHdQTIGETZFC83CSfWRNJQuyRoYnAw+8QNebxCn2e3sOUuo6AqSia8MsMyt2JeeTQE8GNkg19Vzf0b9ikOhb1OyWVgkM9wYJAZ6SnCpnodObxMyrEGb0ZWso8JWLFILiVJUe4UQngNYkjQ7Zrhy6aPiMZFxufXG8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603992051485160.45760409589764; Thu, 29 Oct 2020 10:20:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.14419.35673 (Exim 4.92) (envelope-from ) id 1kYBbG-0003ic-08; Thu, 29 Oct 2020 17:20:34 +0000 Received: by outflank-mailman (output) from mailman id 14419.35673; Thu, 29 Oct 2020 17:20:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYBbF-0003iE-KZ; Thu, 29 Oct 2020 17:20:33 +0000 Received: by outflank-mailman (input) for mailman id 14419; Thu, 29 Oct 2020 17:20:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYBbD-0003MD-My for xen-devel@lists.xenproject.org; Thu, 29 Oct 2020 17:20:31 +0000 Received: from mo4-p02-ob.smtp.rzone.de (unknown [85.215.255.83]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 127c0127-9c7d-4b89-ac04-0ef80a5d7e3d; Thu, 29 Oct 2020 17:20:18 +0000 (UTC) Received: from sender by smtp.strato.de (RZmta 47.3.0 DYNA|AUTH) with ESMTPSA id j0b1afw9THKB3fD (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) (Client did not present a certificate); Thu, 29 Oct 2020 18:20:11 +0100 (CET) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYBbD-0003MD-My for xen-devel@lists.xenproject.org; Thu, 29 Oct 2020 17:20:31 +0000 Received: from mo4-p02-ob.smtp.rzone.de (unknown [85.215.255.83]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 127c0127-9c7d-4b89-ac04-0ef80a5d7e3d; Thu, 29 Oct 2020 17:20:18 +0000 (UTC) Received: from sender by smtp.strato.de (RZmta 47.3.0 DYNA|AUTH) with ESMTPSA id j0b1afw9THKB3fD (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) (Client did not present a certificate); Thu, 29 Oct 2020 18:20:11 +0100 (CET) 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: 127c0127-9c7d-4b89-ac04-0ef80a5d7e3d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1603992017; s=strato-dkim-0002; d=aepfle.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=dcpi0RoPHtdIFCl+PLBz0qXMYWjsEXHpQRt3CZZau4g=; b=ijoHKnN8B92cG0ZgPu+XVZgFz9yoj6EfYeXfeeqipGOTC7DUSV/ZsxvS0dcUoQdIH/ fSBwyISTh/Aot3bYwGit11QA9Pl/9Vp8ibtLeNxWx3L8zlc0317d/sQtFm/XdF94Dg9P NHSkcedeLi2U/fdgBKfsU5W8EQ2Ik/GGOOOi8/+8xHHXMgFATvfSxvgYvc1CPT2pd1sR JGLquTspeeNgz6TJWQG3sx0/bZL1G4OB5Or0/y/AWd8oSLRfyIm1tgc6GLlz0mj4g/vm kHLpuxTcAywspG3wZ7Z2oeqz0g+YWuXSmD2OuLzHOHmCVL9gRk+pbJkULyA17Q+c338t oL+A== X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzBW/OdlBZQ4AHSS3G1Jjw==" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: xen-devel@lists.xenproject.org Cc: Olaf Hering , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH v1 08/23] tools/guest: save: move mfns array Date: Thu, 29 Oct 2020 18:19:48 +0100 Message-Id: <20201029172004.17219-9-olaf@aepfle.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029172004.17219-1-olaf@aepfle.de> References: <20201029172004.17219-1-olaf@aepfle.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Remove allocation from hotpath, move mfns array into preallocated space. Signed-off-by: Olaf Hering --- tools/libs/guest/xg_sr_common.h | 2 ++ tools/libs/guest/xg_sr_save.c | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/libs/guest/xg_sr_common.h b/tools/libs/guest/xg_sr_commo= n.h index c78a07b8f8..0c2bef8f78 100644 --- a/tools/libs/guest/xg_sr_common.h +++ b/tools/libs/guest/xg_sr_common.h @@ -213,6 +213,8 @@ static inline int update_blob(struct xc_sr_blob *blob, =20 struct xc_sr_save_arrays { xen_pfn_t batch_pfns[MAX_BATCH_SIZE]; + /* write_batch: Mfns of the batch pfns. */ + xen_pfn_t mfns[MAX_BATCH_SIZE]; }; =20 struct xc_sr_restore_arrays { diff --git a/tools/libs/guest/xg_sr_save.c b/tools/libs/guest/xg_sr_save.c index 597e638c59..cdab288c3f 100644 --- a/tools/libs/guest/xg_sr_save.c +++ b/tools/libs/guest/xg_sr_save.c @@ -88,7 +88,7 @@ static int write_checkpoint_record(struct xc_sr_context *= ctx) static int write_batch(struct xc_sr_context *ctx) { xc_interface *xch =3D ctx->xch; - xen_pfn_t *mfns =3D NULL, *types =3D NULL; + xen_pfn_t *mfns =3D ctx->save.m->mfns, *types =3D NULL; void *guest_mapping =3D NULL; void **guest_data =3D NULL; void **local_pages =3D NULL; @@ -105,8 +105,6 @@ static int write_batch(struct xc_sr_context *ctx) =20 assert(nr_pfns !=3D 0); =20 - /* Mfns of the batch pfns. */ - mfns =3D malloc(nr_pfns * sizeof(*mfns)); /* Types of the batch pfns. */ types =3D malloc(nr_pfns * sizeof(*types)); /* Errors from attempting to map the gfns. */ @@ -118,7 +116,7 @@ static int write_batch(struct xc_sr_context *ctx) /* iovec[] for writev(). */ iov =3D malloc((nr_pfns + 4) * sizeof(*iov)); =20 - if ( !mfns || !types || !errors || !guest_data || !local_pages || !iov= ) + if ( !types || !errors || !guest_data || !local_pages || !iov ) { ERROR("Unable to allocate arrays for a batch of %u pages", nr_pfns); @@ -277,7 +275,6 @@ static int write_batch(struct xc_sr_context *ctx) free(guest_data); free(errors); free(types); - free(mfns); =20 return rc; }