From patchwork Thu Sep 21 12:40:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9963841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 050776056A for ; Thu, 21 Sep 2017 12:43:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED612294C6 for ; Thu, 21 Sep 2017 12:43:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2568294C9; Thu, 21 Sep 2017 12:43:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 731F6294C6 for ; Thu, 21 Sep 2017 12:43:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dv0mx-0001ZT-QT; Thu, 21 Sep 2017 12:41:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dv0mw-0001W9-Ma for xen-devel@lists.xen.org; Thu, 21 Sep 2017 12:41:06 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 89/3A-16615-163B3C95; Thu, 21 Sep 2017 12:41:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysyfVTTdh8+F Ig6ktUhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8benk/MBSfVK04euMvYwHhbpouRi0NIYDOj xIfLV9ghnNOMEscm/AVyODnYBDQl7nz+xARiiwhIS1z7fJkRpIhZYDGjxOf9vcwgCWGBcImfi 9aBFbEIqEpMnNwL1swrYCkxa/5NsLiEgLzErraLrCA2J1C87fA3MFtIwELi14QTrBMYuRcwMq xi1ChOLSpLLdI1NNBLKspMzyjJTczMAfLM9HJTi4sT01NzEpOK9ZLzczcxAn3MAAQ7GI+/jzv EKMnBpCTKq8N1OFKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG85L1BOsCg1PbUiLTMHGGwwaQkO HiURXm4+oDRvcUFibnFmOkTqFKMuR8fNu3+YhFjy8vNSpcR5e0FmCIAUZZTmwY2ABf4lRlkpY V5GoKOEeApSi3IzS1DlXzGKczAqCfPeApnCk5lXArfpFdARTEBHZG84AHJESSJCSqqBMead1D WvsNk5p3/kaB3nyyoIaPfTVlI6b7lD/1CiWmdnfNdD/sa1KVIsuWXale+mvkz5GaLxLOvU7rR Zq5ubDN98OGP7jk3+7gXjLXqpPCemsR3iXtYn+KfpY/1+h+l50hVWfCJCMk/ZpNhufzXhyd6t XM9dd9moLGiCzOvHF2LuqxblrM1UYinOSDTUYi4qTgQAQlf5THcCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1505997663!117078355!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 61698 invoked from network); 21 Sep 2017 12:41:04 -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:41:04 -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 9315D1684; Thu, 21 Sep 2017 05:41:03 -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 83CA93F58C; Thu, 21 Sep 2017 05:41:02 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 21 Sep 2017 13:40:34 +0100 Message-Id: <20170921124035.2410-16-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 15/16] 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" X-Virus-Scanned: ClamAV using ClamSMTP - 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 --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper 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 311762b1ce..89b7dc949d 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