RE: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory

Jaewon Kim posted 10 patches 1 year, 8 months ago
Only 0 patches received!
There is a newer version of this series
RE: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Jaewon Kim 1 year, 8 months ago
>--------- Original Message ---------
>Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
>Date   : 2024-05-21 11:40 (GMT+9)
>Title  : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
>?
>Some of memory regions can be reserved for a specific purpose. They are
>usually defined through reserved-memory in device tree. If only size
>without address is specified in device tree, the address of the region
>will be determined at boot time.
>
>We may find the address of the memory regions through booting log, but
>it does not show all. And it could be hard to catch the very beginning
>log. The memblock_dump_all shows all memblock status but it does not
>show region name and its information is difficult to summarize.
>
>This patch introduce a debugfs node, memblock/memsize, to see reserved
>memory easily.
>
>Here's an example
>
>$ cat debugfs/memblock/memsize
>
>0x0000000000000000-0x0000000000000000 0x02000000 (?  32768 KB )?  map reusable linux,cma
>0x0000000000000000-0x0000000000000000 0x01000000 (?  16384 KB )?  map reusable vxxxxx
>...
>0x0000000000000000-0x0000000000000000 0x004e0000 (? ? 4992 KB ) nomap unusable unknown
>0x0000000000000000-0x0000000000000000 0x00400000 (? ? 4096 KB ) nomap unusable cxxxxx
>0x0000000000000000-0x0000000000000000 0x00e00000 (?  14336 KB ) nomap unusable gxxxxx
>
>Reserved? ? : 1223856 KB
> .kernel? ? :? 275208 KB
>? .text? ?  :?  16576 KB
>? .rwdata?  :? ? 1963 KB
>? .rodata?  :?  11920 KB
>? .bss? ? ? :? ? 2450 KB
>? .memmap?  :? 186368 KB
>? .etc? ? ? :?  55933 KB
> .unusable? :? 948648 KB
>System? ? ? : 11359056 KB
> .common? ? : 10306384 KB
> .reusable? : 1052672 KB
>Total? ? ?  : 12582912 KB ( 12288.00 MB )
>
>Jaewon Kim (10):
>? memblock: introduce memsize showing reserved memory
>? memblock: detect hidden memory hole size
>? memblock: handle overlapped reserved memory region
>? memblock: take a region intersecting an unknown region
>? memblock: track memblock changed at early param
>? memblock: recognize late freed size by checking PageReserved
>? memblock: track kernel size on memsize
>? memblock: print memsize summary information
>? memblock: print kernel internal size
>? memblock: support memsize reusable to consider as reusable
>
> drivers/of/fdt.c? ? ? ? ? ?  |? 11 +
> drivers/of/of_reserved_mem.c |? 12 +-
> include/linux/memblock.h? ?  |? 29 ++
> init/main.c? ? ? ? ? ? ? ? ? |? 13 +-
> kernel/dma/contiguous.c? ? ? |?  9 +-
> mm/Kconfig? ? ? ? ? ? ? ? ?  |? 16 ++
> mm/memblock.c? ? ? ? ? ? ? ? | 502 ++++++++++++++++++++++++++++++++++-
> mm/mm_init.c? ? ? ? ? ? ? ?  |?  6 +-
> mm/page_alloc.c? ? ? ? ? ? ? |? 10 +-
> 9 files changed, 597 insertions(+), 11 deletions(-)
>
>-- 
>2.25.1

Hello Mike 

This is actually RESEND as it was introduced 2 years ago.
Please refer to https://lore.kernel.org/linux-mm/YkQB6Ah603yPR3qf@kernel.org/#t

> But you never provided details about *why* you want this information exposed.

For your question, I'd like to say ;
We can see the same format and exact information between different version of kernel status.

1) Internally we can check if the reserved memory changes.
2) Externally we can communicate between chipset vendors and OEM, with a same format.

This helps us to communitcate well, to easily detect changes or just to see differences.

