All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/p2m: Remove np2m-specific filter from generic p2m_flush_table
@ 2017-01-30 15:17 George Dunlap
  2017-01-30 17:07 ` Tamas K Lengyel
  2017-01-31 10:44 ` Jan Beulich
  0 siblings, 2 replies; 9+ messages in thread
From: George Dunlap @ 2017-01-30 15:17 UTC (permalink / raw)
  To: xen-devel
  Cc: Tamas K Lengyel, Liang Li, Tim Deegan, George Dunlap,
	Matt Leinhos, Jan Beulich, Andrew Cooper, Yang Zhang

Commit 71bb7304e7a7a35ea6df4b0cedebc35028e4c159 added flushing of
nested p2m tables whenever the host p2m table changed.  Unfortunately
in the process, it added a filter to the generic 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.

Instead do the nested p2m filtering in p2m_flush_nestedp2m().

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 <matt@starlab.io>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
I've smoke-tested this with nested virt and it seems to work fine.
Matt / Tamas, could you test this with altp2m and see if it fixes your
issue?


CC: Liang Li <liang.z.li@intel.com>
CC: Yang Zhang <yang.z.zhang@intel.com>
CC: Tim Deegan <tim@xen.org>
CC: Tamas K Lengyel <tamas.lengyel@zentific.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Matt Leinhos <matt@starlab.io>
---
 xen/arch/x86/mm/p2m.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index aa627d8..0849c6e 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2048,12 +2048,6 @@ 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 )
-    {
-        p2m_unlock(p2m);
-        return;
-    }
-
     /* This is no longer a valid nested p2m for any address space */
     p2m->np2m_base = P2M_BASE_EADDR;
     
@@ -2088,7 +2082,11 @@ p2m_flush_nestedp2m(struct domain *d)
 {
     int i;
     for ( i = 0; i < MAX_NESTEDP2M; i++ )
-        p2m_flush_table(d->arch.nested_p2m[i]);
+    {
+        struct p2m_domain *p2m = d->arch.nested_p2m[i];
+        if ( p2m->np2m_base != P2M_BASE_EADDR )
+            p2m_flush_table(p2m);
+    }
 }
 
 struct p2m_domain *
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-02-08 16:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-30 15:17 [PATCH] xen/p2m: Remove np2m-specific filter from generic p2m_flush_table George Dunlap
2017-01-30 17:07 ` Tamas K Lengyel
2017-01-30 19:06   ` Matt Leinhos
2017-01-31 10:24   ` George Dunlap
2017-01-31 18:32     ` Tamas K Lengyel
2017-01-31 10:44 ` Jan Beulich
2017-01-31 13:58   ` George Dunlap
2017-02-08 10:02   ` Tim Deegan
2017-02-08 16:36     ` George Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.