From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Rutland Date: Fri, 09 Aug 2019 11:44:51 +0000 Subject: Re: [RFC V2 0/1] mm/debug: Add tests for architecture exported page table helpers Message-Id: <20190809114450.GF48423@lakrids.cambridge.arm.com> List-Id: References: <1565335998-22553-1-git-send-email-anshuman.khandual@arm.com> <20190809101632.GM5482@bombadil.infradead.org> In-Reply-To: <20190809101632.GM5482@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Matthew Wilcox Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Tetsuo Handa , James Hogan , Heiko Carstens , Michal Hocko , linux-mm@kvack.org, Paul Mackerras , sparclinux@vger.kernel.org, Thomas Gleixner , linux-s390@vger.kernel.org, Michael Ellerman , x86@kernel.org, Russell King - ARM Linux , Steven Price , Jason Gunthorpe , linux-arm-kernel@lists.infradead.org, linux-snps-arc@lists.infradead.org, Kees Cook , Anshuman Khandual , Masahiro Yamada , Mark Brown , Dan Williams , Vlastimil Babka , Sri Krishna chowdary , Ard Biesheuvel , Greg Kroah-Hartman , Dave Hansen , linux-mips@vger.kernel.org, Ralf Baechle , linux-kernel@vger.kernel.org, Peter Zijlstra , Mike Rapoport , Paul Burton , Vineet Gupta , Martin Schwidefsky , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" On Fri, Aug 09, 2019 at 03:16:33AM -0700, Matthew Wilcox wrote: > On Fri, Aug 09, 2019 at 01:03:17PM +0530, Anshuman Khandual wrote: > > Should alloc_gigantic_page() be made available as an interface for general > > use in the kernel. The test module here uses very similar implementation from > > HugeTLB to allocate a PUD aligned memory block. Similar for mm_alloc() which > > needs to be exported through a header. > > Why are you allocating memory at all instead of just using some > known-to-exist PFNs like I suggested? IIUC the issue is that there aren't necessarily known-to-exist PFNs that are sufficiently aligned -- they may not even exist. For example, with 64K pages, a PMD covers 512M. The kernel image is (generally) smaller than 512M, and will be mapped at page granularity. In that case, any PMD entry for a kernel symbol address will point to the PTE level table, and that will only necessarily be page-aligned, as any P?D level table is only necessarily page-aligned. In the same configuration, you could have less than 512M of total memory, and none of this memory is necessarily aligned to 512M. So beyond the PTE level, I don't think you can guarantee a known-to-exist valid PFN. I also believe that synthetic PFNs could fail pfn_valid(), so that might cause us pain too... Thanks, Mark.