diff mbox series

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

Message ID 1c2bd7b9-34f9-bd00-cf36-7cf6e0bb8c3f@suse.com (mailing list archive)
State New, archived
Headers show
Series x86: assorted (mostly) shadow mode adjustments | expand

Commit Message

Jan Beulich March 22, 2023, 9:38 a.m. UTC
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>

Comments

Andrew Cooper March 23, 2023, 6:34 p.m. UTC | #1
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>
diff mbox series

Patch

--- 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: