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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 273B6C43603 for ; Fri, 6 Dec 2019 15:05:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C54B32064B for ; Fri, 6 Dec 2019 15:05:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cy1XWbsC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C54B32064B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2D9286B167E; Fri, 6 Dec 2019 10:05:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 28B5D6B167F; Fri, 6 Dec 2019 10:05:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A06C6B1680; Fri, 6 Dec 2019 10:05:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 061ED6B167E for ; Fri, 6 Dec 2019 10:05:35 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 7B0A94404 for ; Fri, 6 Dec 2019 15:05:34 +0000 (UTC) X-FDA: 76235040588.17.brain64_6ab158968b11c X-HE-Tag: brain64_6ab158968b11c X-Filterd-Recvd-Size: 3697 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Dec 2019 15:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575644732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IT26lu0TFPeiz/SrRtHKqKnORA0j1r2gxVlANM2MQ98=; b=cy1XWbsCFWlNR74/8l8z7MnnWAA8gQetLTn6+JSspOdEYoqZsbzU+4H8WG43dadFVf50Pz AECHKfmkGJBCiO0aoN3fW0M2RSSwJ/J59YPQqYv1o5AzvkmS513vQJCoa5NrwQoCPHQhUH ozJ8oN0IXyPky0sPlJpgXPX2WOMzvLc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-3D439F-xND6WdlDV68c1NA-1; Fri, 06 Dec 2019 10:05:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E0F32800D41; Fri, 6 Dec 2019 15:05:27 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-49.pek2.redhat.com [10.72.12.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4F9B5D6C3; Fri, 6 Dec 2019 15:05:25 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, jgross@suse.com, william.kucharski@oracle.com, mingo@kernel.org, akpm@linux-foundation.org Subject: [PATCH] mm/hotplug: Only respect mem= parameter during boot stage Date: Fri, 6 Dec 2019 23:05:24 +0800 Message-Id: <20191206150524.14687-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: 3D439F-xND6WdlDV68c1NA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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: In commit 357b4da50a62 ("x86: respect memory size limiting via mem=3D parameter") a global varialbe global max_mem_size is added to store the value which is parsed from 'mem=3D '. 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 =3D' parameter, it should be a restriction during boot, but not impact the system memory adding/removing after booting. mem=3Dnn[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. Fixes: 357b4da50a62 ("x86: respect memory size limiting via mem=3D paramete= r") 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 st= art, u64 size) =09unsigned long flags =3D IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; =09char *resource_name =3D "System RAM"; =20 -=09if (start + size > max_mem_size) +=09if (start + size > max_mem_size && system_state =3D=3D SYSTEM_BOOTING) =09=09return ERR_PTR(-E2BIG); =20 =09/* --=20 2.17.2