From patchwork Tue Jul 18 10:34:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 9847783 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 4532B602A7 for ; Tue, 18 Jul 2017 10:48:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5169C26E4E for ; Tue, 18 Jul 2017 10:48:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4640E2854A; Tue, 18 Jul 2017 10:48:30 +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 E6E7B26E4E for ; Tue, 18 Jul 2017 10:48:29 +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 1dXQ1J-0008Tt-0b; Tue, 18 Jul 2017 10:46:25 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXQ1H-0008Ta-00 for xen-devel@lists.xen.org; Tue, 18 Jul 2017 10:46:23 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 17/0E-01862-EF6ED695; Tue, 18 Jul 2017 10:46:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHRDpO7fZ7m RBl/bTSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ox5q+ezF6zjrrj2ZRV7A+Nczi5GTg4JAX+J 1zdOsYDYbAJ6Ehtnv2ICsUUEZCVWd81hB7GZBT4xSTQccwSxhQWcJdYvXgMWZxFQlVh8by0ri M0rYCex7NYRJoiZ8hK72i6CxTmB4vOed4LNFxKwlVh9YRcrhK0q8frFLhaIXkGJkzOfsEDskp A4+OIF8wRG3llIUrOQpBYwMq1i1ChOLSpLLdI1NNdLKspMzyjJTczM0TU0MNbLTS0uTkxPzUl MKtZLzs/dxAgMHgYg2MH48rTnIUZJDiYlUd7VB3IjhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnw Tn4KlBMsSk1PrUjLzAGGMUxagoNHSYT38xOgNG9xQWJucWY6ROoUoy7Hqwn/vzEJseTl56VKi fPGg8wQACnKKM2DGwGLqUuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5v0CMoUnM68EbtMroC OYgI4Q9s0BOaIkESEl1cCYNu2MLffXdRd1xI7xhPZ3VTav0E/4b7/E+UG0Zl8Xq2rolHcFssJ Zbf/nujYvtGvytYz/O0vn1mtHFokN1jPcpYXEkzXZ6oLqjfmtHFUqd8z5vE1ssowD252b9mt1 cr+Vzzy3fm/fLdVYV8e4ygT3y8Gm+uERKzatq/2uvvrPb9/C4rM7pJRYijMSDbWYi4oTAZBks J2kAgAA X-Env-Sender: prvs=365bef495=sergey.dyasli@citrix.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1500374780!75077020!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.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50576 invoked from network); 18 Jul 2017 10:46:21 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-11.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 18 Jul 2017 10:46:21 -0000 X-IronPort-AV: E=Sophos;i="5.40,377,1496102400"; d="scan'208";a="431882305" From: Sergey Dyasli To: Date: Tue, 18 Jul 2017 11:34:28 +0100 Message-ID: <20170718103429.25020-12-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170718103429.25020-1-sergey.dyasli@citrix.com> References: <20170718103429.25020-1-sergey.dyasli@citrix.com> MIME-Version: 1.0 Cc: Sergey Dyasli , Kevin Tian , Jun Nakajima , George Dunlap , Andrew Cooper , Tim Deegan , Jan Beulich , Boris Ostrovsky , Suravee Suthikulpanit Subject: [Xen-devel] [PATCH RFC 11/12] 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 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 --- xen/arch/x86/mm/p2m.c | 3 +++ xen/include/asm-x86/p2m.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 480459ae51..d0a2aef1f2 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1796,7 +1796,10 @@ void np2m_flush_eptp(struct vcpu *v, unsigned long eptp) p2m = d->arch.nested_p2m[i]; p2m_lock(p2m); if ( p2m->np2m_base == eptp ) + { p2m_flush_table_locked(p2m); + break; + } else p2m_unlock(p2m); } diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 936d1142c8..7cc44cc496 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -784,7 +784,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 eptp */ +/* Flushes the np2m specified by eptp (if it exists) */ void np2m_flush_eptp(struct vcpu *v, unsigned long eptp); void nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,