From patchwork Wed Feb 8 17:22:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Dunlap X-Patchwork-Id: 9562861 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 111AC60434 for ; Wed, 8 Feb 2017 17:25:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2E1E284EF for ; Wed, 8 Feb 2017 17:25:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C746F28506; Wed, 8 Feb 2017 17:25:51 +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 5B56D284EF for ; Wed, 8 Feb 2017 17:25:51 +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 1cbVxC-0002YJ-5d; Wed, 08 Feb 2017 17:22:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbVxA-0002Xz-Fj for xen-devel@lists.xenproject.org; Wed, 08 Feb 2017 17:22:48 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id CE/80-14551-7E35B985; Wed, 08 Feb 2017 17:22:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRWlGSWpSXmKPExsXitHRDpO7z4Nk RBsvO8Vh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBln3+gXnOau6N3ylbmB8RxnFyMnh4SAv8Te d7/YQGw2AT2Jece/snQxcnCICKhI3N5r0MXIxcEscIhR4srRKSwgNcICrhJ7pu1jB7FZgGoWH 3/OBGLzCnhIzFn3ix1ippzE+eM/mUFsIQFVicUPjrJD1AhKnJz5BGwOs4CExMEXL5gnMHLPQp KahSS1gJFpFaNGcWpRWWqRrqG5XlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGYCg wAMEOxpenPQ8xSnIwKYnysgfOjhDiS8pPqcxILM6ILyrNSS0+xCjDwaEkwcsPDC0hwaLU9NSK tMwcYFDCpCU4eJREeJcFAaV5iwsSc4sz0yFSpxgVpcR5Z4AkBEASGaV5cG2wSLjEKCslzMsId IgQT0FqUW5mCar8K0ZxDkYlYd4vIFN4MvNK4Ka/AlrMBLT4+ulZIItLEhFSUg2MW7L2n+hZek U8f8bMBSHry3jPNHk9LVcQmDxNptOwijHCQunIjRzBKQlynfPniTg+MRNb/G2lfz5XDOPmzQw L+bpyZSJXFRatvsYSHhj3Mz8+qljj98p5lot237j6InqN7vEjdxuNd1gd8NPe+a4r91D47qA1 BR6LRavNT8sIS0nUb+9ZO9FNiaU4I9FQi7moOBEAIWfSeX8CAAA= X-Env-Sender: prvs=20566248d=George.Dunlap@citrix.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1486574565!77095290!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.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 65137 invoked from network); 8 Feb 2017 17:22:46 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-7.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 8 Feb 2017 17:22:46 -0000 X-IronPort-AV: E=Sophos;i="5.33,348,1477958400"; d="scan'208";a="405466208" From: George Dunlap To: Date: Wed, 8 Feb 2017 17:22:26 +0000 Message-ID: <1486574546-10818-1-git-send-email-george.dunlap@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: Andrew Cooper , Tim Deegan , George Dunlap , Jan Beulich , Tamas K Lengyel Subject: [Xen-devel] [PATCH v2] xen/p2m: Fix p2m_flush_table for non-nested cases 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 Commit 71bb7304e7a7a35ea6df4b0cedebc35028e4c159 added flushing of nested p2m tables whenever the host p2m table changed. Unfortunately in the process, it added a filter to p2m_flush_table() function so that the p2m would only be flushed if it was being used as a nested p2m. This meant that the p2m was not being flushed at all for altp2m callers. Only check np2m_base if p2m_class is set to p2m_nested. NB that this is not a security issue: The only time this codepath is called is in cases where either nestedp2m or altp2m is enabled, and neither of them are in security support. Reported-by: Matt Leinhos Signed-off-by: George Dunlap Reviewed-by: Tim Deegan Tested-by: Tamas K Lengyel --- CC: Andrew Cooper CC: Jan Beulich CC: Tim Deegan CC: Tamas K Lengyel --- xen/arch/x86/mm/p2m.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 6548e9f..0af2ec1 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1627,7 +1627,9 @@ p2m_flush_table(struct p2m_domain *p2m) ASSERT(page_list_empty(&p2m->pod.super)); ASSERT(page_list_empty(&p2m->pod.single)); - if ( p2m->np2m_base == P2M_BASE_EADDR ) + /* No need to flush if it's already empty */ + if ( p2m->p2m_class == p2m_nested && + p2m->np2m_base == P2M_BASE_EADDR ) { p2m_unlock(p2m); return;