From patchwork Wed Apr 26 15:54:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9701651 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 955DD60245 for ; Wed, 26 Apr 2017 15:59:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85BAD280CF for ; Wed, 26 Apr 2017 15:59:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A73B285EC; Wed, 26 Apr 2017 15:59:52 +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 1FCBE280CF for ; Wed, 26 Apr 2017 15:59:52 +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 1d3PKF-0006dK-5d; Wed, 26 Apr 2017 15:57:55 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3PKD-0006cj-EP for xen-devel@lists.xenproject.org; Wed, 26 Apr 2017 15:57:53 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id B5/6A-02005-083C0095; Wed, 26 Apr 2017 15:57:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42JxWrohUrfhMEO kQfsNfovvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPnnznMBes4Ky7evMLWwPiMvYuRk0NCwF9i +6KpjCA2m4CyxM/OXjYQW0RAT6LpwHOgOBcHs8A2RolVe74xgySEBYIkNh+9DFbEIqAq8ejgS 7A4r4CFxOMFF1kghspL7Gq7yApicwpYSrzbNw2sXgikZn4zlK0g0TH9GBNEr6DEyZlPwHqZBS QkDr54wTyBkXcWktQsJKkFjEyrGDWKU4vKUot0jcz0kooy0zNKchMzc3QNDYz1clOLixPTU3M Sk4r1kvNzNzECw6eegYFxB2PDXr9DjJIcTEqivOtXMEQK8SXlp1RmJBZnxBeV5qQWH2KU4eBQ kuD9dhAoJ1iUmp5akZaZAwxkmLQEB4+SCO8fkDRvcUFibnFmOkTqFKOilDiv6iGghABIIqM0D 64NFj2XGGWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKgnzMoNM4cnMK4Gb/gpoMRPQYhYXsMUliQ gpqQZGh09R5t9LahyYOUtW66p9usj+T1C5+1Gd6sF5qU6qiYHfWtntP+nNzX2mdcHD1GxbqWr j8v/qOw0ZJ7E+lE+Sm+S9NnNZUMjsko9ztzLZ5X5jm19vqfTkHsvLvaLtV33fPubwP/hi5exn klE+LvumHeT/GfT7zNS2fKOAlC8GK+1W/Sp9Jr9fiaU4I9FQi7moOBEAAgr1SpkCAAA= X-Env-Sender: prvs=28229795a=wei.liu2@citrix.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1493222270!97538252!1 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: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50021 invoked from network); 26 Apr 2017 15:57:51 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 26 Apr 2017 15:57:51 -0000 X-IronPort-AV: E=Sophos;i="5.37,255,1488844800"; d="scan'208";a="421143309" From: Wei Liu To: Xen-devel Date: Wed, 26 Apr 2017 16:54:46 +0100 Message-ID: <20170426155457.10799-2-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170426155457.10799-1-wei.liu2@citrix.com> References: <20170426155457.10799-1-wei.liu2@citrix.com> MIME-Version: 1.0 Cc: George Dunlap , Tim Deegan , Wei Liu , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH for-next v3 01/12] x86/mm: make free_perdomain_mappings idempotent 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 Signed-off-by: Wei Liu Reviewed-by: Andrew Cooper Acked-by: George Dunlap --- Cc: Tim Deegan Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/mm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index bd68e56dc7..cdef5c49c4 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -6503,9 +6503,14 @@ void destroy_perdomain_mapping(struct domain *d, unsigned long va, void free_perdomain_mappings(struct domain *d) { - l3_pgentry_t *l3tab = __map_domain_page(d->arch.perdomain_l3_pg); + l3_pgentry_t *l3tab; unsigned int i; + if ( !d->arch.perdomain_l3_pg ) + return; + + l3tab = __map_domain_page(d->arch.perdomain_l3_pg); + for ( i = 0; i < PERDOMAIN_SLOTS; ++i) if ( l3e_get_flags(l3tab[i]) & _PAGE_PRESENT ) { @@ -6544,6 +6549,7 @@ void free_perdomain_mappings(struct domain *d) unmap_domain_page(l3tab); free_domheap_page(d->arch.perdomain_l3_pg); + d->arch.perdomain_l3_pg = NULL; } #ifdef MEMORY_GUARD