Jaewon Kim
Re: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Wei Yang 1 year, 8 months ago
On Tue, May 21, 2024 at 11:53:29AM +0900, Jaewon Kim wrote:
>>--------- Original Message ---------
>>Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
>>Date   : 2024-05-21 11:40 (GMT+9)
>>Title  : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
>>?
>>Some of memory regions can be reserved for a specific purpose. They are
>>usually defined through reserved-memory in device tree. If only size
>>without address is specified in device tree, the address of the region
>>will be determined at boot time.
>>
>>We may find the address of the memory regions through booting log, but
>>it does not show all. And it could be hard to catch the very beginning
>>log. The memblock_dump_all shows all memblock status but it does not
>>show region name and its information is difficult to summarize.
>>
>>This patch introduce a debugfs node, memblock/memsize, to see reserved
>>memory easily.
>>
>>Here's an example
>>
>>$ cat debugfs/memblock/memsize
>>
>>0x0000000000000000-0x0000000000000000 0x02000000 (?  32768 KB )?  map reusable linux,cma
>>0x0000000000000000-0x0000000000000000 0x01000000 (?  16384 KB )?  map reusable vxxxxx
>>...
>>0x0000000000000000-0x0000000000000000 0x004e0000 (? ? 4992 KB ) nomap unusable unknown
>>0x0000000000000000-0x0000000000000000 0x00400000 (? ? 4096 KB ) nomap unusable cxxxxx
>>0x0000000000000000-0x0000000000000000 0x00e00000 (?  14336 KB ) nomap unusable gxxxxx
>>
>>Reserved? ? : 1223856 KB
>> .kernel? ? :? 275208 KB
>>? .text? ?  :?  16576 KB
>>? .rwdata?  :? ? 1963 KB
>>? .rodata?  :?  11920 KB
>>? .bss? ? ? :? ? 2450 KB
>>? .memmap?  :? 186368 KB
>>? .etc? ? ? :?  55933 KB
>> .unusable? :? 948648 KB
>>System? ? ? : 11359056 KB
>> .common? ? : 10306384 KB
>> .reusable? : 1052672 KB
>>Total? ? ?  : 12582912 KB ( 12288.00 MB )
>>
>>Jaewon Kim (10):
>>? memblock: introduce memsize showing reserved memory
>>? memblock: detect hidden memory hole size
>>? memblock: handle overlapped reserved memory region
>>? memblock: take a region intersecting an unknown region
>>? memblock: track memblock changed at early param
>>? memblock: recognize late freed size by checking PageReserved
>>? memblock: track kernel size on memsize
>>? memblock: print memsize summary information
>>? memblock: print kernel internal size
>>? memblock: support memsize reusable to consider as reusable
>>
>> drivers/of/fdt.c? ? ? ? ? ?  |? 11 +
>> drivers/of/of_reserved_mem.c |? 12 +-
>> include/linux/memblock.h? ?  |? 29 ++
>> init/main.c? ? ? ? ? ? ? ? ? |? 13 +-
>> kernel/dma/contiguous.c? ? ? |?  9 +-
>> mm/Kconfig? ? ? ? ? ? ? ? ?  |? 16 ++
>> mm/memblock.c? ? ? ? ? ? ? ? | 502 ++++++++++++++++++++++++++++++++++-
>> mm/mm_init.c? ? ? ? ? ? ? ?  |?  6 +-
>> mm/page_allocc? ? ? ? ? ? ? |? 10 +-
>> 9 files changed, 597 insertions(+), 11 deletions(-)
>>
>>-- 
>>2.25.1
>
>Hello Mike 
>
>This is actually RESEND as it was introduced 2 years ago.
>Please refer to https://lore.kernel.org/linux-mm/YkQB6Ah603yPR3qf@kernel.org/#t
>
>> But you never provided details about *why* you want this information exposed.
>
>For your question, I'd like to say ;
>We can see the same format and exact information between different version of kernel status.
>
>1) Internally we can check if the reserved memory changes.
>2) Externally we can communicate between chipset vendors and OEM, with a same format.
>

Maybe you can show the log difference, so that we can see how it helps you.

>This helps us to communitcate well, to easily detect changes or just to see differences.
>
>Jaewon Kim
>

