From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54356C4345F for ; Sun, 28 Apr 2024 12:01:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A39B86B007B; Sun, 28 Apr 2024 08:01:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9EA4B6B0083; Sun, 28 Apr 2024 08:01:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B1E96B0085; Sun, 28 Apr 2024 08:01:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6D3556B007B for ; Sun, 28 Apr 2024 08:01:52 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EBB91A1430 for ; Sun, 28 Apr 2024 12:01:51 +0000 (UTC) X-FDA: 82058801622.29.29F7528 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 1F3BCC0018 for ; Sun, 28 Apr 2024 12:01:49 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qUHwloOm; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714305710; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mWP4+jruKxfHWjWXYSrif5PytcIw8+fbp/c2rBHtE+s=; b=iSxuU9A7BTrDaLi5xOfp4+tgd59gJPe3ijd6tuS0Z9AYuJB+Pd/UL/mXg9aoFyp5V91Fyr UXYl8hdzKK85wcDbdcvzw3jNq+7vRxsVjTWf0r3kzaC8xiyRrVAgAAIwB0muzadRndWHWR HkP4ItIafkjExPs15glHy9ELEh0i7rs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714305710; a=rsa-sha256; cv=none; b=o5tqXj2/OfT4j3frmDcgmz36n7EIJnj/nj4CcXBg/nudA8RgV/eUArA3ZEG8HxVLaQXs0q jcYCF4Hhriut+U8j3PdBKnGwjk64yxbRn627MwF3gMxFvhDf8y/pAGek7aRjX66ZzRZEk+ hRPSo1lzwN6dxXdKd+1aBXwbkmjhJ7Q= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qUHwloOm; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F2C896023A; Sun, 28 Apr 2024 12:01:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB6FEC113CC; Sun, 28 Apr 2024 12:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714305708; bh=xQA0aeIVCOl9cvhNh35c+pjMwnZaLPISTQQzeLHDgxU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qUHwloOmhu/Cl4Rnk3U4Kiqr72C27OEJ51SLFwtFAOCmcMKqCfGoXgbJkb4zMmXiP DuSGUed+qZj/L3OiFbnseekaGbVmZqvIqnyKyi9BBePeMlxZr3z4eH3UI+THbKGiAt A+NkqPjThCvwdQ1jv+7/MC93b/MUTRke0bJQvZU5mmXiiehIaO+6TFHi6WqegQE4kt kpd9KeGEqNpv19ohU+81Q0V0oYbOJDqDEq+UrXCXneiw7A2hQgvt4PbigECnneuXoo sq+I43d+FUmaGsVlNBC5OG5/RtyMnTUIsKIV/MHsyOnxFIqqA1LC1QqwoYXLBbEKaM 2M1WYZssXOzOQ== Date: Sun, 28 Apr 2024 15:00:26 +0300 From: Mike Rapoport To: DaeRo Lee Cc: robh@kernel.org, saravanak@google.com, akpm@linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Daero Lee Subject: Re: [PATCH v2] memblock: add no-map alloc functions Message-ID: References: <20240416120635.361838-2-skseofh@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 1F3BCC0018 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: n8mj3rjywpz1xzeu6mkyj8gcqkch45gi X-HE-Tag: 1714305709-202492 X-HE-Meta: U2FsdGVkX1+Q9N2jRIaDaSLqoZz1KvZN9tfI7/WbBK7SMtbyf/VKaWIOTMjOntm1Z/ATAsk4c7rvN1C8UR5piKC0c4DeF2NBmVP/VyFTx/fUPqqJJsDSWE50QYDwhYPGyjTeuuEhm9Av+O9mF6bb1f6SmBFh7gxvl7w1wDAKq5lY1hKEQYWd1R3yyZjXSVZn4nJgk9q9yp+jhLtHc0NFq0k3+R0lDdugAsuA83yS5Jgk0rCICLhIG5EakQ0C+7CpAw6WjTI42LYs/6DD3CuT89SH0ZrYSgmGBrkRaF/Z12USYbJ9KfaeWrZetdi5ZleROducZA8ldyViaqtmuJgWWhx7ED3vEqsKfoOjqyiUQmvO5daQAB3aLsMYyF5+JOk/Jmf1x6emrlR41c4Vcau0QiGCM1oixLggMzjhLgeibtWVumXt0nEaGPlVN2UW9puYmXIyyhCJIeB+blsJc/6lNlgWp429ntWd4GSg20MEiGeQsx3ygjko/sm15BR/eoFim0lEojleitYbs0AWRGOOFBSPc7WljZqJ+JwU7QjLxeh5i89fBlN8lD2OGPiKd4t4Voe5sy0xh9udscXhAgBzK04FNhb4RMys2IoEABSVkuCL4asbownVGGZLvrn/FUbISAafc4twlFHLTFtKe0x8e1zPraNlFfmI1iAcIn7wqcqT9aeNWDBhDg2bcCXF4fUzqteT2vKX+nNXmrGJFCrrrXUxx0smvBtWvpsLPGq5TgnBDpzv4fzZukVNkAFrpViRBxTZea0LUOwqYexw6O5h8ZnVyE1D0zwA4OFRZqqNf0zv0BuS/QrdIh+WZFchgS+MQLZJQZkFl7D/enEhoIBiFGRJxgaHeLRJyfN3vCWZP0HXOykWs1x10tdkZoq9WIN01SLIdnVbvWzRpo4gILxeF6/AUJ9rf/ze+TuG1by44BEVkmo066IAr69g+pMP8inkBpcAYK6pkKrA2JHv2ZY GEfpYxq8 pBf+ksE+T88+7T+YZH1Na7HcLYzRq8qM+unuGhw7H+qgKg0hOXiDqr+J9y0MqVJi3jRdMHdlhxO3HklrM+80bZanP7i1KsOFszHWh3Gm9nr4KZR2UAuIhbrigMg+N9pZ7MlYP11DOO7GA5RXHywkG6Rg+uAdDckJyBO+yLNIUHL5aIrUuqhO6ge+MvkWhwZU8mwUYOLRB0a0VtcUZTRBnlIWFX3VHbVuRYFADSyapkzO6b2fP0aFIu5CH6LGa6YNyLtX4nQC0kHuTtubUeF0K2tO1dQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sun, Apr 28, 2024 at 07:36:40PM +0900, DaeRo Lee wrote: > 2024년 4월 28일 (일) 오후 3:35, Mike Rapoport 님이 작성: > > > > On Sat, Apr 27, 2024 at 07:24:23PM +0900, DaeRo Lee wrote: > > > 2024년 4월 27일 (토) 오후 5:50, Mike Rapoport 님이 작성: > > > > > > > > > > > > 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.