On Mon, Apr 25, 2022 at 10:49:34AM +0200, Jan Beulich wrote:
> char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid)
> --- a/xen/arch/x86/dom0_build.c
> +++ b/xen/arch/x86/dom0_build.c
> @@ -317,9 +317,12 @@ unsigned long __init dom0_paging_pages(c
> /* Copied from: libxl_get_required_shadow_memory() */
Could you also update the comment, maybe better would be:
/* Keep in sync with libxl__get_required_paging_memory(). */
> unsigned long memkb = nr_pages * (PAGE_SIZE / 1024);
>
> - memkb = 4 * (256 * d->max_vcpus + 2 * (memkb / 1024));
> + memkb = 4 * (256 * d->max_vcpus +
> + (paging_mode_enabled(d) +
> + (opt_dom0_shadow || opt_pv_l1tf_hwdom)) *
opt_pv_l1tf_hwdom is only relevant for PV guests, so maybe it would be
best to use:
paging_mode_enabled(d) ? 1 + opt_dom0_shadow
: 0 + (opt_dom0_shadow || opt_pv_l1tf_hwdom)
Or something similar. Maybe placing this inside the sum will make the
expression too complex, so we could use a separate is_shadow boolean
to signal whether the domain will use shadow pagetables?
Thanks, Roger.