The latest as of e2b2ff677958 ("x86/P2M: split out init/teardown
functions") the function is obviously unreachable for PV guests. Hence
the paging_mode_enabled(d) check is pointless.

Further host mode of a vCPU is always set, by virtue of
paging_vcpu_init() being part of vCPU creation. Hence the
paging_get_hostmode() check is pointless.

With that the v local variable is unnecessary too. Drop the "if()"
conditional and its corresponding "else".

Signed-off-by: Jan Beulich <jbeul...@suse.com>
---
I have to confess that this if() has been puzzling me before.

--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -110,12 +110,7 @@ static int write_p2m_entry(struct p2m_do
                            unsigned int level)
 {
     struct domain *d = p2m->domain;
-    const struct vcpu *v = current;
 
-    if ( v->domain != d )
-        v = d->vcpu ? d->vcpu[0] : NULL;
-    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) ||
-         p2m_is_nestedp2m(p2m) )
     {
         unsigned int oflags;
         mfn_t omfn;
@@ -156,8 +151,6 @@ static int write_p2m_entry(struct p2m_do
               !perms_strictly_increased(oflags, l1e_get_flags(new))) )
             p2m_flush_nestedp2m(d);
     }
-    else
-        safe_write_pte(p, new);
 
     return 0;
 }


Reply via email to