]> xenbits.xensource.com Git - xen.git/commitdiff
x86/p2m: missing adjustments after 25f5530fc43b
authorJan Beulich <jbeulich@suse.com>
Tue, 3 Dec 2019 13:36:24 +0000 (14:36 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 3 Dec 2019 13:36:24 +0000 (14:36 +0100)
There was a piece of code missing in the backport of 183f354e1430
("x86/vvmx: Fix livelock with XSA-304 fix"), which ought to have been
taken from 0cafb89ae632 ("x86/vtx: Allow runtime modification of the
exec-sp setting").

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm/p2m.c

index 25fed08efb524db7131b8905ba3b088e31edb12c..110044b2c4c4e104b2753cde00bdd71165446297 100644 (file)
@@ -262,17 +262,22 @@ int p2m_is_logdirty_range(struct p2m_domain *p2m, unsigned long start,
     return 0;
 }
 
+/*
+ * May be called with ot = nt = p2m_ram_rw for its side effect of
+ * recalculating all PTEs in the p2m.
+ */
 void p2m_change_entry_type_global(struct domain *d,
                                   p2m_type_t ot, p2m_type_t nt)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
-    ASSERT(ot != nt);
     ASSERT(p2m_is_changeable(ot) && p2m_is_changeable(nt));
 
     p2m_lock(p2m);
     p2m->change_entry_type_global(p2m, ot, nt);
-    p2m->global_logdirty = (nt == p2m_ram_logdirty);
+    /* Don't allow 'recalculate' operations to change the logdirty state. */
+    if ( ot != nt )
+        p2m->global_logdirty = (nt == p2m_ram_logdirty);
     p2m_unlock(p2m);
 }