-- 
Wei Yang
Help you, Help me
Re: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Mike Rapoport 1 year, 8 months ago
On Tue, May 21, 2024 at 11:53:29AM +0900, Jaewon Kim wrote:
> >--------- Original Message ---------
> >Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
> >Date   : 2024-05-21 11:40 (GMT+9)
> >Title  : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
> >?
> >Some of memory regions can be reserved for a specific purpose. They are
> >usually defined through reserved-memory in device tree. If only size
> >without address is specified in device tree, the address of the region
> >will be determined at boot time.
> >
> >We may find the address of the memory regions through booting log, but
> >it does not show all. And it could be hard to catch the very beginning
> >log. The memblock_dump_all shows all memblock status but it does not
> >show region name and its information is difficult to summarize.
> >
> >This patch introduce a debugfs node, memblock/memsize, to see reserved
> >memory easily.
> >
> >Here's an example
> >
> >$ cat debugfs/memblock/memsize
> >
> >0x0000000000000000-0x0000000000000000 0x02000000 (?  32768 KB )?  map reusable linux,cma
> >0x0000000000000000-0x0000000000000000 0x01000000 (?  16384 KB )?  map reusable vxxxxx
> >...
> >0x0000000000000000-0x0000000000000000 0x004e0000 (? ? 4992 KB ) nomap unusable unknown
> >0x0000000000000000-0x0000000000000000 0x00400000 (? ? 4096 KB ) nomap unusable cxxxxx
> >0x0000000000000000-0x0000000000000000 0x00e00000 (?  14336 KB ) nomap unusable gxxxxx
> >
> >Reserved? ? : 1223856 KB
> > .kernel? ? :? 275208 KB
> >? .text? ?  :?  16576 KB
> >? .rwdata?  :? ? 1963 KB
> >? .rodata?  :?  11920 KB
> >? .bss? ? ? :? ? 2450 KB
> >? .memmap?  :? 186368 KB
> >? .etc? ? ? :?  55933 KB
> > .unusable? :? 948648 KB
> >System? ? ? : 11359056 KB
> > .common? ? : 10306384 KB
> > .reusable? : 1052672 KB
> >Total? ? ?  : 12582912 KB ( 12288.00 MB )
> >
> >Jaewon Kim (10):
> >? memblock: introduce memsize showing reserved memory
> >? memblock: detect hidden memory hole size
> >? memblock: handle overlapped reserved memory region
> >? memblock: take a region intersecting an unknown region
> >? memblock: track memblock changed at early param
> >? memblock: recognize late freed size by checking PageReserved
> >? memblock: track kernel size on memsize
> >? memblock: print memsize summary information
> >? memblock: print kernel internal size
> >? memblock: support memsize reusable to consider as reusable
> >
> > drivers/of/fdt.c? ? ? ? ? ?  |? 11 +
> > drivers/of/of_reserved_mem.c |? 12 +-
> > include/linux/memblock.h? ?  |? 29 ++
> > init/main.c? ? ? ? ? ? ? ? ? |? 13 +-
> > kernel/dma/contiguous.c? ? ? |?  9 +-
> > mm/Kconfig? ? ? ? ? ? ? ? ?  |? 16 ++
> > mm/memblock.c? ? ? ? ? ? ? ? | 502 ++++++++++++++++++++++++++++++++++-
> > mm/mm_init.c? ? ? ? ? ? ? ?  |?  6 +-
> > mm/page_alloc.c? ? ? ? ? ? ? |? 10 +-
> > 9 files changed, 597 insertions(+), 11 deletions(-)
> >
> >-- 
> >2.25.1
> 
> Hello Mike 
> 
> This is actually RESEND as it was introduced 2 years ago.
> Please refer to https://lore.kernel.org/linux-mm/YkQB6Ah603yPR3qf@kernel.org/#t
> 
> > But you never provided details about *why* you want this information exposed.
> 
> For your question, I'd like to say ;
> We can see the same format and exact information between different version of kernel status.
> 
> 1) Internally we can check if the reserved memory changes.
> 2) Externally we can communicate between chipset vendors and OEM, with a same format.

Why the existing debugfs interface is not sufficient?
 
> This helps us to communitcate well, to easily detect changes or just to see differences.
> 
> Jaewon Kim
> 

