From patchwork Mon Oct 2 12:59:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 114607 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp653902qgn; Mon, 2 Oct 2017 06:02:11 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDCgATiKNOIi4qunsPFlgJVUf2dP0JY7MzocDJStNfxTEUTznYi33oycCGKhRTAgyAqVDeu X-Received: by 10.36.122.70 with SMTP id a67mr17934624itc.99.1506949330932; Mon, 02 Oct 2017 06:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506949330; cv=none; d=google.com; s=arc-20160816; b=yKz4cMJCQYGFEZ7YWqv4/ti4/D7NTnMh1ToM2dwRHI+vyjIYO9LXomiiMKA2292kA5 H7LWUBg6QP//DTqKwJcbRamHqVGdkTNRwtId2dhVz3AsQiWA2SCbG8mVB1JMCryZn2/+ 2sWdw9re3ZFu2FEdaOswQkWoRR2FuxdUVspJKs2QcLL+4e+hIGY9xFvXlS9VXf7jiVDY RpJsg7MwwWHl0oL8v1LNma5vapeOok22/sVnw3Su1hx+cENlxW8Hxv9gIZjhshhb4gVn ZDTsii56O6SZMwjc2X+6JDusK+zRn8iH0wTilziedCQWZObvZG++Pfd8S/quv6auYhaw 6pGA== 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=VpF/GW0MDPH8T1ifcXSgHhytw6f3PUk6QPh5o0Dc1Pg=; b=mltmXDTDCsSV3uo3bk//+qSrIoqhRoU6fidDI6ZQ7SGiLaHDxZ+n13wFRjoPvvmjN8 zFTRtiqJWcG1wOmQaNI1dE/tkBtM/FNxFoxhukKRalpnwl+nCo8523SQTLMZ2c9tsPwf C94Zez0Sulk8VpzIUhyYTqERRLyyiQ+BknhREtjXBDUOTrbIP0Y5jN9QY2gpCNAkgHYc sSOhzLl9+U81OWcodOpAv1wmoxNI/6OOeaOXacmseU0ZxrMozCyws6m6ZhVSv19aB+Jn kcdeW6aHrPuTDKk3YEzMx+qZIkRt2ZuD1ZpkJnOiKRSjdLZ9JZ7MNh3mtOFKmwR/vsLr qVjQ== 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 r193si1002760itc.73.2017.10.02.06.02.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 06:02:10 -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 1dz0KT-0004Km-NR; Mon, 02 Oct 2017 13:00:13 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz0KS-0004Hr-1b for xen-devel@lists.xen.org; Mon, 02 Oct 2017 13:00:12 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 7E/45-02817-B5832D95; Mon, 02 Oct 2017 13:00:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysyfVTTfK4lK kwd6n5hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aplnVsBSs0Kro+72JrYFwk28XIxSEksIlR 4snFRUwQzmlGiaNtG5i7GDk52AQ0Je58/sQEYosISEtc+3yZEaSIWWAxo8Tn/b1gRcIC4RIbf 7xhBLFZBFQlXvVNBIvzClhJvLt2GMyWEJCX2NV2kRXE5gSKvz/+EcwWErCUON49iWkCI/cCRo ZVjBrFqUVlqUW6huZ6SUWZ6RkluYmZObqGBqZ6uanFxYnpqTmJScV6yfm5mxiBPmYAgh2MF09 7HmKU5GBSEuVlNrwUKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCV8McKCdYlJqeWpGWmQMMNpi0 BAePkgivKUiat7ggMbc4Mx0idYpRl6Pj5t0/TEIsefl5qVLivP/NgIoEQIoySvPgRsAC/xKjr JQwLyPQUUI8BalFuZklqPKvGMU5GJWEeV1AVvFk5pXAbXoFdAQT0BFzui6AHFGSiJCSamCcGn FscULp91ZnKxanmisC9Tx+JzSqjHVWZJnap/adZD18YP3pezv4Xkd7ZZblJv7S8mI8pOIbwiQ 4b9IFl6254Sw7urYE3Wu8onnk4ALG6G2rFu91MCtxtXcN2iA2gc3t86mtP2T+3/FRnuJ1iHnH E+llE1zcD63uObTb92kYS+bidI00vfdKLMUZiYZazEXFiQAecCrQdwIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1506949210!112539094!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 65166 invoked from network); 2 Oct 2017 13:00:10 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-206.messagelabs.com with SMTP; 2 Oct 2017 13:00:10 -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 013EE80D; Mon, 2 Oct 2017 06:00:10 -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 E671E3F53D; Mon, 2 Oct 2017 06:00:08 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 2 Oct 2017 13:59:41 +0100 Message-Id: <20171002125941.11274-16-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 15/15] xen/x86: p2m-pod: Rework prototype of p2m_pod_demand_populate 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" - Switch the return type to bool - Remove the parameter p2m_query_t q as it is not used Signed-off-by: Julien Grall Acked-by: Andrew Cooper Reviewed-by: Wei Liu Reviewed-by: George Dunlap --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Changes in v3: - Add Wei's reviewed-by Changes in v2: - Add Andrew's acked-by --- xen/arch/x86/mm/p2m-ept.c | 4 ++-- xen/arch/x86/mm/p2m-pod.c | 15 +++++++-------- xen/arch/x86/mm/p2m-pt.c | 6 +++--- xen/include/asm-x86/p2m.h | 6 ++---- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index bc25582c5a..054827aa88 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -965,7 +965,7 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m, index = gfn_remainder >> ( i * EPT_TABLE_ORDER); ept_entry = table + index; - if ( !p2m_pod_demand_populate(p2m, gfn_, i * EPT_TABLE_ORDER, q) ) + if ( p2m_pod_demand_populate(p2m, gfn_, i * EPT_TABLE_ORDER) ) goto retry; else goto out; @@ -987,7 +987,7 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m, ASSERT(i == 0); - if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K, q) ) + if ( !p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K) ) goto out; } diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c index 8d50a0db85..0a811ccf28 100644 --- a/xen/arch/x86/mm/p2m-pod.c +++ b/xen/arch/x86/mm/p2m-pod.c @@ -1075,10 +1075,9 @@ static void pod_eager_record(struct p2m_domain *p2m, gfn_t gfn, mrp->idx %= ARRAY_SIZE(mrp->list); } -int +bool p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, - unsigned int order, - p2m_query_t q) + unsigned int order) { struct domain *d = p2m->domain; struct page_info *p = NULL; /* Compiler warnings */ @@ -1116,7 +1115,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, */ p2m_set_entry(p2m, gfn_aligned, INVALID_MFN, PAGE_ORDER_2M, p2m_populate_on_demand, p2m->default_access); - return 0; + return true; } /* Only reclaim if we're in actual need of more cache. */ @@ -1178,7 +1177,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, } pod_unlock(p2m); - return 0; + return true; out_of_memory: pod_unlock(p2m); @@ -1186,10 +1185,10 @@ out_of_memory: __func__, d->domain_id, d->tot_pages, p2m->pod.entry_count, current->domain->domain_id); domain_crash(d); - return -1; + return false; out_fail: pod_unlock(p2m); - return -1; + return false; remap_and_retry: BUG_ON(order != PAGE_ORDER_2M); pod_unlock(p2m); @@ -1215,7 +1214,7 @@ remap_and_retry: __trace_var(TRC_MEM_POD_SUPERPAGE_SPLINTER, 0, sizeof(t), &t); } - return 0; + return true; } diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c index a639a00e9c..50637083f4 100644 --- a/xen/arch/x86/mm/p2m-pt.c +++ b/xen/arch/x86/mm/p2m-pt.c @@ -802,7 +802,7 @@ pod_retry_l3: { if ( q & P2M_ALLOC ) { - if ( !p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_1G, q) ) + if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_1G) ) goto pod_retry_l3; gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", __func__); } @@ -844,7 +844,7 @@ pod_retry_l2: if ( p2m_flags_to_type(flags) == p2m_populate_on_demand ) { if ( q & P2M_ALLOC ) { - if ( !p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_2M, q) ) + if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_2M) ) goto pod_retry_l2; } else *t = p2m_populate_on_demand; @@ -883,7 +883,7 @@ pod_retry_l1: if ( l1t == p2m_populate_on_demand ) { if ( q & P2M_ALLOC ) { - if ( !p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K, q) ) + if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K) ) goto pod_retry_l1; } else *t = p2m_populate_on_demand; diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index e8a9dca480..70f00c332f 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -719,10 +719,8 @@ extern void audit_p2m(struct domain *d, #endif /* Called by p2m code when demand-populating a PoD page */ -int -p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, - unsigned int order, - p2m_query_t q); +bool +p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, unsigned int order); /* * Functions specific to the p2m-pt implementation