From patchwork Thu Sep 21 12:40:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 113249 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp1846044edb; Thu, 21 Sep 2017 05:42:58 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAwW0HKPQF3jDm3fzdDtwBIyOqtSPwfsSm9MUIT82aLjrfLHT2lEfvEjUp1CeSO51eODZkO X-Received: by 10.36.17.196 with SMTP id 187mr1099539itf.101.1505997778453; Thu, 21 Sep 2017 05:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505997778; cv=none; d=google.com; s=arc-20160816; b=rBVqAAsbO9tiSOtwlSc/oEiM3C230JMAws2G4ZxhhhGwx9N1O4MUR3KEaTGZ6pHnJr GHf1agnInhvajftQ3jMrc5W2sbvSAAxqBrO9iq4+/7TkSkK34BaAAbWQ/ulSl+uucSSW rA34236/PVWg6hwbWDYt0LUQMlD+y7BXg8YKCq2cmYw9xmymddO4K1oPq2fRG5ofUeOj rZI6qqt8hE5o3zBR13te+h4MnZL802gq3cV4KicVBqlWeRUrbVvW5BFgt4T3OPctIK9O KwkMseA6pdqWH6cmptoXDKl1Vj/Zx/NRpOXbFDHndll6dm+irW0Ly1x10qcO5GGxZ+s0 5FGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=qRUBwg5229ZWaOkUP5pe8+iq4qP2DlTc5t83HSz0SIU=; b=tj2RtH9uMejCNQoZiKaRBqY0LZ5EtjCsr/v2/Q2bepDjloO5Dmp6pCNcY47vWgDaK4 iESPg4K+e0niMjaxQr27mncwMDZnsnxYC++bsiTzxCdeEDdRJWhDhfg/hMhFrPuGhy2V 3BJAaU2pcHx29S6SW6rKpkSV298rDRu6wiC05v73sN7tHNHljWRdLCVE3mFu1Ijn+Tgz FUlJetGrqwgJ8XJ+vOoYcDzLIZd4ZGrldPesUDk05vi4/4NC7aqea/gCYn8t3dKqzC+o D98wZNZbNyJ8KM/Cu8xIPUT9VGyYyYSqg6JX2ZyR6dQB+pNHoLcoqOIKqQWkM3zJtwrC sAwg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f12si1142630ioj.105.2017.09.21.05.42.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Sep 2017 05:42:58 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dv0mu-0001Tg-6C; Thu, 21 Sep 2017 12:41:04 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dv0mt-0001Qx-5c for xen-devel@lists.xen.org; Thu, 21 Sep 2017 12:41:03 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id EB/14-03610-E53B3C95; Thu, 21 Sep 2017 12:41:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTTd68+F Ig0VRFks+LmZxYPQ4uvs3UwBjFGtmXlJ+RQJrxoRl01kLJvNWzFw5g62B8SFnFyMXh5DAZkaJ y1snskE4pxklltzYw9rFyMnBJqApcefzJyYQW0RAWuLa58uMIEXMAosZJT7v72UGSQgLuEvcf NLGAmKzCKhK/HyylR3E5hWwlFi2+zJYXEJAXmJX20WwoZxA8bbD38BsIQELiV8TTrBOYORewM iwilG9OLWoLLVI11QvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyPQvwxAsINx+mX /Q4ySHExKoryu8w5HCvEl5adUZiQWZ8QXleakFh9ilOHgUJLgfbYAKCdYlJqeWpGWmQMMNJi0 BAePkgjvSpA0b3FBYm5xZjpE6hSjLkfHzbt/mIRY8vLzUqXEeT+DFAmAFGWU5sGNgAX9JUZZK WFeRqCjhHgKUotyM0tQ5V8xinMwKgFVLASawpOZVwK36RXQEUxAR2RvOAByREkiQkqqgXH79N 5jd/tKHgYbdr1lq+qw/PZq96KcLtYVa3OnrJGyutvr1iZ++I5SxRv5CY95mpN/2IabHk1Nm2B r/iXZ+u3MPx8sFJhWrtxhtEAj7DwLa9c1KdaVeuFHP2xMPBe2UWTKv6PXWb6c5lspca/blP+9 99VCk0e87VvEQu9cPvYpKE7nxUoFhXYlluKMREMt5qLiRADHLNJ6dQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1505997658!117078323!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60624 invoked from network); 21 Sep 2017 12:40:58 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-4.tower-27.messagelabs.com with SMTP; 21 Sep 2017 12:40:58 -0000 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 4FA4D1684; Thu, 21 Sep 2017 05:40:58 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3F9573F58C; Thu, 21 Sep 2017 05:40:57 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 21 Sep 2017 13:40:30 +0100 Message-Id: <20170921124035.2410-12-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170921124035.2410-1-julien.grall@arm.com> References: <20170921124035.2410-1-julien.grall@arm.com> Cc: George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH v2 11/16] xen/x86: p2m-pod: Clean-up p2m_pod_zero_check 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Signed-off-by: Julien Grall Acked-by: Andrew Cooper Reviewed-by: Wei Liu --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Changes in v2: - Add Andrew's acked-by --- xen/arch/x86/mm/p2m-pod.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 176d06cb42..611a087855 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -861,17 +861,19 @@ p2m_pod_zero_check(struct p2m_domain *p2m, unsigned long *gfns, int count) for ( i = 0; i < count; i++ ) { p2m_access_t a; + struct page_info *pg; mfns[i] = p2m->get_entry(p2m, _gfn(gfns[i]), types + i, &a, 0, NULL, NULL); + pg = mfn_to_page(mfns[i]); + /* * If this is ram, and not a pagetable or from the xen heap, and * probably not mapped elsewhere, map it; otherwise, skip. */ - if ( p2m_is_ram(types[i]) - && ( (mfn_to_page(mfns[i])->count_info & PGC_allocated) != 0 ) - && ( (mfn_to_page(mfns[i])->count_info & (PGC_page_table|PGC_xen_heap)) == 0 ) - && ( (mfn_to_page(mfns[i])->count_info & PGC_count_mask) <= max_ref ) ) + if ( p2m_is_ram(types[i]) && (pg->count_info & PGC_allocated) && + ((pg->count_info & (PGC_page_table | PGC_xen_heap)) == 0) && + ((pg->count_info & (PGC_count_mask)) <= max_ref) ) map[i] = map_domain_page(mfns[i]); else map[i] = NULL;