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 CFBE4C433F5 for ; Tue, 28 Sep 2021 07:33:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 777A0610E6 for ; Tue, 28 Sep 2021 07:33:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 777A0610E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 00AA3900003; Tue, 28 Sep 2021 03:33:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFBEB900002; Tue, 28 Sep 2021 03:33:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC483900003; Tue, 28 Sep 2021 03:33:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id CCFAE900002 for ; Tue, 28 Sep 2021 03:33:45 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7CA97181AEF2A for ; Tue, 28 Sep 2021 07:33:45 +0000 (UTC) X-FDA: 78636167610.37.CF4CE7B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 0966C1903 for ; Tue, 28 Sep 2021 07:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632814424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OYz+v29nGxeHeDCVuishN/mp+dYCX8a4fOHFuVjh5gs=; b=jPhLgSNVnFH9SSCJ7U5Y+QNvuJHb3rg32xErR9QZYA+VCDmeE1kUZwpg4ZVjstxHWke1WC Weg/cPwlXZzIXgrzScf5FXKlcRPf5sUZuN96cArhpBNfYP1uoR9e0E22wv3EruA2PaJdSY ikvUt0dh8ScY26HvTvpoRZIE9bWaruQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-emSLQPmtMv-p-B-sxGc-Cw-1; Tue, 28 Sep 2021 03:33:40 -0400 X-MC-Unique: emSLQPmtMv-p-B-sxGc-Cw-1 Received: by mail-wr1-f69.google.com with SMTP id u7-20020adfed47000000b0016061b6caa8so4051586wro.16 for ; Tue, 28 Sep 2021 00:33:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=OYz+v29nGxeHeDCVuishN/mp+dYCX8a4fOHFuVjh5gs=; b=vr0Fil+gwQmkrVEfax8CwRW5kLraMsvETovnQGWOPLr6u9+FH7YqmKAZ/UlkSUqGQS MjK/pH5c3OzUbfGzhaB7c3FZ348SzQV9u9hB7m/+uX4GaYAFfoRiBidqHh8OYaml+Rxh ubn3cjr/0xaCwfmDDDiCYbxLOpjHZ0LhPFQEib38ZJnh9RsxePIk3LHLVcudAhqnbkLI uXjB79XG/ReP1lfOd9dOQ+v2RzPc1UJGhDORV2cKJzTNgW0Wm1BNuJ/Fy0VKfUzhFqn1 bnt8FEPI0NIwNzEC+pxUEJlWwBF1ZfZjd+92rheP5EkEeLFEqi3X0aJLHhzwvom2HCZl eS5g== X-Gm-Message-State: AOAM533Ni7b3qYforuICXTwsGGtaWlAltUoEX4DdLI2dtWlcZXoWFdwW yfuH9+q54TAFUt3QW9d06MzpT7YpoEht/EBJnoCLofHGF8lTAgzBSPAMAYSo/9XfSrg9Tg7QnA8 pPzx7DnCpryE= X-Received: by 2002:a1c:7508:: with SMTP id o8mr3225594wmc.104.1632814419780; Tue, 28 Sep 2021 00:33:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxWXiGZvnB6GUJwp2DOW/nbkfRswJql3lOq0+lQkDQGwa+PRs4wC1QT/i6WPZ62UWk/FJ+6w== X-Received: by 2002:a1c:7508:: with SMTP id o8mr3225559wmc.104.1632814419395; Tue, 28 Sep 2021 00:33:39 -0700 (PDT) Received: from [192.168.3.132] (p4ff23aaf.dip0.t-ipconnect.de. [79.242.58.175]) by smtp.gmail.com with ESMTPSA id g25sm18544739wrc.88.2021.09.28.00.33.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Sep 2021 00:33:38 -0700 (PDT) Subject: Re: [RFC] arm64: mm: update max_pfn after memory hotplug To: Chris Goldsworthy , Georgi Djakov Cc: Catalin Marinas , Will Deacon , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sudarshan Rajagopalan References: <595d09279824faf1f54961cef52b745609b05d97.1632437225.git.quic_cgoldswo@quicinc.com> <833493d2-d585-47ee-c258-79eae5deff36@redhat.com> <20210928061016.GA28837@hu-cgoldswo-sd.qualcomm.com> From: David Hildenbrand Organization: Red Hat Message-ID: <94d477d0-5d05-b2c3-850e-0a749c888f3b@redhat.com> Date: Tue, 28 Sep 2021 09:33:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210928061016.GA28837@hu-cgoldswo-sd.qualcomm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0966C1903 X-Stat-Signature: fi6hdz9ytm65pdbzt3o9x964aizm5es4 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jPhLgSNV; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf22.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1632814424-580215 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: On 28.09.21 08:12, Chris Goldsworthy wrote: > On Tue, Sep 28, 2021 at 02:22:59AM +0300, Georgi Djakov wrote: >> On 9/27/2021 6:51 PM, David Hildenbrand wrote: >>> On 24.09.21 00:54, Chris Goldsworthy wrote: >>>> From: Sudarshan Rajagopalan >>>> >>>> After new memory blocks have been hotplugged, max_pfn and max_low_pf= n >>>> needs updating to reflect on new PFNs being hot added to system. >>>> >>>> Signed-off-by: Sudarshan Rajagopalan >>>> Signed-off-by: Chris Goldsworthy >>>> --- >>>> =C2=A0 arch/arm64/mm/mmu.c | 5 +++++ >>>> =C2=A0 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 s= ize, >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (ret) >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __remove_pgd= _mapping(swapper_pg_dir, >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __phys_to= _virt(start), size); >>>> +=C2=A0=C2=A0=C2=A0 else { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 max_pfn =3D PFN_UP(start= + size); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 max_low_pfn =3D max_pfn; >>>> +=C2=A0=C2=A0=C2=A0 } >>>> + >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return ret; >>> >>> Note: didn't verify if updating max_low_pfn is correct here. >> >> My understanding is that max_low_pfn defines the low/high memory >> boundary and it should be also updated. >> >> Thanks, >> Georgi >=20 > To build more on Georgi's response, our assumption here after an offlin= e > discussion is that max_low_pfn would not be equal to max_pfn only if th= ere is > high memory - another assumption is that arm64 kernels will not need hi= gh memory > due to their large logical mappings. Under these two assumptions, the p= atch is > correct. Perhaps Catalin can ack or critique this, as he initially set = max_pfn =3D > max_low_pfn in the first arm64 mm initialization code: Makes sense to me, thanks. --=20 Thanks, David / dhildenb