From patchwork Thu Sep 14 12:58:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9953113 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 459D260317 for ; Thu, 14 Sep 2017 13:31:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4062328D99 for ; Thu, 14 Sep 2017 13:31:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3532928E0B; Thu, 14 Sep 2017 13:31:14 +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 BB74028D99 for ; Thu, 14 Sep 2017 13:31:13 +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 1dsUCa-0008L2-0I; Thu, 14 Sep 2017 13:29:08 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dsUCZ-0008H9-9n for xen-devel@lists.xenproject.org; Thu, 14 Sep 2017 13:29:07 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id BB/6D-17770-2248AB95; Thu, 14 Sep 2017 13:29:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRWlGSWpSXmKPExsXitHSDva5iy65 Ig1uTmCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oz+xp/MBf0qFfePzmBrYFwi3cXIySEh4C+x qf8HC4jNJqAs8bOzlw3EFhHQk2g68Jyxi5GLg1lgDqPE1LldjCAJYQFPiTMXDoMVsQioSuy5M IEZxOYVsJRov7OVGWKovMSutousIDYnULzrw0smEFtIwEKi99J+dghbQaJj+jEmiF5BiZMzn4 AdwSwgIXHwxQvmCYy8s5CkZiFJLWBkWsWoUZxaVJZapGtoppdUlJmeUZKbmJmja2hgppebWly cmJ6ak5hUrJecn7uJERg+DECwg/H+xoBDjJIcTEqivHt1d0YK8SXlp1RmJBZnxBeV5qQWH2KU 4eBQkuA927QrUkiwKDU9tSItMwcYyDBpCQ4eJRHe+yBp3uKCxNzizHSI1ClGXY6Om3f/MAmx5 OXnpUqJ82o3AxUJgBRllObBjYBF1SVGWSlhXkago4R4ClKLcjNLUOVfMYpzMCoJ814GWcWTmV cCt+kV0BFMQEecOb0D5IiSRISUVAOj0oFcBttK4VfnGm5aMJ3crlAyofzAlx5Pf6cC89DkgHP Z30qmnPYrdTy1gGHay2KBu7yzf6128Bbbsuv3MYEzs61emvusDpMtkG9o25ya//vZmVbfvdr+ vy+csTgp7SuVpuO0nuWOzvKTL/UbItN+/M5hST7/f4vj8rU/Hlot37fKnE9uyp2HSizFGYmGW sxFxYkAUBFjVKUCAAA= X-Env-Sender: prvs=423b67c62=wei.liu2@citrix.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1505395741!107245321!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15188 invoked from network); 14 Sep 2017 13:29:04 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 14 Sep 2017 13:29:04 -0000 X-IronPort-AV: E=Sophos;i="5.42,393,1500940800"; d="scan'208";a="447841054" From: Wei Liu To: Xen-devel Date: Thu, 14 Sep 2017 13:58:45 +0100 Message-ID: <20170914125852.22129-17-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170914125852.22129-1-wei.liu2@citrix.com> References: <20170914125852.22129-1-wei.liu2@citrix.com> MIME-Version: 1.0 Cc: George Dunlap , Andrew Cooper , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH v5 16/23] x86/mm: add pv prefix to {alloc, free}_page_type 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 And move the declarations to pv/mm.h. The code will be moved later. The stubs contain BUG() because they aren't supposed to be called when PV is disabled. Signed-off-by: Wei Liu --- xen/arch/x86/domain.c | 2 +- xen/arch/x86/mm.c | 14 +++++++------- xen/include/asm-x86/mm.h | 3 --- xen/include/asm-x86/pv/mm.h | 12 ++++++++++++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index e9367bd8aa..3abd37e4dc 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1812,7 +1812,7 @@ static int relinquish_memory( if ( likely(y == x) ) { /* No need for atomic update of type_info here: noone else updates it. */ - switch ( ret = free_page_type(page, x, 1) ) + switch ( ret = pv_free_page_type(page, x, 1) ) { case 0: break; diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 3a919c19b8..86c7466fa0 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1987,8 +1987,8 @@ static void get_page_light(struct page_info *page) while ( unlikely(y != x) ); } -static int alloc_page_type(struct page_info *page, unsigned long type, - int preemptible) +int pv_alloc_page_type(struct page_info *page, unsigned long type, + int preemptible) { struct domain *owner = page_get_owner(page); int rc; @@ -2017,7 +2017,7 @@ static int alloc_page_type(struct page_info *page, unsigned long type, rc = alloc_segdesc_page(page); break; default: - printk("Bad type in alloc_page_type %lx t=%" PRtype_info " c=%lx\n", + printk("Bad type in %s %lx t=%" PRtype_info " c=%lx\n", __func__, type, page->u.inuse.type_info, page->count_info); rc = -EINVAL; @@ -2061,8 +2061,8 @@ static int alloc_page_type(struct page_info *page, unsigned long type, } -int free_page_type(struct page_info *page, unsigned long type, - int preemptible) +int pv_free_page_type(struct page_info *page, unsigned long type, + int preemptible) { struct domain *owner = page_get_owner(page); unsigned long gmfn; @@ -2119,7 +2119,7 @@ int free_page_type(struct page_info *page, unsigned long type, static int __put_final_page_type( struct page_info *page, unsigned long type, int preemptible) { - int rc = free_page_type(page, type, preemptible); + int rc = pv_free_page_type(page, type, preemptible); /* No need for atomic update of type_info here: noone else updates it. */ if ( rc == 0 ) @@ -2337,7 +2337,7 @@ static int __get_page_type(struct page_info *page, unsigned long type, page->nr_validated_ptes = 0; page->partial_pte = 0; } - rc = alloc_page_type(page, type, preemptible); + rc = pv_alloc_page_type(page, type, preemptible); } if ( (x & PGT_partial) && !(nx & PGT_partial) ) diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index f2e0f498c4..56b2b94195 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -326,9 +326,6 @@ static inline void *__page_to_virt(const struct page_info *pg) (PAGE_SIZE / (sizeof(*pg) & -sizeof(*pg)))); } -int free_page_type(struct page_info *page, unsigned long type, - int preemptible); - bool fill_ro_mpt(mfn_t mfn); void zap_ro_mpt(mfn_t mfn); diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/asm-x86/pv/mm.h index 4944a70c7a..0cd8beec39 100644 --- a/xen/include/asm-x86/pv/mm.h +++ b/xen/include/asm-x86/pv/mm.h @@ -32,6 +32,11 @@ bool pv_map_ldt_shadow_page(unsigned int off); void pv_arch_init_memory(void); +int pv_alloc_page_type(struct page_info *page, unsigned long type, + int preemptible); +int pv_free_page_type(struct page_info *page, unsigned long type, + int preemptible); + #else #include @@ -51,6 +56,13 @@ static inline bool pv_map_ldt_shadow_page(unsigned int off) { return false; } static inline void pv_arch_init_memory(void) {} +static inline int pv_alloc_page_type(struct page_info *page, unsigned long type, + int preemptible) +{ BUG(); return -EINVAL; } +static inline int pv_free_page_type(struct page_info *page, unsigned long type, + int preemptible) +{ BUG(); return -EINVAL; } + #endif #endif /* __X86_PV_MM_H__ */