All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>, Wei Liu <wei.liu2@citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH for-4.12 4/8] x86/shadow: alloc enough pages so initialization doesn't fail
Date: Tue, 05 Feb 2019 04:21:52 -0700	[thread overview]
Message-ID: <5C5971D00200007800213E92@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <20190130103646.53649-5-roger.pau@citrix.com>

>>> On 30.01.19 at 11:36, <roger.pau@citrix.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-02-05 11:21 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 10:36 [PATCH for-4.12 0/8] pvh/dom0/shadow/amd fixes Roger Pau Monne
2019-01-30 10:36 ` [PATCH for-4.12 1/8] dom0/pvh: align allocation and mapping order to start address Roger Pau Monne
2019-01-30 12:37   ` Wei Liu
2019-01-30 13:58     ` Roger Pau Monné
2019-01-31 17:22       ` Wei Liu
2019-02-04 16:41   ` Jan Beulich
2019-02-04 17:11     ` Roger Pau Monné
2019-02-05  7:42       ` Jan Beulich
2019-02-05 10:26         ` Roger Pau Monné
2019-02-05 11:38           ` Jan Beulich
2019-02-05 10:54         ` Andrew Cooper
2019-02-05 11:37           ` Jan Beulich
2019-01-30 10:36 ` [PATCH for-4.12 2/8] amd/ntp: remove assert that prevents creating 2M MMIO entries Roger Pau Monne
2019-02-04 16:48   ` Andrew Cooper
2019-02-04 16:56   ` Jan Beulich
2019-02-04 17:18     ` Roger Pau Monné
2019-02-05  7:45       ` Jan Beulich
2019-02-05 10:40         ` Roger Pau Monné
2019-02-05 12:44           ` Jan Beulich
2019-02-05 13:38             ` Roger Pau Monné
2019-02-05 14:55               ` Jan Beulich
2019-02-07 17:21               ` George Dunlap
2019-02-08 17:49                 ` Roger Pau Monné
2019-02-11  9:47                   ` Jan Beulich
2019-02-11 12:03                     ` Roger Pau Monné
     [not found]                       ` <7BBE0D330200008C0063616D@prv1-mh.provo.novell.com>
2019-02-11 12:11                         ` Jan Beulich
2019-01-30 10:36 ` [PATCH for-4.12 3/8] iommu/pvh: add reserved regions below 1MB to the iommu page tables Roger Pau Monne
2019-02-05 10:47   ` Jan Beulich
2019-02-05 11:15     ` Roger Pau Monné
2019-02-05 12:49       ` Jan Beulich
2019-02-05 14:01         ` Roger Pau Monné
2019-02-05 15:18           ` Jan Beulich
2019-02-05 15:45             ` Roger Pau Monné
2019-01-30 10:36 ` [PATCH for-4.12 4/8] x86/shadow: alloc enough pages so initialization doesn't fail Roger Pau Monne
2019-02-05 11:21   ` Jan Beulich [this message]
2019-02-05 11:47     ` Roger Pau Monné
2019-02-05 12:55       ` Jan Beulich
2019-02-05 13:52         ` Roger Pau Monné
2019-02-05 15:15           ` Jan Beulich
2019-02-05 15:53             ` Roger Pau Monné
2019-02-05 17:32               ` Jan Beulich
2019-02-06  9:10                 ` Roger Pau Monné
2019-02-06 11:02                   ` Jan Beulich
2019-01-30 10:36 ` [PATCH for-4.12 5/8] pvh/dom0: warn when dom0_mem is not set to a fixed value Roger Pau Monne
2019-02-06 13:54   ` Jan Beulich
2019-02-07 15:39     ` Roger Pau Monné
2019-02-07 16:47       ` Jan Beulich
2019-02-07 17:09   ` George Dunlap
2019-02-07 17:48     ` Roger Pau Monné
2019-02-08 11:11       ` George Dunlap
2019-01-30 10:36 ` [PATCH 6/8] x86/mm: split p2m ioreq server pages special handling into helper Roger Pau Monne
2019-01-31 14:59   ` Paul Durrant
2019-01-31 16:58     ` Roger Pau Monné
2019-01-30 10:36 ` [PATCH 7/8] x86/mm: handle foreign mappings in p2m_entry_modify Roger Pau Monne
2019-02-06 16:59   ` Jan Beulich
2019-02-07 16:53     ` Roger Pau Monné
2019-02-07 16:59       ` Jan Beulich
2019-02-07 17:49   ` George Dunlap
2019-02-07 17:57     ` Roger Pau Monné
2019-02-07 18:05       ` George Dunlap
2019-02-08  9:37         ` Roger Pau Monné
2019-01-30 10:36 ` [PATCH 8/8] npt/shadow: allow getting foreign page table entries Roger Pau Monne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5C5971D00200007800213E92@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.