p2m: Always use hostp2m when clipping rangesets
authorRazvan Cojocaru <rcojocaru@bitdefender.com>
Sat, 22 Dec 2018 09:43:52 +0000 (09:43 +0000)
committerGeorge Dunlap <george.dunlap@citrix.com>
Sat, 22 Dec 2018 09:43:52 +0000 (09:43 +0000)
commitb5acd075aabc043cc7e9aa533ec697dd68a1d137
treeb955f3bf96ba7287784415adbf4920f097625da1
parent0fb4b58c8b9cc4036907d595a124b31aa1153f33
p2m: Always use hostp2m when clipping rangesets

The logdirty rangesets of the altp2ms need to be kept in sync with the
hostp2m. This means when iterating through the altp2ms, we need to
use the host p2m to clip the rangeset, not the indiviual altp2m's
value.

This change also:

- Documents that the end is non-inclusive

- Calculates an "inclusive" value for the end once, rather than
  open-coding the modification, and (worse) back-modifying updates so
  that the calculation ends up correct

- Clarifies the logic deciding whether to call
  change_entry_type_global() or change_entry_type_range()

- Handles the case where start >= hostp2m->max_mapped_pfn

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Tested-by: Tamas K Lengyel <tamas@tklengyel.com>
xen/arch/x86/mm/p2m.c