Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1009551pxb; Thu, 23 Sep 2021 15:55:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLK8vwU7esODdlZ5eGw9KzQgjRIz8UL1V16a2pXnorut1M6ODa+as8/U4Vo5iBQ01kYcZV X-Received: by 2002:a6b:5d10:: with SMTP id r16mr6007710iob.148.1632437755068; Thu, 23 Sep 2021 15:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632437755; cv=none; d=google.com; s=arc-20160816; b=g9I/1hNuaeZEGjlxEm28lMKExxAqq6HTWisyO6S2J6X9R2sPrX7YVrinTc6vMG6NzI O9HYnsZpOJAcef32GUlAHKcLInsSh9R5k+UfZJyD77FOpiJbrz8WvhrbXVOs4P5NZaQY RMOIZ462knHaTUx7A/Ah9qJIdcK0AO/tYg8lldrW5hTEh0cIUDXXNrDovmqV1wHLQ/CH mUIkHxasl2euV0e1Y1I6Ggw5szb7NqBvsztTwWwZbhUGP05PcOF0JZkwYUfJCpC1rkGb XKES0rdac+F90NCMQOvZiqdoElqhEilK4PZcVUSeGNXTqq7H1SG3UiA8r0zdVs81JmcJ Pu+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=e97zNOiwir1aJze+wIByrdjedbkrWs1OwK8P/jZcHPw=; b=fimtgfkcPAVwwgJVS7UGLaEsRbWix3y6Qwu/n4b1dYl4lW5IphVBudBL6O9nY4X5Ym jLgqlLlAKJLfO1ZT1nVcAngxhasiWoNK1BtVPMTvbhFxVfkJh/w8GJKbjihfuPNCwGVb hiCsmm8KcrHwA07Z5EMLPxSmcLysUfboRqaciHFyQpPlwYno8HxXugINoL2jwVR/wYcr bveMzrKORv1g/WSee7FwWchg7w39KILfDhaMMM7XyJ4IvVPphLUujc57P7JX1rsQua6o PJDaNhA9fDTn9aWSgx5rz4dSuy+x8cYngHm2y0q6ZO5ZpNKihaWLqnUJeO5lzr6qGAic ASSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=H+npWXo7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 189si8114305ioa.5.2021.09.23.15.55.42; Thu, 23 Sep 2021 15:55:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=H+npWXo7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236363AbhIWW4a (ORCPT + 99 others); Thu, 23 Sep 2021 18:56:30 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:20815 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243499AbhIWW43 (ORCPT ); Thu, 23 Sep 2021 18:56:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1632437697; x=1663973697; h=from:to:cc:subject:date:message-id:mime-version; bh=e97zNOiwir1aJze+wIByrdjedbkrWs1OwK8P/jZcHPw=; b=H+npWXo7fzCPMWx+f5orbIkw+HxEEa5OSlyDiqmyMxgMaGHDVG1fRAqe o3m4hvOhPY+Cc+O4+tLhPPtGhw+OIlARGzAlRqSljmG40RccIne/GR9P2 OsEIXsDFmwMrYYok/EamT61XH5okacc7RKFhi+io42DUGgLoFCzvVADcl c=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 23 Sep 2021 15:54:57 -0700 X-QCInternal: smtphost Received: from nalasex01a.na.qualcomm.com ([10.47.209.196]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2021 15:54:56 -0700 Received: from hu-cgoldswo-sd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Thu, 23 Sep 2021 15:54:55 -0700 From: Chris Goldsworthy To: Catalin Marinas , Will Deacon , Andrew Morton CC: David Hildenbrand , , , , Chris Goldsworthy Subject: [RFC] arm64: mm: update max_pfn after memory hotplug Date: Thu, 23 Sep 2021 15:54:47 -0700 Message-ID: X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On arm64 we set max_pfn at boot in arch/arm64/mm/init.c. If you hotplug in memory after booting up, max_pfn is not updated. This breaks diagnostic functions executed from user space like read_page_owner(): https://elixir.bootlin.com/linux/v5.14.7/source/mm/page_owner.c#L472 or kpageflags_read() (see how get_max_dump_pfn() is used): https://elixir.bootlin.com/linux/v5.14.7/source/fs/proc/page.c#L47 Thus, this patch updates max_pfn and max_low_pfn in arm64's arch_add_memory() function, mirroring what is updatated during boot: https://elixir.bootlin.com/linux/v5.14.7/source/arch/arm64/mm/init.c#L448 We would appreciate feedback on any other variables that should be updated when hotplugging in memory - note that we're mirroring x86, in that max_pfn is only ever incremented when calling arch_add_memory(): https://elixir.bootlin.com/linux/v5.14.7/source/arch/x86/mm/init_64.c#L958 Sudarshan Rajagopalan (1): arm64: mm: update max_pfn after memory hotplug arch/arm64/mm/mmu.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4