]> xenbits.xensource.com Git - people/dwmw2/xen.git/commit
x86/altp2m: cleanup p2m_altp2m_lazy_copy
authorTamas K Lengyel <tamas@tklengyel.com>
Tue, 28 May 2019 13:10:36 +0000 (14:10 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Tue, 28 May 2019 13:10:36 +0000 (14:10 +0100)
commit9abcac7ff14506b934e55d1cfd86575f182b77b7
tree87ff2db93ea163608d52faa97d1f5b3cf38124e9
parent81646cea826fa322831fffb43f81e7e0866dc124
x86/altp2m: cleanup p2m_altp2m_lazy_copy

The p2m_altp2m_lazy_copy is responsible for lazily populating an
altp2m view when the guest traps out due to no EPT entry being present
in the active view.  Currently, in addition to taking a number of
unused argements, the whole calling convention has a number of
redundant p2m lookups: the function reads the hostp2m, even though the
caller has just read the same hostp2m entry; and then the caller
re-reads the altp2m entry that the function has just read (and possibly set).

Rework this function to make it a bit more rational.  Specifically:

- Pass the current hostp2m entry values we have just read for it to
  use to populate the altp2m entry if it finds the entry empty.

- If the altp2m entry is not empty, pass out the values we've read so
  the caller doesn't need to re-walk the tables

- Either way, return with the gfn 'locked', to make clean-up handling
  more consistent.

Rename the function to better reflect this functionality.

While we're here, change bool_t to bool, and return true/false rather
than 1/0.

It's a bit grating to do both the p2m_lock() and the get_gfn(),
knowing that they boil down to the same thing at the moment; but we
have to maintain the fiction until such time as we decide to get rid
of it entirely.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Tested-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/mm/p2m.c
xen/include/asm-x86/p2m.h