-- 
Sincerely yours,
Mike.
RE:(2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Jaewon Kim 1 year, 8 months ago
>On Tue, May 21, 2024 at 11:53:29AM +0900, Jaewon Kim wrote:
>> >--------- Original Message ---------
>> >Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
>> >Date   : 2024-05-21 11:40 (GMT+9)
>> >Title  : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
>> >?
>> >Some of memory regions can be reserved for a specific purpose. They are
>> >usually defined through reserved-memory in device tree. If only size
>> >without address is specified in device tree, the address of the region
>> >will be determined at boot time.
>> >
>> >We may find the address of the memory regions through booting log, but
>> >it does not show all. And it could be hard to catch the very beginning
>> >log. The memblock_dump_all shows all memblock status but it does not
>> >show region name and its information is difficult to summarize.
>> >
>> >This patch introduce a debugfs node, memblock/memsize, to see reserved
>> >memory easily.
>> >
>> >Here's an example
>> >
>> >$ cat debugfs/memblock/memsize
>> >
>> >0x0000000000000000-0x0000000000000000 0x02000000 (?  32768 KB )?  map reusable linux,cma
>> >0x0000000000000000-0x0000000000000000 0x01000000 (?  16384 KB )?  map reusable vxxxxx
>> >...
>> >0x0000000000000000-0x0000000000000000 0x004e0000 (? ? 4992 KB ) nomap unusable unknown
>> >0x0000000000000000-0x0000000000000000 0x00400000 (? ? 4096 KB ) nomap unusable cxxxxx
>> >0x0000000000000000-0x0000000000000000 0x00e00000 (?  14336 KB ) nomap unusable gxxxxx
>> >
>> >Reserved? ? : 1223856 KB
>> > .kernel? ? :? 275208 KB
>> >? .text? ?  :?  16576 KB
>> >? .rwdata?  :? ? 1963 KB
>> >? .rodata?  :?  11920 KB
>> >? .bss? ? ? :? ? 2450 KB
>> >? .memmap?  :? 186368 KB
>> >? .etc? ? ? :?  55933 KB
>> > .unusable? :? 948648 KB
>> >System? ? ? : 11359056 KB
>> > .common? ? : 10306384 KB
>> > .reusable? : 1052672 KB
>> >Total? ? ?  : 12582912 KB ( 12288.00 MB )
>> >
>> >Jaewon Kim (10):
>> >? memblock: introduce memsize showing reserved memory
>> >? memblock: detect hidden memory hole size
>> >? memblock: handle overlapped reserved memory region
>> >? memblock: take a region intersecting an unknown region
>> >? memblock: track memblock changed at early param
>> >? memblock: recognize late freed size by checking PageReserved
>> >? memblock: track kernel size on memsize
>> >? memblock: print memsize summary information
>> >? memblock: print kernel internal size
>> >? memblock: support memsize reusable to consider as reusable
>> >
>> > drivers/of/fdt.c? ? ? ? ? ?  |? 11 +
>> > drivers/of/of_reserved_mem.c |? 12 +-
>> > include/linux/memblock.h? ?  |? 29 ++
>> > init/main.c? ? ? ? ? ? ? ? ? |? 13 +-
>> > kernel/dma/contiguous.c? ? ? |?  9 +-
>> > mm/Kconfig? ? ? ? ? ? ? ? ?  |? 16 ++
>> > mm/memblock.c? ? ? ? ? ? ? ? | 502 ++++++++++++++++++++++++++++++++++-
>> > mm/mm_init.c? ? ? ? ? ? ? ?  |?  6 +-
>> > mm/page_alloc.c? ? ? ? ? ? ? |? 10 +-
>> > 9 files changed, 597 insertions(+), 11 deletions(-)
>> >
>> >-- 
>> >2.25.1
>> 
>> Hello Mike 
>> 
>> This is actually RESEND as it was introduced 2 years ago.
>> Please refer to https://lore.kernel.org/linux-mm/YkQB6Ah603yPR3qf@kernel.org/#t
>> 
>> > But you never provided details about *why* you want this information exposed.
>> 
>> For your question, I'd like to say ;
>> We can see the same format and exact information between different version of kernel status.
>> 
>> 1) Internally we can check if the reserved memory changes.
>> 2) Externally we can communicate between chipset vendors and OEM, with a same format.
>
>Why the existing debugfs interface is not sufficient?

debugfs/memblock/memory & debugfs/memblock/reserved have changed its format but still does not show name, reusable, kernel size.
If memory is reserved from memblock, and did not freed back to memblock. Memblock does not know even after the memory is freed to system.
I think a simple debug interface is needed to easily communicate with others or compare different SW releases.

> 
>> This helps us to communitcate well, to easily detect changes or just to see differences.
>> 
>> Jaewon Kim
>> 
>
>-- 
>Sincerely yours,
>Mike.

Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Mike Rapoport 1 year, 8 months ago
On Tue, May 21, 2024 at 07:17:53PM +0900, Jaewon Kim wrote:
> >On Tue, May 21, 2024 at 11:53:29AM +0900, Jaewon Kim wrote:
> >> >--------- Original Message ---------
> >> >Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
> >> >Date   : 2024-05-21 11:40 (GMT+9)
> >> >Title  : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
> >> >?
> >> >Some of memory regions can be reserved for a specific purpose. They are
> >> >usually defined through reserved-memory in device tree. If only size
> >> >without address is specified in device tree, the address of the region
> >> >will be determined at boot time.
> >> >
> >> >We may find the address of the memory regions through booting log, but
> >> >it does not show all. And it could be hard to catch the very beginning
> >> >log. The memblock_dump_all shows all memblock status but it does not
> >> >show region name and its information is difficult to summarize.
> >> >
> >> >This patch introduce a debugfs node, memblock/memsize, to see reserved
> >> >memory easily.
> >> 
> >> This is actually RESEND as it was introduced 2 years ago.
> >> Please refer to https://lore.kernel.org/linux-mm/YkQB6Ah603yPR3qf@kernel.org/#t
> >> 
> >> > But you never provided details about *why* you want this information exposed.
> >> 
> >> For your question, I'd like to say ;
> >> We can see the same format and exact information between different version of kernel status.
> >> 
> >> 1) Internally we can check if the reserved memory changes.
> >> 2) Externally we can communicate between chipset vendors and OEM, with a same format.
> >
> >Why the existing debugfs interface is not sufficient?
> 
> debugfs/memblock/memory & debugfs/memblock/reserved have changed its
> format but still does not show name, reusable, kernel size.  If memory is
> reserved from memblock, and did not freed back to memblock. Memblock does
> not know even after the memory is freed to system.  I think a simple
> debug interface is needed to easily communicate with others or compare
> different SW releases.

