lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAATEi5ksY-v7-LEqNZWFV5hsHiegNEtrh4LpMWOQ=vT7hC0Rng@mail.gmail.com>
Date: Fri, 19 Apr 2024 10:59:52 +0900
From: DaeRo Lee <skseofh@...il.com>
To: Mike Rapoport <rppt@...nel.org>
Cc: robh@...nel.org, saravanak@...gle.com, akpm@...ux-foundation.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, linux-mm@...ck.org, 
	Daero Lee <daero_le.lee@...sung.com>
Subject: Re: [PATCH v2] memblock: add no-map alloc functions

2024년 4월 19일 (금) 오전 10:46, DaeRo Lee <skseofh@...il.com>님이 작성:
>
> 2024년 4월 19일 (금) 오전 3:04, Mike Rapoport <rppt@...nel.org>님이 작성:
> >
> > On Thu, Apr 18, 2024 at 11:54:15PM +0900, DaeRo Lee wrote:
> > > 2024년 4월 17일 (수) 오후 3:03, Mike Rapoport <rppt@...nel.org>님이 작성:
> > > >
> > > > On Tue, Apr 16, 2024 at 09:06:35PM +0900, skseofh@...il.com wrote:
> > > > > From: Daero Lee <daero_le.lee@...sung.com>
> > > > >
> > > > > Like reserved-memory with the 'no-map' property and only 'size' property
> > > > > (w/o 'reg' property), there are memory regions need to be allocated in
> > > > > memblock.memory marked with the MEMBLOCK_NOMAP flag, but should not be
> > > > > allocated in memblock.reserved.
> > > >
> > > > This still does not explain why you need such regions.
> > > >
> > > > As Wei Yang explained, memblock does not allocate memory from
> > > > memblock.reserved. The memblock.reserved array represents memory that is in
> > > > use by firmware or by early kernel allocations and cannot be freed to page
> > > > allocator.
> > > Thank you for your comments. I used the wrong word.
> > > When I use 'allocate', I mean that the region 'adds' to the memblock.reserved.
> > >
> > > >
> > > > If you have a region that's _NOMAP in memblock.memory and is absent in
> > > > memblock.reserved it will not be mapped by the kernel page tables, but it
> > > > will be considered as free memory by the core mm.
> > > >
> > > > Is this really what you want?
> > > If my understanding is right, before freeing (memory && !reserved)
> > > area, we marked the memblock.reserved regions and memblock.memory
> > > regions with no-map flag. And when we free (memory && !reserved) area,
> > > we skip the memblock.memory regions with no-map(see
> > > should_skip_region). So, I think that the memory regions with no-map
> > > flag will not be considered as free memory.
> >
> > You are right here.
> >
> > But I still don't understand *why* do you want to change the way
> > early_init_dt_alloc_reserved_memory_arch() works.
>
> In memmap_init_reserved_pages, we mark memblock.reserved as
> PageReserved first and mark the memblock.reserved with nomap flag
> also.
Sorry. This is my mistake. 'memblock.memory with nomap flag' is right.

> -> Isn't this duplicated work? (If we add no-map region to
> memblock.reserved 'and' mark in memblock.memory..)
> So, I think that for the no-map region, we don't need to add to the
> memblock.reserved.
> This is what we do now in early_init_dt_reserve_memory. the nomap
> region is not added to the memblock.reserved.
>
> In early_init_dt_alloc_reserved_memory_arch, if 'nomap' is true, we
> mark the memblock.memory region as _NOMAP. And if the return value
> 'err' is not zero(which is '-ENOMEM' from memblock_isolate_range), we
> free the region.
> - 'nomap' is true -> memblock_mark_nomap : success -> not free the region
>
> : fail -> free the region
> And it can be said that we add the region to the memblock.reserved
> using memblock_phys_alloc_range and if the region is nomap, then we
> can free the region from memblock.reserved. But is it necessary to add
> it to memblock.reserved? We just need the region in memblock.memory to
> mark nomap.
>
> 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
>
> Regards,
> DaeRo Lee

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