From patchwork Tue Dec 1 11:51:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 11942743 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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 A72A2C64E7B for ; Tue, 1 Dec 2020 11:52:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2402220770 for ; Tue, 1 Dec 2020 11:52:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2402220770 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9ED338D0001; Tue, 1 Dec 2020 06:52:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FC468D0007; Tue, 1 Dec 2020 06:52:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 676378D0001; Tue, 1 Dec 2020 06:52:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0111.hostedemail.com [216.40.44.111]) by kanga.kvack.org (Postfix) with ESMTP id 4D4C28D0005 for ; Tue, 1 Dec 2020 06:52:13 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0D76C8249980 for ; Tue, 1 Dec 2020 11:52:13 +0000 (UTC) X-FDA: 77544550146.04.sofa16_2a010bd273aa Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id E3E71800A330 for ; Tue, 1 Dec 2020 11:52:12 +0000 (UTC) X-HE-Tag: sofa16_2a010bd273aa X-Filterd-Recvd-Size: 3307 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Dec 2020 11:52:12 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 715A8AD43; Tue, 1 Dec 2020 11:52:11 +0000 (UTC) From: Oscar Salvador To: david@redhat.com Cc: mhocko@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, vbabka@suse.cz, pasha.tatashin@soleen.com, Oscar Salvador Subject: [RFC PATCH v3 3/4] mm,memory_hotplug: Enable MHP_MEMMAP_ON_MEMORY when supported Date: Tue, 1 Dec 2020 12:51:57 +0100 Message-Id: <20201201115158.22638-4-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20201201115158.22638-1-osalvador@suse.de> References: <20201201115158.22638-1-osalvador@suse.de> 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: Let the callers check whether they can use MHP_MEMMAP_ON_MEMORY by checking mhp_supports_memmap_on_memory(). Currently, we only support MHP_MEMMAP_ON_MEMORY in case CONFIG_SPARSEMEM_VMEMMAP is enabled, the architecture supports altmap, and the range to be added spans a single memory block. Signed-off-by: Oscar Salvador --- arch/powerpc/platforms/pseries/hotplug-memory.c | 5 ++++- drivers/acpi/acpi_memhotplug.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 7efe6ec5d14a..3aba817e729e 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -612,6 +612,7 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb) { unsigned long block_sz; int nid, rc; + mhp_t mhp_flags = MHP_NONE; if (lmb->flags & DRCONF_MEM_ASSIGNED) return -EINVAL; @@ -629,8 +630,10 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb) if (nid < 0 || !node_possible(nid)) nid = first_online_node; + if (mhp_supports_memmap_on_memory(block_sz)) + mhp_flags |= MHP_MEMMAP_ON_MEMORY; /* Add the memory */ - rc = __add_memory(nid, lmb->base_addr, block_sz, MHP_NONE); + rc = __add_memory(nid, lmb->base_addr, block_sz, mhp_flags); if (rc) { invalidate_lmb_associativity_index(lmb); return rc; diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index b02fd51e5589..1fe645ef0b6c 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -172,6 +172,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) int result, num_enabled = 0; struct acpi_memory_info *info; int node; + mhp_t mhp_flags = MHP_NONE; node = acpi_get_node(handle); /* @@ -194,8 +195,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) if (node < 0) node = memory_add_physaddr_to_nid(info->start_addr); + if (mhp_supports_memmap_on_memory(info->length)) + mhp_flags |= MHP_MEMMAP_ON_MEMORY; result = __add_memory(node, info->start_addr, info->length, - MHP_NONE); + mhp_flags); /* * If the memory block has been used by the kernel, add_memory()