I still don't understand what problem are you trying to solve with these
patches. 
 
-- 
Sincerely yours,
Mike.
Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Pintu Agarwal 1 year, 8 months ago
On Thu, 23 May 2024 at 20:06, Mike Rapoport <rppt@kernel.org> wrote:
>
> On Tue, May 21, 2024 at 07:17:53PM +0900, Jaewon Kim wrote:
> > >On Tue, May 21, 2024 at 11:53:29AM +0900, Jaewon Kim wrote:
> > >> >--------- Original Message ---------
> > >> >Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
> > >> >Date   : 2024-05-21 11:40 (GMT+9)
> > >> >Title  : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
> > >> >?
> > >> >Some of memory regions can be reserved for a specific purpose. They are
> > >> >usually defined through reserved-memory in device tree. If only size
> > >> >without address is specified in device tree, the address of the region
> > >> >will be determined at boot time.
> > >> >
> > >> >We may find the address of the memory regions through booting log, but
> > >> >it does not show all. And it could be hard to catch the very beginning
> > >> >log. The memblock_dump_all shows all memblock status but it does not
> > >> >show region name and its information is difficult to summarize.

Something similar, we have already proposed almost 10 years ago for memblock.
That time I realised some of these reserved memory break-up becomes
useful and handy when we are gathering reserved memory stats on a
small embedded device where every bit of memory reserved is important
and being questioned.

You can get some information about Kernel reserved from dmesg | grep
-i Memory (including the kernel init, text, data) and the cma-reserved
as well. Here the cma-reserved was added by me.

