[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.12 4/8] x86/shadow: alloc enough pages so initialization doesn't fail



>>> On 30.01.19 at 11:36, <roger.pau@xxxxxxxxxx> wrote:
> Current code in shadow_enable will allocate a shadow pool of 4MB
> regardless of the values of sh_min_allocation or
> shadow_min_acceptable_pages, which means that calls to
> shadow_alloc_p2m_page can fail even after the check and allocation
> done just above.
> 
> Fix this by always checking that the pool is big enough so the rest of
> the shadow_init function cannot fail due to lack of pages in the
> shadow pool. This is relevant to shadow_alloc_p2m_page which requires
> a minimum amount of shadow_min_acceptable_pages(d) + 1 in the pool.
> 
> This allows booting a guest using shadow and more than 6 vCPUs.

I'm routinely booting 8-vCPU guests without issues.

> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -2705,6 +2705,11 @@ int shadow_enable(struct domain *d, u32 mode)
>      uint32_t *e;
>      int rv = 0;
>      struct p2m_domain *p2m = p2m_get_hostp2m(d);
> +    /*
> +     * Required minimum amount of pool pages plus 4MB. This is required so 
> the
> +     * calls to p2m_alloc_table and shadow_alloc_p2m_page below don't fail.
> +     */
> +    unsigned int min_pages = shadow_min_acceptable_pages(d) + 1024;

sh_min_allocation() also takes the memory size of the domain into
account. Aren't you therefore risking to regress larger guests by
instead using a fixed amount here? The more that ...

> @@ -2719,10 +2724,10 @@ int shadow_enable(struct domain *d, u32 mode)
>  
>      /* Init the shadow memory allocation if the user hasn't done so */
>      old_pages = d->arch.paging.shadow.total_pages;
> -    if ( old_pages < sh_min_allocation(d) + d->arch.paging.shadow.p2m_pages )
> +    if ( old_pages < min_pages )

... the right side of the + here goes away as well.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.