Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp796211lqa; Sun, 28 Apr 2024 05:01:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUE7JFW3Np7BvEWrJHmQbVczsfdYSJxckyn10V0Xd/N9pxen9HA7nwJlt94tgD7bX+MgDBXQzQVP3rEA4+DvefuiXI5QVtOCfzIqTtQ+Q== X-Google-Smtp-Source: AGHT+IHMiVAozkGGiVDYdz+pcLdJVZ3LfMzXzyjpy+oJ24rku1jD92txm00NkruznMxyNhQSC5Ls X-Received: by 2002:a05:6a21:3181:b0:1af:3870:20dc with SMTP id za1-20020a056a21318100b001af387020dcmr5616571pzb.55.1714305714446; Sun, 28 Apr 2024 05:01:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714305714; cv=pass; d=google.com; s=arc-20160816; b=NUi3DRqh0iI+AI9Q5fdfIGJW4LrF5PNdupq3hxOh1HYyP/7kVL6hQJ5u/nUpj7RWdB thnnnZ/vbzn9vAhUflw0OfYrgXqZq1CxEtdKbLkNUAEyyhaLmpJhCflI7x+E1i3TWgmr U1U7iKkZPH/TRjWo4Q9fVzauOtFbbULZzGQ4dgndPdzMSiMYPY94CC7JgVBhWlO9plqK POolyUgxYOmcyFVP8+0lJ4nfRXDa7I3j5DhTupkRBBopG+t3EN8atx+okQu8m2W1o8nz v2UFsYkoLeg4mxffYr0vx+KlgB9q4c1wYmt4H3kGiVTxFh6KRDuH4M2TAQQ5I/Y+wytr 8QBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mWP4+jruKxfHWjWXYSrif5PytcIw8+fbp/c2rBHtE+s=; fh=dCmvRD8QZ+oB4zwFLVkiv3/Bm/R8FGsEQ2nLZVNz7Lk=; b=Gdxsf7jw2thzKZSGnlChsNFt3AkH8lQWx+6kwWM7gKO3azRQKA/l9PD5KZxfKx4Ho4 dUTyYrXc0xbOvyaaSxv8XR/btzoBNZDVcsQn9mMsaxIXGMErEXqwZax/dLHIxODS5sA8 8012JUQcM9nkyaC5w5uSCFIf9o2b3Uzse6gWDoLLWVaQwt38KqVT9v4iiJFESK5Rxs6x PU1x06VquD8/Ake2aEH7ik15WB8ONfLFkpPxcmDoaTQtv6Iyf1HyJWJDGSP1dOWJjyGY ttJ16KJhBjIeYHsJCvR93xmD4v1iYY8tfiy/WnIOHLHxLjuKMgmEIHCovuHwhvOzREik EUiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qUHwloOm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-161406-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161406-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 33-20020a630a21000000b005f41af02e20si18276944pgk.570.2024.04.28.05.01.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 05:01:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161406-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qUHwloOm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-161406-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161406-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 188E82819F5 for ; Sun, 28 Apr 2024 12:01:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9761E69DFA; Sun, 28 Apr 2024 12:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qUHwloOm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF6D167C43; Sun, 28 Apr 2024 12:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714305708; cv=none; b=OD9zK1rHaInCV6MQbuXjhPjCfDw0m2SYnylq/ZEeI4WkitU7NjbBBzfYjRsu/1lmAYBcA8si9KhXtRN5j51nmeb1tGURWp5qzjO+5E+lUKcJ7YEs/R6ZiSpdHv1vi2Gui0zi19r7S+um0LFJH9jywE8w/A7jByPD5sNBaPoiM8U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714305708; c=relaxed/simple; bh=xQA0aeIVCOl9cvhNh35c+pjMwnZaLPISTQQzeLHDgxU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N9ZC1Q5OPWO+JerkaZ6VqQlxTHfKirm55A5aSm0IvI+TrdryGBCeqUYMG6ZmWn5ww53ejrGq4v6Y8FXnK/UdC/WRLXH2scchOSxMzefu2724ZQHRiGfSQY9XZWOyz9WtewN6vA19Cd+AnD3dfAUItOp8kEeiNE/4F/r8+CIulEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qUHwloOm; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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.