You can also get these Kernel reserved size info from vmlinux.
size -t vmlinux
Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Wei Yang 1 year, 8 months ago
On Tue, May 21, 2024 at 07:17:53PM +0900, Jaewon Kim wrote:
>>On Tue, May 21, 2024 at 11:53:29AM +0900, Jaewon Kim wrote:
>>> >--------- Original Message ---------
>>> >Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
>>> >Date   : 2024-05-21 11:40 (GMT+9)
>>> >Title  : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
>>> >?
>>> >Some of memory regions can be reserved for a specific purpose. They are
>>> >usually defined through reserved-memory in device tree. If only size
>>> >without address is specified in device tree, the address of the region
>>> >will be determined at boot time.
>>> >
>>> >We may find the address of the memory regions through booting log, but
>>> >it does not show all. And it could be hard to catch the very beginning
>>> >log. The memblock_dump_all shows all memblock status but it does not
>>> >show region name and its information is difficult to summarize.
>>> >
>>> >This patch introduce a debugfs node, memblock/memsize, to see reserved
>>> >memory easily.
>>> >
>>> >Here's an example
>>> >
>>> >$ cat debugfs/memblock/memsize
>>> >
>>> >0x0000000000000000-0x0000000000000000 0x02000000 (?  32768 KB )?  map reusable linux,cma
>>> >0x0000000000000000-0x0000000000000000 0x01000000 (?  16384 KB )?  map reusable vxxxxx
>>> >...
>>> >0x0000000000000000-0x0000000000000000 0x004e0000 (? ? 4992 KB ) nomap unusable unknown
>>> >0x0000000000000000-0x0000000000000000 0x00400000 (? ? 4096 KB ) nomap unusable cxxxxx
>>> >0x0000000000000000-0x0000000000000000 0x00e00000 (?  14336 KB ) nomap unusable gxxxxx
>>> >
>>> >Reserved? ? : 1223856 KB
>>> > .kernel? ? :? 275208 KB
>>> >? .text? ?  :?  16576 KB
>>> >? .rwdata?  :? ? 1963 KB
>>> >? .rodata?  :?  11920 KB
>>> >? .bss? ? ? :? ? 2450 KB
>>> >? .memmap?  :? 186368 KB
>>> >? .etc? ? ? :?  55933 KB
>>> > .unusable? :? 948648 KB
>>> >System? ? ? : 11359056 KB
>>> > .common? ? : 10306384 KB
>>> > .reusable? : 1052672 KB
>>> >Total? ? ?  : 12582912 KB ( 12288.00 MB )
>>> >
>>> >Jaewon Kim (10):
>>> >? memblock: introduce memsize showing reserved memory
>>> >? memblock: detect hidden memory hole size
>>> >? memblock: handle overlapped reserved memory region
>>> >? memblock: take a region intersecting an unknown region
>>> >? memblock: track memblock changed at early param
>>> >? memblock: recognize late freed size by checking PageReserved
>>> >? memblock: track kernel size on memsize
>>> >? memblock: print memsize summary information
>>> >? memblock: print kernel internal size
>>> >? memblock: support memsize reusable to consider as reusable
>>> >
>>> > drivers/of/fdt.c? ? ? ? ? ?  |? 11 +
>>> > drivers/of/of_reserved_mem.c |? 12 +-
>>> > include/linux/memblock.h? ?  |? 29 ++
>>> > init/main.c? ? ? ? ? ? ? ? ? |? 13 +-
>>> > kernel/dma/contiguous.c? ? ? |?  9 +-
>>> > mm/Kconfig? ? ? ? ? ? ? ? ?  |? 16 ++
>>> > mm/memblock.c? ? ? ? ? ? ? ? | 502 ++++++++++++++++++++++++++++++++++-
>>> > mm/mm_init.c? ? ? ? ? ? ? ?  |?  6 +-
>>> > mm/page_alloc.c? ? ? ? ? ? ? |? 10 +-
>>> > 9 files changed, 597 insertions(+), 11 deletions(-)
>>> >
>>> >-- 
>>> >2.25.1
>>> 
>>> Hello Mike 
>>> 
>>> This is actually RESEND as it was introduced 2 years ago.
>>> Please refer to https://lore.kernel.org/linux-mm/YkQB6Ah603yPR3qf@kernel.org/#t
>>> 
>>> > But you never provided details about *why* you want this information exposed.
>>> 
>>> For your question, I'd like to say ;
>>> We can see the same format and exact information between different version of kernel status.
>>> 
>>> 1) Internally we can check if the reserved memory changes.
>>> 2) Externally we can communicate between chipset vendors and OEM, with a same format.
>>
>>Why the existing debugfs interface is not sufficient?
>
>debugfs/memblock/memory & debugfs/memblock/reserved have changed its format but still does not show name, reusable, kernel size.

Would you mind showing which information matters to you most in the following
example log message? What you expect to see and helps you on locating problem?

0x0000000000000000-0x0000000000000000 0x02000000 (   32768 KB )   map reusable linux,cma
0x0000000000000000-0x0000000000000000 0x01000000 (   16384 KB )   map reusable vxxxxx
..
0x0000000000000000-0x0000000000000000 0x004e0000 (    4992 KB ) nomap unusable unknown
0x0000000000000000-0x0000000000000000 0x00400000 (    4096 KB ) nomap unusable cxxxxx
0x0000000000000000-0x0000000000000000 0x00e00000 (   14336 KB ) nomap unusable gxxxxx

Reserved    : 1223856 KB
 .kernel    :  275208 KB
  .text     :   16576 KB
  .rwdata   :    1963 KB
  .rodata   :   11920 KB
  .bss      :    2450 KB
  .memmap   :  186368 KB
  .etc      :   55933 KB
 .unusable  :  948648 KB
System      : 11359056 KB
 .common    : 10306384 KB
 .reusable  : 1052672 KB
Total       : 12582912 KB ( 12288.00 MB )

>If memory is reserved from memblock, and did not freed back to memblock. Memblock does not know even after the memory is freed to system.

You mean we may reserve memory in memblock.reserved, but still have it freed
to system? This sounds a bug to me.

>I think a simple debug interface is needed to easily communicate with others or compare different SW releases.
>
>> 
>>> This helps us to communitcate well, to easily detect changes or just to see differences.
>>> 
>>> Jaewon Kim
>>> 
>>
>>-- 
>>Sincerely yours,
>>Mike.
>
>

