x86/shadow: adjust minimum allocation calculations
authorJan Beulich <jbeulich@suse.com>
Mon, 11 Feb 2019 08:09:13 +0000 (09:09 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 11 Feb 2019 08:09:13 +0000 (09:09 +0100)
commitd04bf1eb656be8b2131d08c7e32cff343556cfa8
treef63a56fefa07c39e74d57d0ff48944f335a28963
parentaca21442499c04b70d84164b46744b35ee7b8bf4
x86/shadow: adjust minimum allocation calculations

A previously bad situation has become worse with the early setting of
->max_vcpus: The value returned by shadow_min_acceptable_pages() has
further grown, and hence now holds back even more memory from use for
the p2m.

Make sh_min_allocation() account for all p2m memory needed for
shadow_enable() to succeed during domain creation (at which point the
domain has no memory at all allocated to it yet, and hence use of
d->tot_pages is meaningless).

Also make shadow_min_acceptable_pages() no longer needlessly add 1 to
the vCPU count.

Finally make the debugging printk() in shadow_alloc_p2m_page() a little
more useful by logging some of the relevant domain settings.

Reported-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/mm/shadow/common.c