Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754782AbcLODIa (ORCPT ); Wed, 14 Dec 2016 22:08:30 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:12818 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754606AbcLODI3 (ORCPT ); Wed, 14 Dec 2016 22:08:29 -0500 Subject: Re: [PATCH] arm64: mm: Fix NOMAP page initialization To: Robert Richter References: <1481307042-29773-1-git-send-email-rrichter@cavium.com> <83d6e6d0-cfb3-ec8b-241b-ec6a50dc2aa9@huawei.com> <9168b603-04aa-4302-3197-00f17fb336bd@huawei.com> <20161214094542.GE5588@rric.localdomain> CC: Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , David Daney , "Mark Rutland" , Hanjun Guo , "James Morse" , , , , Hanjun Guo , Xishi Qiu From: Yisheng Xie Message-ID: <4bc9df75-1b67-2428-184e-ce52b5f95528@huawei.com> Date: Thu, 15 Dec 2016 11:01:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20161214094542.GE5588@rric.localdomain> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1609 Lines: 58 hi Robert, On 2016/12/14 17:45, Robert Richter wrote: > On 12.12.16 17:53:02, Yisheng Xie wrote: >> It seems that memblock_is_memory() is also too strict for early_pfn_valid, >> so what about this patch, which use common pfn_valid as early_pfn_valid >> when CONFIG_HAVE_ARCH_PFN_VALID=y: >> ------------ >> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h >> index 0f088f3..9d596f3 100644 >> --- a/include/linux/mmzone.h >> +++ b/include/linux/mmzone.h >> @@ -1200,7 +1200,17 @@ static inline int pfn_present(unsigned long pfn) >> #define pfn_to_nid(pfn) (0) >> #endif >> >> +#ifdef CONFIG_HAVE_ARCH_PFN_VALID >> +static inline int early_pfn_valid(unsigned long pfn) >> +{ >> + if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) >> + return 0; >> + return valid_section(__nr_to_section(pfn_to_section_nr(pfn))); >> +} > > I sent a V2 patch that uses pfn_present(). This only initilizes > sections with memory. hmm, maybe I do not quite catch what your mean, but I do not think pfn_present is right for this case. IMO, The valid_section() means the section with mem_map, not section with memory. And: pfn_present -> present_section which means the section is present but may not have mem_map, so it may not have page struct at all for that section. Please let me know, if I miss anything. Thanks, Yisheng Xie. > > -Robert > >> +#define early_pfn_valid early_pfn_valid >> +#else >> #define early_pfn_valid(pfn) pfn_valid(pfn) >> +#endif >> void sparse_init(void); >> #else >> #define sparse_init() do {} while (0) >> >> >> > >