-- 
Wei Yang
Help you, Help me
RE: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Jaewon Kim 1 year, 8 months ago
>Sender : Wei Yang <richard.weiyang@gmail.com>
>Date   : 2024-05-22 17:16 (GMT+9)
>Title  : Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
>?
>On Tue, May 21, 2024 at 07:17:53PM +0900, Jaewon Kim wrote:
>>>On Tue, May 21, 2024 at 11:53:29AM +0900, Jaewon Kim wrote:
>>>> >--------- Original Message ---------
>>>> >Sender : 김재원 <jaewon31.kim@samsung.com>System Performance Lab.(MX)/삼성전자
>>>> >Date?  : 2024-05-21 11:40 (GMT+9)
>>>> >Title? : [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
>>>> >?
>>>> >Some of memory regions can be reserved for a specific purpose. They are
>>>> >usually defined through reserved-memory in device tree. If only size
>>>> >without address is specified in device tree, the address of the region
>>>> >will be determined at boot time.
>>>> >
>>>> >We may find the address of the memory regions through booting log, but
>>>> >it does not show all. And it could be hard to catch the very beginning
>>>> >log. The memblock_dump_all shows all memblock status but it does not
>>>> >show region name and its information is difficult to summarize.
>>>> >
>>>> >This patch introduce a debugfs node, memblock/memsize, to see reserved
>>>> >memory easily.
>>>> >
>>>> >Here's an example
>>>> >
>>>> >$ cat debugfs/memblock/memsize
>>>> >
>>>> >0x0000000000000000-0x0000000000000000 0x02000000 (?? 32768 KB )?? map reusable linux,cma
>>>> >0x0000000000000000-0x0000000000000000 0x01000000 (?? 16384 KB )?? map reusable vxxxxx
>>>> >...
>>>> >0x0000000000000000-0x0000000000000000 0x004e0000 (? ? 4992 KB ) nomap unusable unknown
>>>> >0x0000000000000000-0x0000000000000000 0x00400000 (? ? 4096 KB ) nomap unusable cxxxxx
>>>> >0x0000000000000000-0x0000000000000000 0x00e00000 (?? 14336 KB ) nomap unusable gxxxxx
>>>> >
>>>> >Reserved? ? : 1223856 KB
>>>> > .kernel? ? :? 275208 KB
>>>> >? .text? ?? :?? 16576 KB
>>>> >? .rwdata?? :? ? 1963 KB
>>>> >? .rodata?? :?? 11920 KB
>>>> >? .bss? ? ? :? ? 2450 KB
>>>> >? .memmap?? :? 186368 KB
>>>> >? .etc? ? ? :?? 55933 KB
>>>> > .unusable? :? 948648 KB
>>>> >System? ? ? : 11359056 KB
>>>> > .common? ? : 10306384 KB
>>>> > .reusable? : 1052672 KB
>>>> >Total? ? ?? : 12582912 KB ( 12288.00 MB )
>>>> >
>>>> >Jaewon Kim (10):
>>>> >? memblock: introduce memsize showing reserved memory
>>>> >? memblock: detect hidden memory hole size
>>>> >? memblock: handle overlapped reserved memory region
>>>> >? memblock: take a region intersecting an unknown region
>>>> >? memblock: track memblock changed at early param
>>>> >? memblock: recognize late freed size by checking PageReserved
>>>> >? memblock: track kernel size on memsize
>>>> >? memblock: print memsize summary information
>>>> >? memblock: print kernel internal size
>>>> >? memblock: support memsize reusable to consider as reusable
>>>> >
>>>> > drivers/of/fdt.c? ? ? ? ? ?? |? 11 +
>>>> > drivers/of/of_reserved_mem.c |? 12 +-
>>>> > include/linux/memblock.h? ?? |? 29 ++
>>>> > init/main.c? ? ? ? ? ? ? ? ? |? 13 +-
>>>> > kernel/dma/contiguous.c? ? ? |?? 9 +-
>>>> > mm/Kconfig? ? ? ? ? ? ? ? ?? |? 16 ++
>>>> > mm/memblock.c? ? ? ? ? ? ? ? | 502 ++++++++++++++++++++++++++++++++++-
>>>> > mm/mm_init.c? ? ? ? ? ? ? ?? |?? 6 +-
>>>> > mm/page_alloc.c? ? ? ? ? ? ? |? 10 +-
>>>> > 9 files changed, 597 insertions(+), 11 deletions(-)
>>>> >
>>>> >-- 
>>>> >2.25.1
>>>> 
>>>> Hello Mike 
>>>> 
>>>> This is actually RESEND as it was introduced 2 years ago.
>>>> Please refer to https://lore.kernel.org/linux-mm/YkQB6Ah603yPR3qf@kernel.org/#t
>>>> 
>>>> > But you never provided details about *why* you want this information exposed.
>>>> 
>>>> For your question, I'd like to say ;
>>>> We can see the same format and exact information between different version of kernel status.
>>>> 
>>>> 1) Internally we can check if the reserved memory changes.
>>>> 2) Externally we can communicate between chipset vendors and OEM, with a same format.


