linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Juergen Gross <jgross@suse.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	x86@kernel.org, linux-mm@kvack.org
Cc: sstabellini@kernel.org, hpa@zytor.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de
Subject: Re: [PATCH v2 2/2] x86/xen: dont add memory above max allowed allocation
Date: Fri, 1 Feb 2019 13:46:18 -0500	[thread overview]
Message-ID: <8d4f7604-cc47-9cd7-2cca-b00b3667d2fa@oracle.com> (raw)
In-Reply-To: <20190130082233.23840-3-jgross@suse.com>

On 1/30/19 3:22 AM, Juergen Gross wrote:
> Don't allow memory to be added above the allowed maximum allocation
> limit set by Xen.
>
> Trying to do so would result in cases like the following:
>
> [  584.559652] ------------[ cut here ]------------
> [  584.564897] WARNING: CPU: 2 PID: 1 at ../arch/x86/xen/multicalls.c:129 xen_alloc_pte+0x1c7/0x390()
> [  584.575151] Modules linked in:
> [  584.578643] Supported: Yes
> [  584.581750] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.4.120-92.70-default #1
> [  584.590000] Hardware name: Cisco Systems Inc UCSC-C460-M4/UCSC-C460-M4, BIOS C460M4.4.0.1b.0.0629181419 06/29/2018
> [  584.601862]  0000000000000000 ffffffff813175a0 0000000000000000 ffffffff8184777c
> [  584.610200]  ffffffff8107f4e1 ffff880487eb7000 ffff8801862b79c0 ffff88048608d290
> [  584.618537]  0000000000487eb7 ffffea0000000201 ffffffff81009de7 ffffffff81068561
> [  584.626876] Call Trace:
> [  584.629699]  [<ffffffff81019ad9>] dump_trace+0x59/0x340
> [  584.635645]  [<ffffffff81019eaa>] show_stack_log_lvl+0xea/0x170
> [  584.642391]  [<ffffffff8101ac51>] show_stack+0x21/0x40
> [  584.648238]  [<ffffffff813175a0>] dump_stack+0x5c/0x7c
> [  584.654085]  [<ffffffff8107f4e1>] warn_slowpath_common+0x81/0xb0
> [  584.660932]  [<ffffffff81009de7>] xen_alloc_pte+0x1c7/0x390
> [  584.667289]  [<ffffffff810647f0>] pmd_populate_kernel.constprop.6+0x40/0x80
> [  584.675241]  [<ffffffff815ecfe8>] phys_pmd_init+0x210/0x255
> [  584.681587]  [<ffffffff815ed207>] phys_pud_init+0x1da/0x247
> [  584.687931]  [<ffffffff815edb3b>] kernel_physical_mapping_init+0xf5/0x1d4
> [  584.695682]  [<ffffffff815e9bdd>] init_memory_mapping+0x18d/0x380
> [  584.702631]  [<ffffffff81064699>] arch_add_memory+0x59/0xf0
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  arch/x86/xen/setup.c      | 10 ++++++++++
>  drivers/xen/xen-balloon.c |  6 ++++++
>  2 files changed, 16 insertions(+)
>
> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> index d5f303c0e656..fdb184cadaf5 100644
> --- a/arch/x86/xen/setup.c
> +++ b/arch/x86/xen/setup.c
> @@ -12,6 +12,7 @@
>  #include <linux/memblock.h>
>  #include <linux/cpuidle.h>
>  #include <linux/cpufreq.h>
> +#include <linux/memory_hotplug.h>
>  
>  #include <asm/elf.h>
>  #include <asm/vdso.h>
> @@ -825,6 +826,15 @@ char * __init xen_memory_setup(void)
>  				xen_max_p2m_pfn = pfn_s + n_pfns;
>  			} else
>  				discard = true;
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +			/*
> +			 * Don't allow adding memory not in E820 map while
> +			 * booting the system. Once the balloon driver is up
> +			 * it will remove that restriction again.
> +			 */
> +			max_mem_size = xen_e820_table.entries[i].addr +
> +				       xen_e820_table.entries[i].size;
> +#endif
>  		}
>  
>  		if (!discard)
> diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
> index 2acbfe104e46..2a960fcc812e 100644
> --- a/drivers/xen/xen-balloon.c
> +++ b/drivers/xen/xen-balloon.c
> @@ -37,6 +37,7 @@
>  #include <linux/mm_types.h>
>  #include <linux/init.h>
>  #include <linux/capability.h>
> +#include <linux/memory_hotplug.h>
>  
>  #include <xen/xen.h>
>  #include <xen/interface/xen.h>
> @@ -63,6 +64,11 @@ static void watch_target(struct xenbus_watch *watch,
>  	static bool watch_fired;
>  	static long target_diff;
>  
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +	/* The balloon driver will take care of adding memory now. */
> +	max_mem_size = U64_MAX;
> +#endif


I don't think I understand this. Are you saying the guest should ignore
'mem' boot option?

-boris


> +
>  	err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
>  	if (err != 1) {
>  		/* This is ok (for domain0 at least) - so just return */


  parent reply	other threads:[~2019-02-01 18:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30  8:22 [PATCH v2 0/2] x86: respect memory size limits Juergen Gross
2019-01-30  8:22 ` [PATCH v2 1/2] x86: respect memory size limiting via mem= parameter Juergen Gross
2019-02-11 12:06   ` Ingo Molnar
2019-02-11 12:14     ` [Xen-devel] " Juergen Gross
2019-02-11 12:23       ` Ingo Molnar
2019-02-11 12:35         ` Juergen Gross
2019-01-30  8:22 ` [PATCH v2 2/2] x86/xen: dont add memory above max allowed allocation Juergen Gross
2019-01-30 10:59   ` William Kucharski
2019-02-01 18:46   ` Boris Ostrovsky [this message]
2019-02-07  6:32     ` Juergen Gross

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=8d4f7604-cc47-9cd7-2cca-b00b3667d2fa@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=sstabellini@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).