On Sun, Apr 28, 2024 at 07:36:40PM +0900, DaeRo Lee wrote: > 2024년 4월 28일 (일) 오후 3:35, Mike Rapoport <rppt@xxxxxxxxxx>님이 작성: > > > > On Sat, Apr 27, 2024 at 07:24:23PM +0900, DaeRo Lee wrote: > > > 2024년 4월 27일 (토) 오후 5:50, Mike Rapoport <rppt@xxxxxxxxxx>님이 작성: > > > > > > > > > > > > So, here is what I think: > > > > > > - reserved-memory w/ nomap region -> mark only to memblock.memory > > > > > > - reserved-memory w/o nomap region -> add to the memblock.reserved > > > > > > > > NOMAP and memblock.reserved are semantically different, and at makes sense > > > > to have a "reserved nomap" node in fdt recorded in both memblock.memory and > > > > memblock.reserved. > > > > > > > > memblock.reserved represents the memory that is used by firmware or early > > > > kernel allocation, so reserved memory in fdt should be reserved in memblock > > > > as well. I believe it's an oversight that early_init_dt_reserve_memory() > > > > does not call memblock_reserve() for nomap memory. > > > > > > > > NOMAP is a property of a memory region that says that that region should > > > > not be mapped in the linear map, it's not necessarily in use. > > > > > > I agree that the NOMAP region should be added to memblock.reserved. > > > > > > So, I think we need to clean-up memmap_init_reserved_pages, because in > > > this function we call reserve_bootmem_region for memblock.reserved and > > > memblock.memory with nomap. We don't need to call > > > reserve_bootmem_region for nomap. > > > > Read the comment about memblock_mark_nomap() > I read the comment about memblock_mark_nomap() and understood that > regions with nomap flags should be treated as PageReserved. > But, if we add this nomap region to memblock.reserved, the region with > nomap flag will be processed in the first for-loop in > memmap_init_reserved_pages. memblock still must make sure that pages in nomap regions get PG_Reserved to be robust against potential errors and bugs in firmware parsing. > Am I thinking wrong? > > Regards, > DaeRo Lee -- Sincerely yours, Mike.