From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CACFC00454 for ; Mon, 9 Dec 2019 10:07:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 00E0A2077B for ; Mon, 9 Dec 2019 10:07:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00E0A2077B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4A7076B261A; Mon, 9 Dec 2019 05:07:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4573A6B261B; Mon, 9 Dec 2019 05:07:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36DCD6B261C; Mon, 9 Dec 2019 05:07:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0103.hostedemail.com [216.40.44.103]) by kanga.kvack.org (Postfix) with ESMTP id 200F86B261A for ; Mon, 9 Dec 2019 05:07:21 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id AEAB88249980 for ; Mon, 9 Dec 2019 10:07:20 +0000 (UTC) X-FDA: 76245175440.07.train31_5dd95ae17d42 X-HE-Tag: train31_5dd95ae17d42 X-Filterd-Recvd-Size: 4475 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Dec 2019 10:07:20 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id g206so14792038wme.1 for ; Mon, 09 Dec 2019 02:07:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZK01xO2VHFn+IEu/N2yJTe1AAJ2Ih5XXg9yHN17A9sE=; b=LcqeCsSzumqHuxpBt6U//UR2YG0m0ldqjHpCk1cdVH8aYgd5V/9umHnhQ3rYqhkzIZ V/A7wgg2YfRRXpWQjLgtAoI/3osNDKRCJylGdvZsLSwwXvGc2h7YIKSeyyzqtn0/mBDw L7iAw25i/KAqHj80ozL06V51uBn6kCxdC4dldpz7g5sSfOzZJqNFIeD4g2E798PhxLeb cd5J5g2tdPEV9Opzc/kRNaLNHJqFTUajs8ZczIQOA/1CULxb2SC6D6vnq/wqNh1QW166 WZveC4sGqW1a7Tz4znVLu+GPrjd6k4+j/LH6noWGZogS5lyWQs9NzfuMOKZWuximY+1b fnJQ== X-Gm-Message-State: APjAAAX9yh12Dz/ahB2c8bcRoEZqscCI9cHrakD8fiw1L26nurYLYElj yehAQD8f3nGzCgQ53i2uI+U= X-Google-Smtp-Source: APXvYqxFkqWC+BhtSyCb9+jQbv4vLo/72RGm6Rz/bOhvzh38nITpvs1G+YEkejn2rSWpaKrxrmyPNg== X-Received: by 2002:a7b:c38c:: with SMTP id s12mr23890833wmj.96.1575886039073; Mon, 09 Dec 2019 02:07:19 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id n12sm13092152wmd.1.2019.12.09.02.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 02:07:18 -0800 (PST) Date: Mon, 9 Dec 2019 11:07:17 +0100 From: Michal Hocko To: Baoquan He 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 Message-ID: <20191209100717.GC6156@dhcp22.suse.cz> References: <20191206150524.14687-1-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191206150524.14687-1-bhe@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > --- > 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