x86/pv: remove unnecessary toggle_guest_pt() overhead
authorJan Beulich <jbeulich@suse.com>
Tue, 5 May 2020 06:16:03 +0000 (08:16 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 May 2020 17:58:21 +0000 (18:58 +0100)
commit422ec8fcf34cf961e81fbccd7d236fa2c1e678a8
tree7d3a46c309756a166335eb9e203190f25c125c75
parentfa0854478d0b2b64680e558db760851f6f1c6d16
x86/pv: remove unnecessary toggle_guest_pt() overhead

toggle_guest_pt() is called in pairs, to read guest kernel data
structures when emulating a guest userspace action. Hence this doesn't
modify cr3 from the guest's point of view, and therefore doesn't need
any resync on the exit-to-guest path. Therefore move the updating of
->pv_cr3 and ->root_pgt_changed into toggle_guest_mode(), since undoing
the changes during the second of these invocations wouldn't be a safe
thing to do.

While at it, add a comment ahead of toggle_guest_pt() to clarify its
intended usage.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/pv/domain.c