From patchwork Mon Oct 2 12:59:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114605 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp653719qgn; Mon, 2 Oct 2017 06:02:05 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBcBYwF6e542PHAAQdAsBCVxjMNq2SLmk87o7xW1RovTTQAufZt0dg9HG16Kl5xW7bf1ewj X-Received: by 10.202.56.10 with SMTP id f10mr7282265oia.396.1506949325255; Mon, 02 Oct 2017 06:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506949325; cv=none; d=google.com; s=arc-20160816; b=NiIlOqSng1cOu8YZ18yIHvxczU6PJAOc5T6ouh9ygEp0hE6gYfb+9YWStsAgcokqX9 ThN6sUDnuROrfIj6nmgG4t29f80jKXRX9IRjWSwsM1Lv6C6X1Mim5biV1m4yKMwQYbHQ sS+lXKWuUb68wBX0FARDAi+L+NEm5pi8XetuGrtgitY24RNIKwIWAUVqpBADJlJhR9Zb AckVtqrCM7a9ppb0k6N1SrZo14tVipkzIzip6RzWV5NubFtjK+ZcuntCPo9bTMXaF1FL ARqkRgWj0XntqG/ehQJxTZfNSKoPWbcwBY0QqveJksQ6mtPUNip3Tg+Rdc+pLnZ5Vs+Q wnvQ== 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=1QjRkiDn8ruQbr1shDCskNhaiq1BJRMrXXfSaZfT4HQ=; b=neIawOzwthgG+NqyfA7Bgcfvjbg5Y6pflvA/56g/RIN3bqWgxkxWbZH58Pg/ULPoG9 cm+QZRbYaEHisBex+Gwes3b6ZzH+tO0Mke+sTN5rufbCk1OzrekNNiLfAusKVAPRMOj+ y8IqhFGr0l1C2kYCgM+pbeNk6oDyxBzl83P5tZ8cWmbiO5v45Cb00jGbtbh8gNJyfPYX DQE4xlAm/gleYZhOcEPSQ7TK8Qxf63nhvUdKVdL4rhsrhlfGSHHueVrIbzZyK1y6+SPz PL5+A6JIKMS7r5aTwof6RLUVvDfgGPIhLuR/dz8iVNdolQTKEf5kQTC0R5i/cu9iugP3 Y97w== 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 r184si9242037iod.208.2017.10.02.06.02.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 06:02:05 -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 1dz0KR-0004GS-02; Mon, 02 Oct 2017 13:00:10 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz0KP-0004DW-Kv for xen-devel@lists.xen.org; Mon, 02 Oct 2017 13:00:09 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id D9/80-03093-85832D95; Mon, 02 Oct 2017 13:00:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTTfU4lK kwcsPkhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8brfbPYC17yVqyedJyxgXEaVxcjF4eQwGZG iR+TX7BAOKcZJaZ8msrUxcjJwSagKXHn8ycwW0RAWuLa58uMIEXMAosZJT7v72XuYuTgEBZwl 7j2ugikhkVAVWLBvweMIDavgJXEu1snwWwJAXmJXW0XWUFsTqD4++MfwWwhAUuJ492TmCYwci 9gZFjFqFGcWlSWWqRrbKyXVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iRHoYQYg2MG 4c33gIUZJDiYlUV5mw0uRQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4NcyBcoJFqempFWmZOcBQ g0lLcPAoifCagqR5iwsSc4sz0yFSpxh1OTpu3v3DJMSSl5+XKiXO+98MqEgApCijNA9uBCzsL zHKSgnzMgIdJcRTkFqUm1mCKv+KUZyDUUmY1wVkFU9mXgncpldARzABHTGn6wLIESWJCCmpBs Yrcmvmp/+ofDHVOeist6WG/4npEc+z1zlfYQ7oOWsm/+5ytPW14unBBx7UVK8Idr52oONdzuL I5cWl31+cv3XOONnioukXj33tn0/l18wV536w2CZ+3u3Mo9MWFxd5MrJ91CyI1d49f9rtWfwf TnxPlra4MbMpzqF0jdGCdjWhH2J7GTyl1skrsRRnJBpqMRcVJwIAxfxDVnYCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1506949204!82141557!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 57315 invoked from network); 2 Oct 2017 13:00:05 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-21.messagelabs.com with SMTP; 2 Oct 2017 13:00:05 -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 B218A1682; Mon, 2 Oct 2017 06:00:04 -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 A30723F53D; Mon, 2 Oct 2017 06:00:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 2 Oct 2017 13:59:37 +0100 Message-Id: <20171002125941.11274-12-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171002125941.11274-1-julien.grall@arm.com> References: <20171002125941.11274-1-julien.grall@arm.com> Cc: George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH v3 11/15] 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: George Dunlap --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Changes in v3: - Replace (foo == 0) by !foo - Remove uneeded parentheses 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..6581f8d82f 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)) && + ((pg->count_info & PGC_count_mask) <= max_ref) ) map[i] = map_domain_page(mfns[i]); else map[i] = NULL;