Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2706394ybh; Fri, 24 Jul 2020 22:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyda42wdhJftcoz/0W6Af4elS7Rm5yAzQUyM9HUH4n2nefQs/x80/plrm9r1wi2p7rb5dne X-Received: by 2002:a17:906:4b16:: with SMTP id y22mr12284363eju.4.1595654157851; Fri, 24 Jul 2020 22:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595654157; cv=none; d=google.com; s=arc-20160816; b=bU6gq2tyJRKmlIMtba8xP1XUnoOnhK8w0ka9SK0SVprAOrUKS3aw8VrS20ZJf4N7SN sA7AD+Vhl89yoSfWgSldNIEAuwhfy0HVjfMM2xzaPzaYCJJq+RrnKJfKYqxLUZJ9V50l QnaayqDybNNI8afPkd6kqRYddzgrOQ7mj9Oj6KxLOS7JMENRZXebs5Wbg4kpnYim/Akf SnpmsTf8SNS9x41NeWrW49TxxP8vHENGdLk47SQvLlUJRJLjEhBMPZwKL+R6oY0RWb8V PbU8KNW3B67F7mgq4Nxp06bytPzlhLjYVJcwsw32s8cX+sc2e+ppzzHPIZ4BCYVSBbbZ fsag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=Q/SEp1IUfbBlV7LP81dOutu3bytkejFynPFlKD4ZJG4=; b=b92aleCUinH2hYNyeae3+rWfMvkPK5nVSe2goMZZMYcLcPO8S/hVZsMwQK2FnwbLRl JhiOYh23pZHPc3xaV0vgsAvq9qQwR+TBr4eOG2ADyGmKmVXVsdTEtjoBKnOOWqs2GHlm lTWYK8my7ivP5F6LLpFz4eJ76bsNivBoy0ESqXqMdBOlKPAjtdpN2VsxkWWVC+O1LvMW rPJHOVK4ZrEyNYUGmWACeA70bt2iUkRwVGpeDf7c4U366avEd8g3Qz00/ldxmdhydTG8 ry9xWtngeS5B92i3mKAc3Dxp7b8qgOaLXYhs7NEu3ZoUIj+HyZSmK6qGMD2RJ0pEtlc9 pDLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b="fNwK/byX"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si1979883ejr.172.2020.07.24.22.15.35; Fri, 24 Jul 2020 22:15:57 -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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b="fNwK/byX"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbgGYFMn (ORCPT + 99 others); Sat, 25 Jul 2020 01:12:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbgGYFMl (ORCPT ); Sat, 25 Jul 2020 01:12:41 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44386C0619D3 for ; Fri, 24 Jul 2020 22:12:41 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id t6so6551484pgq.1 for ; Fri, 24 Jul 2020 22:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=Q/SEp1IUfbBlV7LP81dOutu3bytkejFynPFlKD4ZJG4=; b=fNwK/byX6yrilqyV2sQALIcpb63IuFOUy0tZ7WtIG0GUB7qNh4L5FssW/tFCNUTyIn E/lzsylfzN3ybuqdgd5r3ZyGS8LMth20sRHr5VDXMA3zF3Vn3+0kmTHRe6J7abRoiUeN l8aYBLb0Mtjs1M++nehKhuEt7QX+eD/825oGLykzhnVOH3Q0la6O8riJf2WOuZhEYzxp dUM+s2n8rjIg4yeNiXg/xDykqnsk5cgupRzGOMkjw7KMzz/EC0+ceaQ083AWsidGgqhP G5WpwMTbuqRg+lcpC8xkyOy9bFL5XpCHzUbvI3fcTU3wlwyhKV4eZFlTljjZjhKLNiXM DOWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=Q/SEp1IUfbBlV7LP81dOutu3bytkejFynPFlKD4ZJG4=; b=tzF+z/i/EEgvZ8WS1pmTcrFFQk6EohhRo/wxF0L4FBnlzKCO90pg4DXlp2YEMy4buJ RvGtNf6Ms9HoxVmH2IEpuZMuoKyq5jlf9AMj7dYYBtukNe29kZ3+jp5WLHN8RfNHlt4H PMqnw6+n/4ObQoimrAOFKncz1vHzwZ1UmBsVfnrEy8JKagTtdYlZcD67yDfxZEL74/h0 2C32yJoodNNO7sM4w3e4mKnkylDWu1kpptVtlpfIXvuwH8Mydg2QR871qLjei1xoXVSt bpadZh40kBB2dlj5ONZP+mvsiskiP3QytuXvyaTkdLP+QgtovP9CPNarAd3r1a/+22BA /Usw== X-Gm-Message-State: AOAM5301mRPrm15tOlPRGmVQ/5xhJLQXi4onQuXNyX81CuyJf+K3ldFE jrgtxvGHD+TOfY9WZE4ENfGmIkNf/nU= X-Received: by 2002:aa7:9189:: with SMTP id x9mr11393378pfa.325.1595653960471; Fri, 24 Jul 2020 22:12:40 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id 7sm7645777pgh.80.2020.07.24.22.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 22:12:39 -0700 (PDT) Date: Fri, 24 Jul 2020 22:12:39 -0700 (PDT) X-Google-Original-Date: Fri, 24 Jul 2020 18:57:25 PDT (-0700) Subject: Re: [PATCH 2/4] RISC-V: Set maximum number of mapped pages correctly In-Reply-To: <20200715233009.27183-3-atish.patra@wdc.com> CC: linux-kernel@vger.kernel.org, Atish Patra , aou@eecs.berkeley.edu, Anup Patel , greentime.hu@sifive.com, linux-riscv@lists.infradead.org, Paul Walmsley , sudeep.holla@arm.com, vincent.chen@sifive.com, zong.li@sifive.com From: Palmer Dabbelt To: Atish Patra Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 15 Jul 2020 16:30:07 PDT (-0700), Atish Patra wrote: > Currently, maximum number of mapper pages are set to the pfn calculated > from the memblock size of the memblock containing kernel. This will work > until that memblock spans the entire memory. However, it will be set to > a wrong value if there are multiple memblocks defined in kernel > (e.g. with efi runtime services). > > Set the the maximum value to the pfn calculated from dram size. > > Signed-off-by: Atish Patra > --- > arch/riscv/mm/init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index f4adb3684f3d..8d22973bde40 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -150,9 +150,9 @@ void __init setup_bootmem(void) > /* Reserve from the start of the kernel to the end of the kernel */ > memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); > > - set_max_mapnr(PFN_DOWN(mem_size)); > max_pfn = PFN_DOWN(memblock_end_of_DRAM()); > max_low_pfn = max_pfn; > + set_max_mapnr(max_low_pfn); > > #ifdef CONFIG_BLK_DEV_INITRD > setup_initrd(); This one I'm putting on fixes, as there's nothing preventing us from having multiple memory regions in a current boot and this seems very safe.