From nobody Thu Apr 25 14:44:36 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1557837147; cv=none; d=zoho.com; s=zohoarc; b=Xv6MM/Jp9OTL5mmKE9ELpgC5q4dZB3eJtROBpd9+p9YNZm6EfTagVZ7/rWdQ8yDE0PoCWD2Y5D7ikksm+q93BeuOqEDiIr8nOAQgboB5M6gGODOYvsunVVFIuUOYfl8zRzVX2HZHxGf3jElp/8f2Rs3m7yBmRdq0V0KJiUh7o3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557837147; h=Content-Type: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:ARC-Authentication-Results; bh=C4BrL4lMuSUFy2yyQfrathgWRBWylzhjV7bD6DZgLuY=; b=Lws9I1cBqSY5FTKE7hTgW1YqU8VpZADEKhEMugMJx5VAE7rxeQNgrSr3sxrlBZ9ZLJItQBBz0aGGuRxDRzfMJB/VLHS6DpQOFIG2dH/E+GHGy2QGajoxFAj7zigQp/FoOkaP+xoRMUYCFDKcueIf2meY3dx5LS7hr8ZqLhWc81M= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 1557837147460332.1525257603039; Tue, 14 May 2019 05:32:27 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hQWap-0005MA-9c; Tue, 14 May 2019 12:31:39 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hQWao-0005Le-0o for xen-devel@lists.xenproject.org; Tue, 14 May 2019 12:31:38 +0000 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 377b0a74-7644-11e9-8980-bc764e045a96; Tue, 14 May 2019 12:31:37 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1FBEB15AB; Tue, 14 May 2019 05:31:37 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E08DF3F71E; Tue, 14 May 2019 05:31:35 -0700 (PDT) X-Inumbo-ID: 377b0a74-7644-11e9-8980-bc764e045a96 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 14 May 2019 13:31:17 +0100 Message-Id: <20190514123125.29086-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190514123125.29086-1-julien.grall@arm.com> References: <20190514123125.29086-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH MM-PART3 v2 04/12] xen/arm: mm: Only increment mfn when valid in xen_pt_update X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr_Tyshchenko@epam.com, Julien Grall , Stefano Stabellini , Andrii Anisov MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Currently, the MFN will be incremented even if it is invalid. This will result to have a valid MFN after the first iteration. While this is not a major problem today, this will be in the future if the code expect an invalid MFN at every iteration. Such behavior is prevented by avoiding to increment an invalid MFN. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- Changes in v2: - Move the patch earlier on in the series - Add Andrii's reviewed-by --- xen/arch/arm/mm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index f956aa6399..9de2a1150f 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1051,11 +1051,14 @@ static int xen_pt_update(enum xenmap_operation op, =20 spin_lock(&xen_pt_lock); =20 - for(; addr < addr_end; addr +=3D PAGE_SIZE, mfn =3D mfn_add(mfn, 1)) + for( ; addr < addr_end; addr +=3D PAGE_SIZE ) { rc =3D xen_pt_update_entry(op, addr, mfn, flags); if ( rc ) break; + + if ( !mfn_eq(mfn, INVALID_MFN) ) + mfn =3D mfn_add(mfn, 1); } =20 /* --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel