All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Baoquan He <bhe@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	jgross@suse.com, william.kucharski@oracle.com, mingo@kernel.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH] mm/hotplug: Only respect mem= parameter during boot stage
Date: Mon, 9 Dec 2019 11:07:17 +0100	[thread overview]
Message-ID: <20191209100717.GC6156@dhcp22.suse.cz> (raw)
In-Reply-To: <20191206150524.14687-1-bhe@redhat.com>

On Fri 06-12-19 23:05:24, Baoquan He wrote:
> In commit 357b4da50a62 ("x86: respect memory size limiting via mem=
> parameter") a global varialbe global max_mem_size is added to store
> the value which is parsed from 'mem= '. This truly stops those
> DIMM from being added into system memory during boot.
> 
> However, it also limits the later memory hotplug functionality. Any
> memory board can't be hot added any more if its region is beyond the
> max_mem_size. System will print error like below:
> 
> [  216.387164] acpi PNP0C80:02: add_memory failed
> [  216.389301] acpi PNP0C80:02: acpi_memory_enable_device() error
> [  216.392187] acpi PNP0C80:02: Enumeration failure
> 
> >From document of 'mem =' parameter, it should be a restriction during
> boot, but not impact the system memory adding/removing after booting.
> 
>   mem=nn[KMG]     [KNL,BOOT] Force usage of a specific amount of memory
> 
> So fix it by also checking if it's during SYSTEM_BOOTING stage when
> restrict memory adding. Otherwise, skip the restriction.

Could you be more specific about why the boot vs. later hotplug makes
any difference? The documentation is explicit about the boot time but
considering this seems to be like that since ever I strongly suspect
that this is just an omission.

Btw. how have you tested the situation fixed by 357b4da50a62?

> Fixes: 357b4da50a62 ("x86: respect memory size limiting via mem= parameter")
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/memory_hotplug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 55ac23ef11c1..5466a0a00901 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -105,7 +105,7 @@ static struct resource *register_memory_resource(u64 start, u64 size)
>  	unsigned long flags =  IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
>  	char *resource_name = "System RAM";
>  
> -	if (start + size > max_mem_size)
> +	if (start + size > max_mem_size && system_state == SYSTEM_BOOTING)
>  		return ERR_PTR(-E2BIG);
>  
>  	/*
> -- 
> 2.17.2

-- 
Michal Hocko
SUSE Labs

  parent reply	other threads:[~2019-12-09 10:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 15:05 [PATCH] mm/hotplug: Only respect mem= parameter during boot stage Baoquan He
2019-12-09  9:43 ` David Hildenbrand
2019-12-09 10:07 ` Michal Hocko [this message]
2019-12-09 10:24   ` Jürgen Groß
2019-12-09 11:01     ` David Hildenbrand
2019-12-09 11:08       ` Jürgen Groß
2019-12-09 11:11         ` David Hildenbrand
2019-12-10  8:04           ` Baoquan He
2019-12-10  7:24   ` Baoquan He
2019-12-10 10:28     ` Michal Hocko
2019-12-10 10:43       ` Baoquan He
2019-12-10 11:33         ` Michal Hocko
2019-12-10 12:55           ` Baoquan He
2019-12-10 13:32             ` Michal Hocko
2019-12-10 14:05               ` Baoquan He
2019-12-10 14:19                 ` Michal Hocko
2019-12-11 13:20                   ` Baoquan He

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=20191209100717.GC6156@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=william.kucharski@oracle.com \
    /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.