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: 113247 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp1846011edb; Thu, 21 Sep 2017 05:42:57 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDUzG83mI5Klby0UGC/QiVxw6mJYunR4u6f9m2mTIgJJpae38AaW5GkfE+VKA63HxUcCuye X-Received: by 10.36.58.149 with SMTP id m143mr1351952itm.4.1505997776962; Thu, 21 Sep 2017 05:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505997776; cv=none; d=google.com; s=arc-20160816; b=JgcA9bQQma2LsdFYO2ovgs7LOQoIVHUd53LQnQrNEM0jQQXMXicF4Sv+DRsRqHWXpo Lx5WFgxXUMgxr73I0RXmqLoodYmlZbtqcFdH3KWtTB5CiHIiBN5SEQVmV7pqa2DHjfSW t8kT3uLgtPlEoZyHd7u4oMmvM9+ZYP8g4pKD1UrxrCQq9IoFID4rqBtUo6XdiGYPUnp0 bsIQuEUx6v1md2fdkFxicVoep8HhU9rAGLMrDhS6kIUP8asbGlI/1imsHCpk4zXg8JZ6 2eGvGlheJ5LK6ChhQBIRIjQnjOCHYZvu4/LlZR6fTFr0tpXQXNhalZTLsz1ixFtEX36q 2ldw== 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=GvTfBOprxfa7sbX0X2+TJ0SxFhucPpUMNie5/Hth55E=; b=QZCsb//y3fbt77OUId1CAN5wPxoti8AS57OlptRsqM+gi1Oy4zyJrTqklSNK1gEbJE h6urHxZWCDQZYLqCshPVzYGOe/lyd+jxZhmy4J2go9Ozpwt9n5Fa/t8iintcLND9zNog 6rwipcxtAHSk00PQkmERW4sMTkVcavQsVt9CdLmqQjDHh6sx4RP7lB/u+GCGhua1PzbO vAp7VIUPbBv8YQOrAuIJ7DiDJ2gXsIQ4rnGbXLoxUDl9ev9JPUFcIRvvhr/M/6Yk1w+N KccY5Ub7St+VmNIJ31N//kfrY5YsDiYs7P59pfQeuy/HgR/5pQvq508xnWM6jNG0xSXq 6mjA== 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 h130si1130754ioa.94.2017.09.21.05.42.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Sep 2017 05:42:56 -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 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" - 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