On Wed, Dec 05, 2018 at 03:55:00PM +0100, Roger Pau Monne wrote: > Current approximation of paging memory usage is based on the required > amount when running in shadow mode and doesn't take into account the > memory required by the IOMMU page tables. > > Fix this by introducing a function to calculate the amount of memory > required by HAP/IOMMU page tables. The formula used to calculate such > approximation is based on the pessimistic approach that each 4KB > memory chunk will use 8 bytes of page table memory. Note that this > approximation might need further tuning based on testing on different > systems. > > Also fix the calculation of the required paging related memory in > dom0_compute_nr_pages to take into account the paging implementation > (shadow or HAP) and whether the IOMMU pages tables are shared with the > HAP page tables. > > Signed-off-by: Roger Pau Monné <roger....@citrix.com> > --- > Cc: Jan Beulich <jbeul...@suse.com> > Cc: Andrew Cooper <andrew.coop...@citrix.com> > Cc: Wei Liu <wei.l...@citrix.com> > Cc: andrei.seme...@bertin.fr > --- > xen/arch/x86/dom0_build.c | 31 +++++++++++++++++++++++++++---- > xen/arch/x86/hvm/dom0_build.c | 6 ++++-- > xen/include/asm-x86/dom0_build.h | 2 ++ > 3 files changed, 33 insertions(+), 6 deletions(-) > > diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c > index ba9aa85611..3a8e138f23 100644 > --- a/xen/arch/x86/dom0_build.c > +++ b/xen/arch/x86/dom0_build.c > @@ -267,6 +267,25 @@ unsigned long __init dom0_shadow_pages(const struct > domain *d, > return ((memkb + 1023) / 1024) << (20 - PAGE_SHIFT); > } > > +unsigned long __init dom0_hap_pages(const struct domain *d, > + unsigned long nr_pages) > +{ > + /* > + * Attempt to account for at least some of the MMIO regions by adding the > + * size of the holes in the memory map to the amount of pages to map. > Note > + * this will obviously not account for MMIO regions that are past the > last > + * RAM range in the memory map. > + */ > + nr_pages += max_page - total_pages;
Do those regions past end of RAM range show up in E820 map? If so, why not just sum up all reserved regions? Wei. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel