From patchwork Tue Sep 27 15:56:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9352187 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 D80CE60757 for ; Tue, 27 Sep 2016 16:00:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA0FB2927A for ; Tue, 27 Sep 2016 16:00:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEE122928A; Tue, 27 Sep 2016 16:00:51 +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 048AB2928B for ; Tue, 27 Sep 2016 16:00:46 +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 1boulh-0007MX-A8; Tue, 27 Sep 2016 15:58:05 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boulg-0007Lj-14 for xen-devel@lists.xenproject.org; Tue, 27 Sep 2016 15:58:04 +0000 Received: from [85.158.143.35] by server-6.bemta-6.messagelabs.com id 27/1F-11175-B079AE75; Tue, 27 Sep 2016 15:58:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRWlGSWpSXmKPExsXitHRDpC7X9Ff hBu07rCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyJm/0LFihUHPjdy9zAeEiyi5GTQ0LAX6Lh 7BlmEJtNQEfi4tydbF2MHBwiAioSt/cadDFycTAL/GGU2DrlNliNsECCxLwZE1hBbBYBVYkL3 3Yzgti8Ai4S99+9ZISYqSvx8NxvsBpOAVeJ3rYFTCC2EFDN3ZkfWSHqBSVOznzCAmIzC2hKtG 7/zQ5hy0s0b53NDFGvKNE/7wEbxExuidunpzJPYOSfhaR9FpL2WUjaFzAyr2LUKE4tKkst0jU y1ksqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECAxBBiDYwfhnfuAhRkkOJiVRXo32 V+FCfEn5KZUZicUZ8UWlOanFhxhlODiUJHg9pgLlBItS01Mr0jJzgNEAk5bg4FES4eUESfMWF yTmFmemQ6ROMSpKifM2gCQEQBIZpXlwbbAIvMQoKyXMywh0iBBPQWpRbmYJqvwrRnEORiVhXh GQKTyZeSVw018BLWYCWrz0xAuQxSWJCCmpBkZ/r9zWKnlvc46Va85cd+6d8zZ/+3K96tjUsi+ 1H10kVqbOy976Z/blK3xuEQU5eRxh39p1zmrM3Cf6YOq6s68XR4W/WLumu/GX9uUj9YmLt/2+ m/9Q/SGzWv562d99gUGblOvud6U8DZ7L9/PnyZ8JlRl37zEcWvH69s9GUZmZvg9UVNi7uhyVW IozEg21mIuKEwGpGwCiuwIAAA== X-Env-Sender: prvs=071b8e69e=roger.pau@citrix.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1474991877!29175510!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14230 invoked from network); 27 Sep 2016 15:58:02 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 27 Sep 2016 15:58:02 -0000 X-IronPort-AV: E=Sophos;i="5.30,405,1470700800"; d="scan'208";a="380934219" From: Roger Pau Monne To: Date: Tue, 27 Sep 2016 17:56:58 +0200 Message-ID: <1474991845-27962-4-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) In-Reply-To: <1474991845-27962-1-git-send-email-roger.pau@citrix.com> References: <1474991845-27962-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: George Dunlap , Andrew Cooper , Tim Deegan , Jan Beulich , boris.ostrovsky@oracle.com, Roger Pau Monne Subject: [Xen-devel] [PATCH v2 03/30] xen/x86: fix parameters and return value of *_set_allocation functions 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Return should be an int, and the number of pages should be an unsigned long. Signed-off-by: Roger Pau Monné Acked-by: George Dunlap --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Cc: Tim Deegan --- xen/arch/x86/mm/hap/hap.c | 6 +++--- xen/arch/x86/mm/shadow/common.c | 7 +++---- xen/include/asm-x86/domain.h | 12 ++++++------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index 3218fa2..b6d2c61 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -325,7 +325,7 @@ static void hap_free_p2m_page(struct domain *d, struct page_info *pg) static unsigned int hap_get_allocation(struct domain *d) { - unsigned int pg = d->arch.paging.hap.total_pages + unsigned long pg = d->arch.paging.hap.total_pages + d->arch.paging.hap.p2m_pages; return ((pg >> (20 - PAGE_SHIFT)) @@ -334,8 +334,8 @@ hap_get_allocation(struct domain *d) /* Set the pool of pages to the required number of pages. * Returns 0 for success, non-zero for failure. */ -static unsigned int -hap_set_allocation(struct domain *d, unsigned int pages, int *preempted) +static int +hap_set_allocation(struct domain *d, unsigned long pages, int *preempted) { struct page_info *pg; diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 21607bf..d3cc2cc 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1613,9 +1613,8 @@ shadow_free_p2m_page(struct domain *d, struct page_info *pg) * Input will be rounded up to at least shadow_min_acceptable_pages(), * plus space for the p2m table. * Returns 0 for success, non-zero for failure. */ -static unsigned int sh_set_allocation(struct domain *d, - unsigned int pages, - int *preempted) +static int sh_set_allocation(struct domain *d, unsigned long pages, + int *preempted) { struct page_info *sp; unsigned int lower_bound; @@ -1692,7 +1691,7 @@ static unsigned int sh_set_allocation(struct domain *d, /* Return the size of the shadow pool, rounded up to the nearest MB */ static unsigned int shadow_get_allocation(struct domain *d) { - unsigned int pg = d->arch.paging.shadow.total_pages + unsigned long pg = d->arch.paging.shadow.total_pages + d->arch.paging.shadow.p2m_pages; return ((pg >> (20 - PAGE_SHIFT)) + ((pg & ((1 << (20 - PAGE_SHIFT)) - 1)) ? 1 : 0)); diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 5807a1f..11ac2a5 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -93,9 +93,9 @@ struct shadow_domain { /* Memory allocation */ struct page_list_head freelist; - unsigned int total_pages; /* number of pages allocated */ - unsigned int free_pages; /* number of pages on freelists */ - unsigned int p2m_pages; /* number of pages allocates to p2m */ + unsigned long total_pages; /* number of pages allocated */ + unsigned long free_pages; /* number of pages on freelists */ + unsigned long p2m_pages; /* number of pages allocates to p2m */ /* 1-to-1 map for use when HVM vcpus have paging disabled */ pagetable_t unpaged_pagetable; @@ -155,9 +155,9 @@ struct shadow_vcpu { /************************************************/ struct hap_domain { struct page_list_head freelist; - unsigned int total_pages; /* number of pages allocated */ - unsigned int free_pages; /* number of pages on freelists */ - unsigned int p2m_pages; /* number of pages allocates to p2m */ + unsigned long total_pages; /* number of pages allocated */ + unsigned long free_pages; /* number of pages on freelists */ + unsigned long p2m_pages; /* number of pages allocates to p2m */ }; /************************************************/