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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8862DC433FE for ; Fri, 1 Oct 2021 06:37:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69EC0619E9 for ; Fri, 1 Oct 2021 06:37:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352224AbhJAGiu (ORCPT ); Fri, 1 Oct 2021 02:38:50 -0400 Received: from foss.arm.com ([217.140.110.172]:36304 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbhJAGiq (ORCPT ); Fri, 1 Oct 2021 02:38:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1662B113E; Thu, 30 Sep 2021 23:37:02 -0700 (PDT) Received: from [10.163.74.5] (unknown [10.163.74.5]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC9613F718; Thu, 30 Sep 2021 23:36:58 -0700 (PDT) Subject: Re: [PATCH] arm64: mm: update max_pfn after memory hotplug To: Chris Goldsworthy , Andrew Morton Cc: David Hildenbrand , Catalin Marinas , Will Deacon , Sudarshan Rajagopalan , Georgi Djakov , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Florian Fainelli References: From: Anshuman Khandual Message-ID: Date: Fri, 1 Oct 2021 12:08:05 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/29/21 12:21 AM, Chris Goldsworthy wrote: > From: Sudarshan Rajagopalan > > After new memory blocks have been hotplugged, max_pfn and max_low_pfn > needs updating to reflect on new PFNs being hot added to system. > Without this patch, debug-related functions that use max_pfn such as > get_max_dump_pfn() or read_page_owner() will not work with any page in > memory that is hot-added after boot. > > Fixes: 4ab215061554 ("arm64: Add memory hotplug support") > Signed-off-by: Sudarshan Rajagopalan > Signed-off-by: Chris Goldsworthy > Acked-by: David Hildenbrand > Cc: Florian Fainelli > Cc: Georgi Djakov > --- > arch/arm64/mm/mmu.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index cfd9deb..fd85b51 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1499,6 +1499,11 @@ int arch_add_memory(int nid, u64 start, u64 size, > if (ret) > __remove_pgd_mapping(swapper_pg_dir, > __phys_to_virt(start), size); > + else { > + max_pfn = PFN_UP(start + size); > + max_low_pfn = max_pfn; > + } Do these variables get updated on *all* platforms that support memory hotplug via an arch_add_memory() ? If not, dont they all face similar issues as well ? Why not just update these in generic hotplug instead , after looking into arch_add_memory() return code. > + > return ret; > } > >