x86/hvm: Make the altp2m locking in hvm_hap_nested_page_fault() easier to follow
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 23 Oct 2018 10:18:07 +0000 (11:18 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 3 Jun 2019 13:02:49 +0000 (14:02 +0100)
commit6eeba26ca93e9e3655a9706cf3c998a0754bfc71
treed0b563602118de057dd19bcc1dc8b0780836fecf
parent9df7077198f1392d02d81353da29f46b9d747db9
x86/hvm: Make the altp2m locking in hvm_hap_nested_page_fault() easier to follow

Drop the ap2m_active boolean, and consistently use the unlocking form:

  if ( p2m != hostp2m )
       __put_gfn(p2m, gfn);
  __put_gfn(hostp2m, gfn);

which makes it clear that we always unlock the altp2m's gfn if it is in use,
and always unlock the hostp2m's gfn.  This also drops the ternary expression
in the logdirty case.

Extend the logdirty comment to identify where the locking violation is liable
to occur.

No (intended) overall change in behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/hvm/hvm.c