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 78A4FC433EF for ; Wed, 29 Sep 2021 10:29:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 176E6613A7 for ; Wed, 29 Sep 2021 10:29:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 176E6613A7 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 9E1F194001E; Wed, 29 Sep 2021 06:29:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9911C94001D; Wed, 29 Sep 2021 06:29:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8321594001E; Wed, 29 Sep 2021 06:29:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id 6FC4294001D for ; Wed, 29 Sep 2021 06:29:38 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 29A2330C83 for ; Wed, 29 Sep 2021 10:29:38 +0000 (UTC) X-FDA: 78640239636.08.0C04849 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id C9B4230000AF for ; Wed, 29 Sep 2021 10:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632911377; 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=C57om5FTtgEGHf0KUu9I3TAtRy+1t/YR1bYrwybiKdg=; b=ObnAfQC+oZ8P8sQE7XbRP46JkY8iKzU8AWeRQdAqNJYxjW81ojrS5OoF4omZTjqLoh0npi xEsQa64UKr4yl5VO+zvC5l6zjo1RyBZj2pG/I9Rc7Isuv/0c5PQiU1YVTSft1/2Zky2VSP IqbaXyD9Mw5gp3BX1vcb32hpXom0Xn8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-MLp2Pxf1PGyobVw3JEO4Ig-1; Wed, 29 Sep 2021 06:29:35 -0400 X-MC-Unique: MLp2Pxf1PGyobVw3JEO4Ig-1 Received: by mail-wm1-f70.google.com with SMTP id 129-20020a1c1987000000b0030cd1616fbfso2513469wmz.3 for ; Wed, 29 Sep 2021 03:29:35 -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=C57om5FTtgEGHf0KUu9I3TAtRy+1t/YR1bYrwybiKdg=; b=iwzIquQEKRJRE7W5CiIMgt163gN2f7a51LNnRpmkCaeJYOHETPBEUX8XBnGc/WUeQQ yB2IUiqq/qov2cnuBKJTPXncmk7EIraaw3ZCV6ERiUYQdiGKz1hGyDVgb2bAnuXLVg9+ mhzII8C7jsvHIAzZWvx9v3GmI4Pe2+i8QwF18hzVQ2zVQEzZNDjZMzoMDZ/cCK4YwOhc bpjPEI1JwymmKyxW/9vA4sqelJgDaFurrpS57t+kKNGG9f5ypkdxOnPYolbCGacwq7zN +sSjmftYmnx1fT6FGFeGU7SMaR8I7bNh8G5X0ulCX3lty+21g2cxzy4SPtB970vvduFu 7XOQ== X-Gm-Message-State: AOAM531cr8Wx4iO0ASvLh0lWb/ytu8ukLfs7PmS6I9bMPjykG6zsrFIu j0rTCj5bhAd6UI/xCGQNouVsmytPU53a5KYX1YM+4gxzG6mVpVzPo56/jlazfw9MKnGu0w8AN/H de4SccyYFh+s= X-Received: by 2002:adf:f550:: with SMTP id j16mr5595995wrp.41.1632911374182; Wed, 29 Sep 2021 03:29:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoEJW17D0Lrj3daOOwl1NQdJV/1r6ta6M9qUfNhDLFaw6jkYos9wruOZx63emdJSLA+Xnxvw== X-Received: by 2002:adf:f550:: with SMTP id j16mr5595975wrp.41.1632911373970; Wed, 29 Sep 2021 03:29:33 -0700 (PDT) Received: from [192.168.3.132] (p4ff23c3b.dip0.t-ipconnect.de. [79.242.60.59]) by smtp.gmail.com with ESMTPSA id z6sm1654271wmp.1.2021.09.29.03.29.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Sep 2021 03:29:33 -0700 (PDT) Subject: Re: [RFC] arm64: mm: update max_pfn after memory hotplug To: Will Deacon , Chris Goldsworthy Cc: Catalin Marinas , 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> <20210929101028.GB21057@willie-the-truck> From: David Hildenbrand Organization: Red Hat Message-ID: <13f56b37-afc7-bf6f-d544-8d6433588bf9@redhat.com> Date: Wed, 29 Sep 2021 12:29:32 +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: <20210929101028.GB21057@willie-the-truck> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C9B4230000AF X-Stat-Signature: rgqjochfxqdpuimtic8r5m8ophrj6wd5 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ObnAfQC+; spf=none (imf08.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1632911377-47118 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 29.09.21 12:10, Will Deacon wrote: > On Thu, Sep 23, 2021 at 03:54:48PM -0700, 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. >> >> Signed-off-by: Sudarshan Rajagopalan >> Signed-off-by: Chris Goldsworthy >> --- >> 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; >> + } > > We use 'max_pfn' as part of the argument to set_max_mapnr(). Does that need > updating as well? > > Do we have sufficient locking to ensure nobody is looking at max_pfn or > max_low_pfn while we update them? Only the write side is protected by memory hotplug locking. The read side is lockless -- just like all of the other pfn_to_online_page() machinery. > > Will > -- Thanks, David / dhildenb