Hi

> Maybe you can show the log difference, so that we can see how it helps you.

For your new email, could you elaborate the difference you meant? 
Do you mean difference between existing debugfs membock interfaces and the one I introdued here?


>>>
>>>Why the existing debugfs interface is not sufficient?
>>
>>debugfs/memblock/memory & debugfs/memblock/reserved have changed its format but still does not show name, reusable, kernel size.
>
>Would you mind showing which information matters to you most in the following
>example log message? What you expect to see and helps you on locating problem?
>
>0x0000000000000000-0x0000000000000000 0x02000000 (?  32768 KB )?  map reusable linux,cma
>0x0000000000000000-0x0000000000000000 0x01000000 (?  16384 KB )?  map reusable vxxxxx
>..
>0x0000000000000000-0x0000000000000000 0x004e0000 (? ? 4992 KB ) nomap unusable unknown
>0x0000000000000000-0x0000000000000000 0x00400000 (? ? 4096 KB ) nomap unusable cxxxxx
>0x0000000000000000-0x0000000000000000 0x00e00000 (?  14336 KB ) nomap unusable gxxxxx
>
>Reserved? ? : 1223856 KB
> .kernel? ? :? 275208 KB
>? .text? ?  :?  16576 KB
>? .rwdata?  :? ? 1963 KB
>? .rodata?  :?  11920 KB
>? .bss? ? ? :? ? 2450 KB
>? .memmap?  :? 186368 KB
>? .etc? ? ? :?  55933 KB
> .unusable? :? 948648 KB
>System? ? ? : 11359056 KB
> .common? ? : 10306384 KB
> .reusable? : 1052672 KB
>Total? ? ?  : 12582912 KB ( 12288.00 MB )
>


I need all those information actually. address, size, map/nomap, reusable/unusable,
name. For me it was very helpful to rearrange the memory regions as it shows clearly.
The address could be seen after allowing it through /proc/sys/kernel/kptr_restrict.

Kernel size information is also helpful to me. The memmap size for struct pages
could be increased according to DRAM memory size. By rearranging the reserved regions
to be packed we can save memmap memory, then we can see the results easily from this.
We can compare other text, ro, rw, etc so that we can find which part of kernel has
changed.


>>If memory is reserved from memblock, and did not freed back to memblock. Memblock does not know even after the memory is freed to system.
>
>You mean we may reserve memory in memblock.reserved, but still have it freed
>to system? This sounds a bug to me.

I mean something like free_reserved_area. The reserved free pages would be free to
system buddy allocator directly without reporting it to memblock.

>
>>I think a simple debug interface is needed to easily communicate with others or compare different SW releases.
>>
>>> 
>>>> This helps us to communitcate well, to easily detect changes or just to see differences.
>>>> 
>>>> Jaewon Kim
>>>> 
>>>
>>>-- 
>>>Sincerely yours,
>>>Mike.
>>
>>
>
>-- 
>Wei Yang
>Help you, Help me
>


Re: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by Wei Yang 1 year, 8 months ago
On Wed, May 22, 2024 at 05:47:38PM +0900, Jaewon Kim wrote:
[...]
>
>Hi
>
>> Maybe you can show the log difference, so that we can see how it helps you.
>
>For your new email, could you elaborate the difference you meant? 
>Do you mean difference between existing debugfs membock interfaces and the one I introdued here?
>

You mentioned the difference between kernel version helps you locate the
problem. That is the difference of your new debugfs.


-- 
Wei Yang
Help you, Help me
RE: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory
Posted by 김재원 1 year, 8 months ago
>[...]
>>
>>Hi
>>
>>> Maybe you can show the log difference, so that we can see how it helps you.
>>
>>For your new email, could you elaborate the difference you meant? 
>>Do you mean difference between existing debugfs membock interfaces and the one I introdued here?
>>
>
>You mentioned the difference between kernel version helps you locate the
>problem. That is the difference of your new debugfs.

Correct. Actually we get many SW release from chipset vendors. Even though
their kernel version is same, the reserved memory status varies. So we can
easily compare them.

BR

>
>
>-- 
>Wei Yang
>Help you, Help me