From patchwork Tue Oct 3 15:21:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 9983071 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 3E579602B8 for ; Tue, 3 Oct 2017 15:23:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FF3C2889D for ; Tue, 3 Oct 2017 15:23:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2469E289BE; Tue, 3 Oct 2017 15:23:54 +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 C25502889D for ; Tue, 3 Oct 2017 15:23:53 +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 1dzP0Z-0002yY-O2; Tue, 03 Oct 2017 15:21:19 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzP0Y-0002wh-9z for xen-devel@lists.xen.org; Tue, 03 Oct 2017 15:21:18 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 55/7B-01910-DEAA3D95; Tue, 03 Oct 2017 15:21:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrohUvfNqsu RBpcazC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oytJ+4yFizhqfhz+RRTA2MXVxcjJ4eEgL/E +q3NrCA2m4CexMbZr5hAbBEBWYnVXXPYQWxmgU9MEg3HHEFsYQEHie6VG5i7GDk4WARUJNa8i gAJ8wrYSnSd/swIMVJeYlfbRbCRnEDxKcfms4DYQgI2Et+/7GGEsFUlXr/YxQLRKyhxcuYTFo hVEhIHX7xgnsDIOwtJahaS1AJGplWM6sWpRWWpRbpGeklFmekZJbmJmTm6hgbGermpxcWJ6ak 5iUnFesn5uZsYgYFTz8DAuIPxVLPzIUZJDiYlUd7Xyy5HCvEl5adUZiQWZ8QXleakFh9ilOHg UJLgzVoOlBMsSk1PrUjLzAGGMExagoNHSYSXAyTNW1yQmFucmQ6ROsWoy9Fx8+4fJiGWvPy8V ClxXlGQIgGQoozSPLgRsHi6xCgrJczLyMDAIMRTkFqUm1mCKv+KUZyDUUmYVwJkCk9mXgncpl dARzABHTGn6wLIESWJCCmpBsZOn3vh63R4eV2vvk+1d1233naKZ6z25i8SK5b/1jVWK7UU3TG 5MGhFwky/mf6GT+7lLE4T7lv3OTD+mhabzjbOL8qzHU4v6pmx/eKKsxK6M87OWdw0bePDS4qe dnPrjlQlXqx7GVkdJ57mfD9nj/bB3rBn4d6LObvvsCdJ3/vUES65YOmSZWFKLMUZiYZazEXFi QCIQJi/ogIAAA== X-Env-Sender: prvs=4422f64de=sergey.dyasli@citrix.com X-Msg-Ref: server-13.tower-31.messagelabs.com!1507044074!113159639!2 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.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58646 invoked from network); 3 Oct 2017 15:21:16 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 3 Oct 2017 15:21:16 -0000 X-IronPort-AV: E=Sophos;i="5.42,474,1500940800"; d="scan'208";a="442358106" From: Sergey Dyasli To: Date: Tue, 3 Oct 2017 16:21:04 +0100 Message-ID: <20171003152104.1432-10-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171003152104.1432-1-sergey.dyasli@citrix.com> References: <20171003152104.1432-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 v3 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 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 --- 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 6c937c9e17..d36eee7ae0 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 182463b247..a26070957f 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -779,7 +779,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,