[PATCH 16/16] x86/PV: conditionalize arch_set_info_guest()'s call to update_cr3()

Jan Beulich posted 16 patches 2 years, 10 months ago
[PATCH 16/16] x86/PV: conditionalize arch_set_info_guest()'s call to update_cr3()
Posted by Jan Beulich 2 years, 10 months ago
sh_update_paging_modes() as its last action already invokes
sh_update_cr3(). Therefore there is no reason to invoke update_cr3()
another time immediately after calling paging_update_paging_modes(),
the more that sh_update_cr3() does not short-circuit the "nothing
changed" case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1445,8 +1445,8 @@ int arch_set_info_guest(
 
     if ( paging_mode_enabled(d) )
         paging_update_paging_modes(v);
-
-    update_cr3(v);
+    else
+        update_cr3(v);
 #endif /* CONFIG_PV */
 
  out:
Re: [PATCH 16/16] x86/PV: conditionalize arch_set_info_guest()'s call to update_cr3()
Posted by Andrew Cooper 2 years, 10 months ago
On 22/03/2023 9:38 am, Jan Beulich wrote:
> sh_update_paging_modes() as its last action already invokes
> sh_update_cr3(). Therefore there is no reason to invoke update_cr3()
> another time immediately after calling paging_update_paging_modes(),
> the more that sh_update_cr3() does not short-circuit the "nothing
> changed" case.

I've finally figured out why "more than" feels like weird grammar.  In
this case, "especially as sh_update_cr3() does not..." would be the more
normal expression.

> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>