From patchwork Fri Sep 29 15:01:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Dunlap X-Patchwork-Id: 9978259 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 1774D60311 for ; Fri, 29 Sep 2017 15:04:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A1732766D for ; Fri, 29 Sep 2017 15:04:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F32B028448; Fri, 29 Sep 2017 15:04:19 +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 A9CDB2766D for ; Fri, 29 Sep 2017 15:04:19 +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 1dxwnu-0003hp-4Z; Fri, 29 Sep 2017 15:02:14 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxwns-0003gO-NW for xen-devel@lists.xenproject.org; Fri, 29 Sep 2017 15:02:12 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id CA/AB-03414-2706EC95; Fri, 29 Sep 2017 15:02:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrrBXrco4Vy kwaxeRYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNeP3oT7WglW8FTu397I0MDZxdzFyckgI+Eus vbeIEcRmE9CTmHf8K0sXIweHiICKxO29BiAms0ClxKlZySAVwgK2Em3fJzGB2CwCqhLHjzxmB bF5BWwklh/fywwxUV7i3IPbYDYnUP2m/m4wWwio5tm1u+wQtqrE4gdH2SF6BSVOznzCAmIzC0 hIHHzxgnkCI+8sJKlZSFILGJlWMWoUpxaVpRbpGhroJRVlpmeU5CZm5gB5Znq5qcXFiempOYl JxXrJ+bmbGIGBwwAEOxiPv487xCjJwaQkyisQey5SiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTv xnignGBRanpqRVpmDjCEYdISHDxKIrx7QNK8xQWJucWZ6RCpU4y6HB037/5hEmLJy89LlRLn7 QEpEgApyijNgxsBi6dLjLJSwryMQEcJ8RSkFuVmlqDKv2IU52BUEub1B5nCk5lXArfpFdARTE BHTJ54BuSIkkSElFQDY1tcx1XeHZGaFdrFK10FHgTdq18rIdgbuDMnZpnvq/Xba3R1DCeu+eL ffmTqI4NMaY6lrzj6ys++ajoRaJWVWXJtefiZlezn/ZO83K/VLvUQtZ5cvsd1dUSmyrrZQrVq Dhe9DzK7/TG7Wrpx55pFJ35O8vwyo3ZP+O1NR58Ufj83yzhTs851thJLcUaioRZzUXEiAA+uV 16iAgAA X-Env-Sender: prvs=438a79e6a=George.Dunlap@citrix.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1506697324!79105423!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 62148 invoked from network); 29 Sep 2017 15:02:10 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 29 Sep 2017 15:02:10 -0000 X-IronPort-AV: E=Sophos;i="5.42,452,1500940800"; d="scan'208";a="449785862" From: George Dunlap To: Date: Fri, 29 Sep 2017 16:01:44 +0100 Message-ID: <20170929150144.7602-9-george.dunlap@citrix.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170929150144.7602-1-george.dunlap@citrix.com> References: <20170929150144.7602-1-george.dunlap@citrix.com> MIME-Version: 1.0 Cc: Sergey Dyasli , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 9/9] x86/np2m: add break to np2m_flush_eptp() 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 From: Sergey Dyasli Now that np2m sharing is implemented, there can be only one np2m object with the same np2m_base. Break from loop if the required np2m was found during np2m_flush_eptp(). Signed-off-by: Sergey Dyasli Reviewed-by: George Dunlap --- CC: Andrew Cooper CC: Jan Beulich --- xen/arch/x86/mm/p2m.c | 4 ++++ xen/include/asm-x86/p2m.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index dee6d7f0f2..bcde4df93f 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1795,7 +1795,11 @@ void np2m_flush_base(struct vcpu *v, unsigned long np2m_base) p2m = d->arch.nested_p2m[i]; p2m_lock(p2m); if ( p2m->np2m_base == np2m_base ) + { p2m_flush_table_locked(p2m); + p2m_unlock(p2m); + break; + } p2m_unlock(p2m); } nestedp2m_unlock(d); diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 8d4aa8c6bf..f28ca5e169 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -786,7 +786,7 @@ int p2m_pt_handle_deferred_changes(uint64_t gpa); void p2m_flush(struct vcpu *v, struct p2m_domain *p2m); /* Flushes all nested p2m tables */ void p2m_flush_nestedp2m(struct domain *d); -/* Flushes all np2m objects with the specified np2m_base */ +/* Flushes the np2m specified by np2m_base (if it exists) */ void np2m_flush_base(struct vcpu *v, unsigned long np2m_base); void nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,