* [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcas1p1.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim [not found] ` <CGME20240521024009epcas1p4451928c8f5b32bf84082a24c59ca7dd0@epcas1p4.samsung.com> ` (10 more replies) 0 siblings, 11 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim 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 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p4451928c8f5b32bf84082a24c59ca7dd0@epcas1p4.samsung.com>]
* [RESEND PATCH 01/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p4451928c8f5b32bf84082a24c59ca7dd0@epcas1p4.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim 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. The first patch here will show the only reserved-memory in device tree like following example. The next patches will show more information. There is a case in which the reserved memory region name has @ staring string at the end. That information is not actually needed. Let's remove those string. $ cat debugfs/memblock/memsize 0x0f9000000-0x0fb000000 0x02000000 ( 32768 KB ) map reusable linux,cma 0x0b1900000-0x0b1b00000 0x00200000 ( 2048 KB ) nomap unusable test1 0x0b0200000-0x0b0400000 0x00200000 ( 2048 KB ) map unusable test2 .unusable : 4096 KB .reusable : 32768 KB Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- drivers/of/fdt.c | 3 + drivers/of/of_reserved_mem.c | 9 ++- include/linux/memblock.h | 9 +++ kernel/dma/contiguous.c | 2 + mm/Kconfig | 16 +++++ mm/memblock.c | 120 +++++++++++++++++++++++++++++++++++ 6 files changed, 156 insertions(+), 3 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index a8a04f27915b..605c7f471908 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -502,6 +502,8 @@ static void __init fdt_reserve_elfcorehdr(void) } memblock_reserve(elfcorehdr_addr, elfcorehdr_size); + memblock_memsize_record("elfcorehdr", elfcorehdr_addr, elfcorehdr_size, + false, false); pr_info("Reserving %llu KiB of memory at 0x%llx for elfcorehdr\n", elfcorehdr_size >> 10, elfcorehdr_addr); @@ -531,6 +533,7 @@ void __init early_init_fdt_scan_reserved_mem(void) if (!size) break; memblock_reserve(base, size); + memblock_memsize_record("memreserve", base, size, false, false); } fdt_init_reserved_mem(); diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 46e1c3fbc769..ece678e07304 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -438,9 +438,10 @@ void __init fdt_init_reserved_mem(void) struct reserved_mem *rmem = &reserved_mem[i]; unsigned long node = rmem->fdt_node; int err = 0; - bool nomap; + bool nomap, reusable; nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL; + reusable = of_get_flat_dt_prop(node, "reusable", NULL) != NULL; if (rmem->size == 0) err = __reserved_mem_alloc_size(node, rmem->name, @@ -457,14 +458,16 @@ void __init fdt_init_reserved_mem(void) rmem->size); } else { phys_addr_t end = rmem->base + rmem->size - 1; - bool reusable = - (of_get_flat_dt_prop(node, "reusable", NULL)) != NULL; pr_info("%pa..%pa (%lu KiB) %s %s %s\n", &rmem->base, &end, (unsigned long)(rmem->size / SZ_1K), nomap ? "nomap" : "map", reusable ? "reusable" : "non-reusable", rmem->name ? rmem->name : "unknown"); + + memblock_memsize_record(rmem->name, rmem->base, + rmem->size, nomap, + reusable); } } } diff --git a/include/linux/memblock.h b/include/linux/memblock.h index e2082240586d..9ccba9bb20cb 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -613,5 +613,14 @@ static inline void early_memtest(phys_addr_t start, phys_addr_t end) { } static inline void memtest_report_meminfo(struct seq_file *m) { } #endif +#ifdef CONFIG_MEMBLOCK_MEMSIZE +extern void memblock_memsize_record(const char *name, phys_addr_t base, + phys_addr_t size, bool nomap, + bool reusable); +#else +static inline void memblock_memsize_record(const char *name, phys_addr_t base, + phys_addr_t size, bool nomap, + bool reusable) { } +#endif #endif /* _LINUX_MEMBLOCK_H */ diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index 055da410ac71..437c85878280 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -286,6 +286,8 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, dma_contiguous_early_fixup(cma_get_base(*res_cma), cma_get_size(*res_cma)); + memblock_memsize_record("dma_cma", cma_get_base(*res_cma), + cma_get_size(*res_cma), false, true); return 0; } diff --git a/mm/Kconfig b/mm/Kconfig index b4cb45255a54..7fd25088b9b8 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -476,6 +476,22 @@ config HAVE_GUP_FAST depends on MMU bool +config MAX_MEMBLOCK_MEMSIZE + int "Maximum number of tracking regions" + depends on MEMBLOCK_MEMSIZE + default 100 + range 0 200 + help + This number sets maximum number of tracking regions. If this is set to + 0, nothing will be saved. + +config MEMBLOCK_MEMSIZE + bool "memblock based reserved memory profiling" + default n + help + This patch introduce a node, memblock/memsize, to see reserved memory + easily. + # Don't discard allocated memory used to track "memory" and "reserved" memblocks # after early boot, so it can still be used to test for validity of memory. # Also, memblocks are updated with memory hot(un)plug. diff --git a/mm/memblock.c b/mm/memblock.c index d09136e040d3..f05e7df2f8e1 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -19,6 +19,7 @@ #include <asm/sections.h> #include <linux/io.h> +#include <linux/sort.h> #include "internal.h" @@ -2025,6 +2026,66 @@ static int __init early_memblock(char *p) } early_param("memblock", early_memblock); +#ifdef CONFIG_MEMBLOCK_MEMSIZE + +#define NAME_SIZE 100 +struct memsize_rgn_struct { + phys_addr_t base; + long size; + bool nomap; /* 1/32 byte */ + bool reusable; /* 1/32 byte */ + char name[NAME_SIZE]; /* 30/32 byte */ +}; + +static struct memsize_rgn_struct memsize_rgn[CONFIG_MAX_MEMBLOCK_MEMSIZE] __initdata_memblock; +static int memsize_rgn_count __initdata_memblock; + +static void __init_memblock memsize_get_valid_name(char *valid_name, const char *name) +{ + char *head, *tail, *found; + int val_size; + + head = (char *)name; + tail = head + strlen(name); + + /* get tail position after valid char */ + found = strchr(name, '@'); + if (found) + tail = found; + + val_size = tail - head; + if (val_size > NAME_SIZE - 1) + val_size = NAME_SIZE - 1; + strscpy(valid_name, head, val_size); + valid_name[val_size] = '\0'; +} + +void __init_memblock memblock_memsize_record(const char *name, phys_addr_t base, + phys_addr_t size, bool nomap, bool reusable) +{ + struct memsize_rgn_struct *rgn; + phys_addr_t end; + + if (memsize_rgn_count == CONFIG_MAX_MEMBLOCK_MEMSIZE) { + pr_err("not enough space on memsize_rgn\n"); + return; + } + rgn = &memsize_rgn[memsize_rgn_count++]; + rgn->base = base; + rgn->size = size; + rgn->nomap = nomap; + rgn->reusable = reusable; + + if (!name) + strscpy(rgn->name, "unknown", sizeof(rgn->name)); + else + memsize_get_valid_name(rgn->name, name); + end = base + size - 1; + memblock_dbg("%s %pa..%pa nomap:%d reusable:%d\n", + __func__, &base, &end, nomap, reusable); +} +#endif /* MEMBLOCK_MEMSIZE */ + static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn) { struct page *start_pg, *end_pg; @@ -2289,6 +2350,61 @@ static int memblock_debug_show(struct seq_file *m, void *private) } DEFINE_SHOW_ATTRIBUTE(memblock_debug); +#ifdef CONFIG_MEMBLOCK_MEMSIZE + +static int memsize_rgn_cmp(const void *a, const void *b) +{ + const struct memsize_rgn_struct *ra = a, *rb = b; + + if (ra->base > rb->base) + return -1; + + if (ra->base < rb->base) + return 1; + + return 0; +} + +static int memblock_memsize_show(struct seq_file *m, void *private) +{ + int i; + struct memsize_rgn_struct *rgn; + unsigned long reserved = 0, reusable = 0; + + sort(memsize_rgn, memsize_rgn_count, + sizeof(memsize_rgn[0]), memsize_rgn_cmp, NULL); + for (i = 0; i < memsize_rgn_count; i++) { + phys_addr_t base, end; + long size; + + rgn = &memsize_rgn[i]; + base = rgn->base; + size = rgn->size; + end = base + size; + + seq_printf(m, "0x%pK-0x%pK 0x%08lx ( %7lu KB ) %s %s %s\n", + (void *)base, (void *)end, + size, DIV_ROUND_UP(size, SZ_1K), + rgn->nomap ? "nomap" : " map", + rgn->reusable ? "reusable" : "unusable", + rgn->name); + if (rgn->reusable) + reusable += (unsigned long)rgn->size; + else + reserved += (unsigned long)rgn->size; + } + + seq_puts(m, "\n"); + seq_printf(m, " .unusable : %7lu KB\n", + DIV_ROUND_UP(reserved, SZ_1K)); + seq_printf(m, " .reusable : %7lu KB\n", + DIV_ROUND_UP(reusable, SZ_1K)); + return 0; +} + +DEFINE_SHOW_ATTRIBUTE(memblock_memsize); +#endif + static int __init memblock_init_debugfs(void) { struct dentry *root = debugfs_create_dir("memblock", NULL); @@ -2301,6 +2417,10 @@ static int __init memblock_init_debugfs(void) debugfs_create_file("physmem", 0444, root, &physmem, &memblock_debug_fops); #endif +#ifdef CONFIG_MEMBLOCK_MEMSIZE + debugfs_create_file("memsize", 0444, root, + NULL, &memblock_memsize_fops); +#endif return 0; } -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p3e80e90863a453053d5aac901ef644070@epcas1p3.samsung.com>]
* [RESEND PATCH 02/10] memblock: detect hidden memory hole size [not found] ` <CGME20240521024009epcas1p3e80e90863a453053d5aac901ef644070@epcas1p3.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim Bootloader knows the actual memory size, but bootloader may reserve some memory for a specific purpose and pass the only remaining memory region to kernel. Even though kernel does not know what it is, we need to detect those regions to sum up all reserved memory. Let me call it memory hole. To expect the hole size, this patch assume two things. One is that each physical memory has 1GB aligned size and address. And the hole is less than 1GB. For the hole, let it be shown as unknown in memsize logic. This is an example. 0x0bf000000-0x0c0000000 0x01000000 ( 16384 KB ) nomap unusable unknown Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- drivers/of/fdt.c | 2 ++ include/linux/memblock.h | 2 ++ mm/memblock.c | 45 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 605c7f471908..da82e5afed01 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -1194,6 +1194,8 @@ void __init early_init_dt_scan_nodes(void) /* Handle linux,usable-memory-range property */ early_init_dt_check_for_usable_mem_range(); + + memblock_memsize_detect_hole(); } bool __init early_init_dt_scan(void *params) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 9ccba9bb20cb..049313871059 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -617,10 +617,12 @@ static inline void memtest_report_meminfo(struct seq_file *m) { } extern void memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, bool reusable); +extern void memblock_memsize_detect_hole(void); #else static inline void memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, bool reusable) { } +static inline void memblock_memsize_detect_hole(void) { } #endif #endif /* _LINUX_MEMBLOCK_H */ diff --git a/mm/memblock.c b/mm/memblock.c index f05e7df2f8e1..5204ee71ae29 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2084,6 +2084,51 @@ void __init_memblock memblock_memsize_record(const char *name, phys_addr_t base, memblock_dbg("%s %pa..%pa nomap:%d reusable:%d\n", __func__, &base, &end, nomap, reusable); } + +/* This function will be called to by early_init_dt_scan_nodes */ +void __init memblock_memsize_detect_hole(void) +{ + phys_addr_t base, end; + phys_addr_t prev_end, hole_sz; + int idx; + struct memblock_region *rgn; + int memblock_cnt = (int)memblock.memory.cnt; + + /* assume that the hole size is less than 1 GB */ + for_each_memblock_type(idx, (&memblock.memory), rgn) { + prev_end = (idx == 0) ? round_down(rgn->base, SZ_1G) : end; + base = rgn->base; + end = rgn->base + rgn->size; + + /* only for the last region, check a hole after the region */ + if (idx + 1 == memblock_cnt) { + hole_sz = round_up(end, SZ_1G) - end; + if (hole_sz) + memblock_memsize_record(NULL, end, hole_sz, + true, false); + } + + /* for each region, check a hole prior to the region */ + hole_sz = base - prev_end; + if (!hole_sz) + continue; + if (hole_sz < SZ_1G) { + memblock_memsize_record(NULL, prev_end, hole_sz, true, + false); + } else { + phys_addr_t hole_sz1, hole_sz2; + + hole_sz1 = round_up(prev_end, SZ_1G) - prev_end; + if (hole_sz1) + memblock_memsize_record(NULL, prev_end, + hole_sz1, true, false); + hole_sz2 = base % SZ_1G; + if (hole_sz2) + memblock_memsize_record(NULL, base - hole_sz2, + hole_sz2, true, false); + } + } +} #endif /* MEMBLOCK_MEMSIZE */ static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn) -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p152671a613e86fa83d840962ee3db50fb@epcas1p1.samsung.com>]
* [RESEND PATCH 03/10] memblock: handle overlapped reserved memory region [not found] ` <CGME20240521024009epcas1p152671a613e86fa83d840962ee3db50fb@epcas1p1.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim It is not common, but defining an overlapped region is possible. Actually memblock_add_range allows to overlap with existing ones. The memsize currently does not handle this overlapped case. But this patch tries to handle one overlapped case. Here's the case. There is an unknown memsize region, which means the region was removed and not passed at bootloader stage. And there is a reserved memory region defined in device tree which is overlapped with the unknown region. We expect that information in device tree make the unknown region clear. This patch handle the overlapped region with following conditions. 1) The already existing overlapped region should be unknown and no-map. 2) The newly added region should have a name, and its region should be same with or part of the existing one. Here is an example. Before this patch, memsize shows both overlapped region. 0x0ea000000-0x0ed900000 0x03900000 ( 58368 KB ) nomap unusable overlapped 0x0ea000000-0x0f1400000 0x07400000 ( 118784 KB ) nomap unusable unknown After this patch, the overlapped region is named. 0x0ea000000-0x0ed900000 0x03900000 ( 58368 KB ) nomap unusable overlapped 0x0e9b00000-0x0ea000000 0x00500000 ( 5120 KB ) nomap unusable unknown Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- mm/memblock.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/mm/memblock.c b/mm/memblock.c index 5204ee71ae29..4a0506e14025 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2060,6 +2060,73 @@ static void __init_memblock memsize_get_valid_name(char *valid_name, const char valid_name[val_size] = '\0'; } +static inline struct memsize_rgn_struct * __init_memblock memsize_get_new_rgn(void) +{ + if (memsize_rgn_count == ARRAY_SIZE(memsize_rgn)) { + pr_err("not enough space on memsize_rgn\n"); + return NULL; + } + return &memsize_rgn[memsize_rgn_count++]; +} + +static bool __init_memblock memsize_update_nomap_region(const char *name, phys_addr_t base, + phys_addr_t size, bool nomap) +{ + int i; + struct memsize_rgn_struct *rmem_rgn, *new_rgn; + + if (!name) + return false; + + for (i = 0; i < memsize_rgn_count; i++) { + rmem_rgn = &memsize_rgn[i]; + + if (!rmem_rgn->nomap) + continue; + if (strcmp(rmem_rgn->name, "unknown")) + continue; + if (base < rmem_rgn->base) + continue; + if (base + size > rmem_rgn->base + rmem_rgn->size) + continue; + + if (base == rmem_rgn->base && size == rmem_rgn->size) { + memsize_get_valid_name(rmem_rgn->name, name); + return true; + } + + new_rgn = memsize_get_new_rgn(); + if (!new_rgn) + return true; + new_rgn->base = base; + new_rgn->size = size; + new_rgn->nomap = nomap; + new_rgn->reusable = false; + memsize_get_valid_name(new_rgn->name, name); + + if (base == rmem_rgn->base && size < rmem_rgn->size) { + rmem_rgn->base = base + size; + rmem_rgn->size -= size; + } else if (base + size == rmem_rgn->base + rmem_rgn->size) { + rmem_rgn->size -= size; + } else { + new_rgn = memsize_get_new_rgn(); + if (!new_rgn) + return true; + new_rgn->base = base + size; + new_rgn->size = (rmem_rgn->base + rmem_rgn->size) + - (base + size); + new_rgn->nomap = nomap; + new_rgn->reusable = false; + strscpy(new_rgn->name, "unknown", sizeof(new_rgn->name)); + rmem_rgn->size = base - rmem_rgn->base; + } + return true; + } + + return false; +} + void __init_memblock memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, bool reusable) { @@ -2070,7 +2137,14 @@ void __init_memblock memblock_memsize_record(const char *name, phys_addr_t base, pr_err("not enough space on memsize_rgn\n"); return; } - rgn = &memsize_rgn[memsize_rgn_count++]; + + if (memsize_update_nomap_region(name, base, size, nomap)) + return; + + rgn = memsize_get_new_rgn(); + if (!rgn) + return; + rgn->base = base; rgn->size = size; rgn->nomap = nomap; -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p3440f857e3b31b319c270e2d658379383@epcas1p3.samsung.com>]
* [RESEND PATCH 04/10] memblock: take a region intersecting an unknown region [not found] ` <CGME20240521024009epcas1p3440f857e3b31b319c270e2d658379383@epcas1p3.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim There is case where reserved regions overlapped with already checked as unknown regions. To get more information of the name, size, so far we allowed only regions which are exactly matching with or located within the unknown region. For a region intersecting an unknown region, we did not take and just showed that duplicated information. So total size was not perfect. To fix this, let's allow to take even the intersecting region. Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- mm/memblock.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 4a0506e14025..9b68ddc4af5e 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2081,20 +2081,54 @@ static bool __init_memblock memsize_update_nomap_region(const char *name, phys_a for (i = 0; i < memsize_rgn_count; i++) { rmem_rgn = &memsize_rgn[i]; + /* skip either !nomap, !unknown, !overlap */ if (!rmem_rgn->nomap) continue; if (strcmp(rmem_rgn->name, "unknown")) continue; - if (base < rmem_rgn->base) + if (base + size <= rmem_rgn->base) continue; - if (base + size > rmem_rgn->base + rmem_rgn->size) + if (base >= rmem_rgn->base + rmem_rgn->size) continue; + /* exactly same */ if (base == rmem_rgn->base && size == rmem_rgn->size) { memsize_get_valid_name(rmem_rgn->name, name); return true; } + /* bigger */ + if (base <= rmem_rgn->base && + base + size >= rmem_rgn->base + rmem_rgn->size) { + memsize_get_valid_name(rmem_rgn->name, name); + rmem_rgn->base = base; + rmem_rgn->size = size; + return true; + } + + /* intersect */ + if (base < rmem_rgn->base || + base + size > rmem_rgn->base + rmem_rgn->size) { + new_rgn = memsize_get_new_rgn(); + if (!new_rgn) + return true; + new_rgn->base = base; + new_rgn->size = size; + new_rgn->nomap = nomap; + new_rgn->reusable = false; + memsize_get_valid_name(new_rgn->name, name); + + if (base < rmem_rgn->base) { + rmem_rgn->size -= base + size - rmem_rgn->base; + rmem_rgn->base = base + size; + } else { + rmem_rgn->size -= rmem_rgn->base + + rmem_rgn->size - base; + } + return true; + } + + /* smaller */ new_rgn = memsize_get_new_rgn(); if (!new_rgn) return true; -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p20ddcabed3d037904a9c651d27f82c077@epcas1p2.samsung.com>]
* [RESEND PATCH 05/10] memblock: track memblock changed at early param [not found] ` <CGME20240521024009epcas1p20ddcabed3d037904a9c651d27f82c077@epcas1p2.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim In addition to reserved-memory in device tree, an option in cmdline may result in memblock allocation. This patch tries to distinguish memblock changes done at early param. A region in memsize will be created with name as the param string. And the region size will be updated during the param function. Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- include/linux/memblock.h | 4 ++ init/main.c | 13 +++++- mm/memblock.c | 94 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 107 insertions(+), 4 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 049313871059..aef02c150f2c 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -618,11 +618,15 @@ extern void memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, bool reusable); extern void memblock_memsize_detect_hole(void); +extern void memblock_memsize_set_name(const char *name); +extern void memblock_memsize_unset_name(void); #else static inline void memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, bool reusable) { } static inline void memblock_memsize_detect_hole(void) { } +static inline void memblock_memsize_set_name(const char *name) { } +static inline void memblock_memsize_unset_name(void) { } #endif #endif /* _LINUX_MEMBLOCK_H */ diff --git a/init/main.c b/init/main.c index 206acdde51f5..17c751aac854 100644 --- a/init/main.c +++ b/init/main.c @@ -212,8 +212,15 @@ static bool __init obsolete_checksetup(char *line) pr_warn("Parameter %s is obsolete, ignored\n", p->str); return true; - } else if (p->setup_func(line + n)) - return true; + } else { + int ret; + + memblock_memsize_set_name(p->str); + ret = p->setup_func(line + n); + memblock_memsize_unset_name(); + if (ret) + return true; + } } p++; } while (p < __setup_end); @@ -758,8 +765,10 @@ static int __init do_early_param(char *param, char *val, (strcmp(param, "console") == 0 && strcmp(p->str, "earlycon") == 0) ) { + memblock_memsize_set_name(p->str); if (p->setup_func(val) != 0) pr_warn("Malformed early option '%s'\n", param); + memblock_memsize_unset_name(); } } /* We accept everything at this stage. */ diff --git a/mm/memblock.c b/mm/memblock.c index 9b68ddc4af5e..edb2575967ab 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -178,6 +178,18 @@ static inline phys_addr_t memblock_cap_size(phys_addr_t base, phys_addr_t *size) return *size = min(*size, PHYS_ADDR_MAX - base); } +#ifdef CONFIG_MEMBLOCK_MEMSIZE +static void memblock_memsize_record_add(struct memblock_type *type, + phys_addr_t base, phys_addr_t size); +static void memblock_memsize_record_remove(struct memblock_type *type, + phys_addr_t base, phys_addr_t size); +#else +static inline void memblock_memsize_record_add(struct memblock_type *type, + phys_addr_t base, phys_addr_t size) { } +static inline void memblock_memsize_record_remove(struct memblock_type *type, + phys_addr_t base, phys_addr_t size) { } +#endif /* CONFIG_MEMBLOCK_MEMSIZE */ + /* * Address comparison utilities */ @@ -595,6 +607,7 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, phys_addr_t end = base + memblock_cap_size(base, &size); int idx, nr_new, start_rgn = -1, end_rgn; struct memblock_region *rgn; + phys_addr_t new_size = 0; if (!size) return 0; @@ -607,7 +620,8 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, type->regions[0].flags = flags; memblock_set_region_node(&type->regions[0], nid); type->total_size = size; - return 0; + new_size = size; + goto done; } /* @@ -654,6 +668,7 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, memblock_insert_region(type, idx++, base, rbase - base, nid, flags); + new_size += rbase - base; } } /* area below @rend is dealt with, forget about it */ @@ -669,6 +684,7 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, end_rgn = idx + 1; memblock_insert_region(type, idx, base, end - base, nid, flags); + new_size += end - base; } } @@ -687,8 +703,11 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, goto repeat; } else { memblock_merge_regions(type, start_rgn, end_rgn); - return 0; } +done: + if (new_size == size) + memblock_memsize_record_add(type, obase, size); + return 0; } /** @@ -858,6 +877,7 @@ static int __init_memblock memblock_remove_range(struct memblock_type *type, for (i = end_rgn - 1; i >= start_rgn; i--) memblock_remove_region(type, i); + memblock_memsize_record_remove(type, base, size); return 0; } @@ -2039,6 +2059,7 @@ struct memsize_rgn_struct { static struct memsize_rgn_struct memsize_rgn[CONFIG_MAX_MEMBLOCK_MEMSIZE] __initdata_memblock; static int memsize_rgn_count __initdata_memblock; +static const char *memblock_memsize_name __initdata_memblock; static void __init_memblock memsize_get_valid_name(char *valid_name, const char *name) { @@ -2237,6 +2258,75 @@ void __init memblock_memsize_detect_hole(void) } } } + +/* assume that freeing region is NOT bigger than the previous region */ +static void __init_memblock memblock_memsize_free(phys_addr_t free_base, + phys_addr_t free_size) +{ + int i; + struct memsize_rgn_struct *rgn; + phys_addr_t free_end, end; + + free_end = free_base + free_size - 1; + memblock_dbg("%s %pa..%pa\n", + __func__, &free_base, &free_end); + + for (i = 0; i < memsize_rgn_count; i++) { + rgn = &memsize_rgn[i]; + + end = rgn->base + rgn->size; + if (free_base < rgn->base || + free_base >= end) + continue; + + free_end = free_base + free_size; + if (free_base == rgn->base) { + rgn->size -= free_size; + if (rgn->size != 0) + rgn->base += free_size; + } else if (free_end == end) { + rgn->size -= free_size; + } else { + memblock_memsize_record(rgn->name, free_end, + end - free_end, rgn->nomap, rgn->reusable); + rgn->size = free_base - rgn->base; + } + } +} + +void __init memblock_memsize_set_name(const char *name) +{ + memblock_memsize_name = name; +} + +void __init memblock_memsize_unset_name(void) +{ + memblock_memsize_name = NULL; +} + +static void __init_memblock memblock_memsize_record_add(struct memblock_type *type, + phys_addr_t base, phys_addr_t size) +{ + if (memblock_memsize_name) { + if (type == &memblock.reserved) + memblock_memsize_record(memblock_memsize_name, + base, size, false, false); + else if (type == &memblock.memory) + memblock_memsize_free(base, size); + } +} + +static void __init_memblock memblock_memsize_record_remove(struct memblock_type *type, + phys_addr_t base, phys_addr_t size) +{ + if (memblock_memsize_name) { + if (type == &memblock.reserved) + memblock_memsize_free(base, size); + else if (type == &memblock.memory) + memblock_memsize_record(memblock_memsize_name, + base, size, true, false); + } +} #endif /* MEMBLOCK_MEMSIZE */ static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn) -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p40d0ea59e8ae93f6cc89846626fea4207@epcas1p4.samsung.com>]
* [RESEND PATCH 06/10] memblock: recognize late freed size by checking PageReserved [not found] ` <CGME20240521024009epcas1p40d0ea59e8ae93f6cc89846626fea4207@epcas1p4.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim There are some cases in which reserved pages are freed late after the initial memblock_free_all of mem_init. We'd like to recognize this late free pages, and update the memsize information. Because additional job is needed to a no-map or reusable region, the late free is usually done to a map and unusable region. So only for map and unusable region, check if some pages within the region is freed. The freed pages can be recoginzed by checking if PageReserved flag is clear. To be fast, let's skip other pages within 64 KB range. And this check is done when a user wants to see the memsize information. This is an example. If all pages are freed the region size will be 0. Before 0x0a2300000-0x0a2400000 0x00100000 ( 1024 KB ) map unusable latefree After 0x0a2300000-0x0a2300000 0x00000000 ( 0 KB ) map unusable latefree Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- mm/memblock.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/mm/memblock.c b/mm/memblock.c index edb2575967ab..de49e7ce74f1 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2608,6 +2608,39 @@ static int memsize_rgn_cmp(const void *a, const void *b) return 0; } +/* assume that freed size is always 64 KB aligned */ +static inline void memblock_memsize_check_size(struct memsize_rgn_struct *rgn) +{ + phys_addr_t phy, end, freed = 0; + bool has_freed = false; + struct page *page; + + if (rgn->reusable || rgn->nomap) + return; + + /* check the first page of each 1 MB */ + phy = rgn->base; + end = rgn->base + rgn->size; + while (phy < end) { + unsigned long pfn = __phys_to_pfn(phy); + + if (!pfn_valid(pfn)) + return; + page = pfn_to_page(pfn); + if (!has_freed && !PageReserved(page)) { + has_freed = true; + freed = phy; + } else if (has_freed && PageReserved(page)) { + has_freed = false; + memblock_memsize_free(freed, phy - freed); + } + + if (has_freed && (phy + SZ_64K >= end)) + memblock_memsize_free(freed, end - freed); + phy += SZ_64K; + } +} + static int memblock_memsize_show(struct seq_file *m, void *private) { int i; @@ -2621,6 +2654,7 @@ static int memblock_memsize_show(struct seq_file *m, void *private) long size; rgn = &memsize_rgn[i]; + memblock_memsize_check_size(rgn); base = rgn->base; size = rgn->size; end = base + size; -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p3ccda7b2d9e6518b4575427c957e19377@epcas1p3.samsung.com>]
* [RESEND PATCH 07/10] memblock: track kernel size on memsize [not found] ` <CGME20240521024009epcas1p3ccda7b2d9e6518b4575427c957e19377@epcas1p3.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 2024-05-22 19:03 ` kernel test robot 0 siblings, 1 reply; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim Some memory regions are already being tracked by previous patches. But there are many memory allocations from memblock and frees to memblock during the boot time. This patch tracks the memblock size used for the common kernel. To to this, tracking memblock size is disabled for some memory handling logics like early param, device tree, and default cma size. For precise kernel size, this patch counts not actually freed size to buddy at boot time, and does not count freed size from ramdisk and init section. Additionally this patch does one important thing. This patch blocks memblock_add_range of memblock_remove_range not to update memsize if free pages were already released to the buddy allocator. This is an example. The kernel size is newly added by this patch. .kernel : 135137 KB .unusable : 788073 KB .reusable : 294912 KB Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- drivers/of/fdt.c | 6 ++++++ include/linux/memblock.h | 6 ++++++ kernel/dma/contiguous.c | 7 ++++-- mm/memblock.c | 46 ++++++++++++++++++++++++++++++++++++++++ mm/page_alloc.c | 10 ++++++++- 5 files changed, 72 insertions(+), 3 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index da82e5afed01..08638673e106 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -524,6 +524,8 @@ void __init early_init_fdt_scan_reserved_mem(void) if (!initial_boot_params) return; + memblock_memsize_disable_tracking(); + fdt_scan_reserved_mem(); fdt_reserve_elfcorehdr(); @@ -537,6 +539,7 @@ void __init early_init_fdt_scan_reserved_mem(void) } fdt_init_reserved_mem(); + memblock_memsize_enable_tracking(); } /** @@ -1189,12 +1192,15 @@ void __init early_init_dt_scan_nodes(void) if (rc) pr_warn("No chosen node found, continuing without\n"); + memblock_memsize_disable_tracking(); + /* Setup memory, calling early_init_dt_add_memory_arch */ early_init_dt_scan_memory(); /* Handle linux,usable-memory-range property */ early_init_dt_check_for_usable_mem_range(); + memblock_memsize_enable_tracking(); memblock_memsize_detect_hole(); } diff --git a/include/linux/memblock.h b/include/linux/memblock.h index aef02c150f2c..a83ad98ac252 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -620,6 +620,9 @@ extern void memblock_memsize_record(const char *name, phys_addr_t base, extern void memblock_memsize_detect_hole(void); extern void memblock_memsize_set_name(const char *name); extern void memblock_memsize_unset_name(void); +extern void memblock_memsize_enable_tracking(void); +extern void memblock_memsize_disable_tracking(void); +extern void memblock_memsize_mod_kernel_size(long size); #else static inline void memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, @@ -627,6 +630,9 @@ static inline void memblock_memsize_record(const char *name, phys_addr_t base, static inline void memblock_memsize_detect_hole(void) { } static inline void memblock_memsize_set_name(const char *name) { } static inline void memblock_memsize_unset_name(void) { } +static inline void memblock_memsize_enable_tracking(void){ } +static inline void memblock_memsize_disable_tracking(void){ } +static inline void memblock_memsize_mod_kernel_size(long size) { } #endif #endif /* _LINUX_MEMBLOCK_H */ diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index 437c85878280..e9c68b1ee975 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -277,10 +277,11 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, { int ret; + memblock_memsize_disable_tracking(); ret = cma_declare_contiguous(base, size, limit, 0, 0, fixed, "reserved", res_cma); if (ret) - return ret; + goto out; /* Architecture specific contiguous memory fixup. */ dma_contiguous_early_fixup(cma_get_base(*res_cma), @@ -288,7 +289,9 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, memblock_memsize_record("dma_cma", cma_get_base(*res_cma), cma_get_size(*res_cma), false, true); - return 0; +out: + memblock_memsize_enable_tracking(); + return ret; } /** diff --git a/mm/memblock.c b/mm/memblock.c index de49e7ce74f1..bb033c20ec43 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2060,6 +2060,23 @@ struct memsize_rgn_struct { static struct memsize_rgn_struct memsize_rgn[CONFIG_MAX_MEMBLOCK_MEMSIZE] __initdata_memblock; static int memsize_rgn_count __initdata_memblock; static const char *memblock_memsize_name __initdata_memblock; +static long memsize_kinit __initdata_memblock; +static bool memblock_memsize_tracking __initdata_memblock = true; + +void __init memblock_memsize_enable_tracking(void) +{ + memblock_memsize_tracking = true; +} + +void __init memblock_memsize_disable_tracking(void) +{ + memblock_memsize_tracking = false; +} + +void memblock_memsize_mod_kernel_size(long size) +{ + memsize_kinit += size; +} static void __init_memblock memsize_get_valid_name(char *valid_name, const char *name) { @@ -2313,6 +2330,12 @@ static void __init_memblock memblock_memsize_record_add(struct memblock_type *ty base, size, false, false); else if (type == &memblock.memory) memblock_memsize_free(base, size); + } else if (memblock_memsize_tracking) { + if (type == &memblock.reserved) { + memblock_dbg("%s: kernel %lu %+ld\n", __func__, + memsize_kinit, (unsigned long)size); + memsize_kinit += size; + } } } @@ -2325,6 +2348,12 @@ static void __init_memblock memblock_memsize_record_remove(struct memblock_type else if (type == &memblock.memory) memblock_memsize_record(memblock_memsize_name, base, size, true, false); + } else if (memblock_memsize_tracking) { + if (type == &memblock.reserved) { + memblock_dbg("%s: kernel %lu %+ld\n", __func__, + memsize_kinit, (unsigned long)size); + memsize_kinit -= size; + } } } #endif /* MEMBLOCK_MEMSIZE */ @@ -2442,6 +2471,19 @@ static unsigned long __init __free_memory_core(phys_addr_t start, unsigned long end_pfn = min_t(unsigned long, PFN_DOWN(end), max_low_pfn); +#ifdef CONFIG_MEMBLOCK_MEMSIZE + unsigned long start_align_up = PFN_ALIGN(start); + unsigned long end_align_down = PFN_PHYS(end_pfn); + + if (start_pfn >= end_pfn) { + memblock_memsize_mod_kernel_size(end - start); + } else { + if (start_align_up > start) + memblock_memsize_mod_kernel_size(start_align_up - start); + if (end_pfn != max_low_pfn && end_align_down < end) + memblock_memsize_mod_kernel_size(end - end_align_down); + } +#endif if (start_pfn >= end_pfn) return 0; @@ -2546,6 +2588,8 @@ void __init memblock_free_all(void) pages = free_low_memory_core_early(); totalram_pages_add(pages); + + memblock_memsize_disable_tracking(); } #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_ARCH_KEEP_MEMBLOCK) @@ -2672,6 +2716,8 @@ static int memblock_memsize_show(struct seq_file *m, void *private) } seq_puts(m, "\n"); + seq_printf(m, " .kernel : %7lu KB\n", + DIV_ROUND_UP(memsize_kinit, SZ_1K)); seq_printf(m, " .unusable : %7lu KB\n", DIV_ROUND_UP(reserved, SZ_1K)); seq_printf(m, " .reusable : %7lu KB\n", diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2e22ce5675ca..a4c692635e9b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -20,6 +20,7 @@ #include <linux/highmem.h> #include <linux/interrupt.h> #include <linux/jiffies.h> +#include <linux/memblock.h> #include <linux/compiler.h> #include <linux/kernel.h> #include <linux/kasan.h> @@ -5776,8 +5777,15 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char free_reserved_page(page); } - if (pages && s) + if (pages && s) { pr_info("Freeing %s memory: %ldK\n", s, K(pages)); + if (!strcmp(s, "initrd") || !strcmp(s, "unused kernel")) { + long size; + + size = -1 * (long)(pages << PAGE_SHIFT); + memblock_memsize_mod_kernel_size(size); + } + } return pages; } -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [RESEND PATCH 07/10] memblock: track kernel size on memsize 2024-05-21 2:39 ` [RESEND PATCH 07/10] memblock: track kernel size on memsize Jaewon Kim @ 2024-05-22 19:03 ` kernel test robot 0 siblings, 0 replies; 38+ messages in thread From: kernel test robot @ 2024-05-22 19:03 UTC (permalink / raw) To: Jaewon Kim, rppt, vbabka, akpm Cc: oe-kbuild-all, linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim Hi Jaewon, kernel test robot noticed the following build warnings: [auto build test WARNING on akpm-mm/mm-everything] [also build test WARNING on robh/for-next linus/master] [cannot apply to rppt-memblock/for-next v6.9 next-20240522] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jaewon-Kim/memblock-introduce-memsize-showing-reserved-memory/20240521-104201 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20240521023957.2587005-8-jaewon31.kim%40samsung.com patch subject: [RESEND PATCH 07/10] memblock: track kernel size on memsize config: parisc-randconfig-r132-20240522 (https://download.01.org/0day-ci/archive/20240523/202405230205.weXQmtTg-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 13.2.0 reproduce: (https://download.01.org/0day-ci/archive/20240523/202405230205.weXQmtTg-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202405230205.weXQmtTg-lkp@intel.com/ All warnings (new ones prefixed by >>, old ones prefixed by <<): WARNING: modpost: missing MODULE_DESCRIPTION() in vmlinux.o >> WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0xc (section: .text) -> memsize_kinit (section: .meminit.data) WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0x10 (section: .text) -> memsize_kinit (section: .meminit.data) WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0x18 (section: .text) -> memsize_kinit (section: .meminit.data) WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/rcuscale.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/time/time_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in mm/dmapool_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/fat/fat_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp437.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp775.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp865.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp866.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp869.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp936.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-5.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-14.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_koi8-u.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_koi8-ru.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-cyrillic.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-gaelic.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-iceland.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-romanian.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-roman.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-turkish.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_ucs2_utils.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/binfmt_script.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/ext4/ext4-inode-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/jbd2/jbd2.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/btrfs/btrfs.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/bcachefs/mean_and_variance_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in security/keys/trusted-keys/trusted.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-example-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/math/prime_numbers.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/asn1_encoder.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/irqchip/irq-meson-gpio.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/dwc/pci-exynos.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera-msi.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mediatek-gen3.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/backlight/platform_lcd.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/backlight/rt4831-backlight.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_accel.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_DAC1064.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_Ti3026.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/macmodes.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/via/viafb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/kyro/kyrofb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/qcom/hdma_mgmt.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/ti/omap-dma.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/dmatest.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/soc/imx/soc-imx8m.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/soc/ixp4xx/ixp4xx-qmgr.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/max20411-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/rt4831-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/reset/hisilicon/hi6220_reset.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/tty/serial/8250/8250_pxa.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/tty/serial/8250/serial_cs.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/hw_random/omap-rng.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/lp.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/ppdev.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/iommu/iova.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-ram.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-raw-ram.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-spmi.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-w1.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/block/loop.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/arizona.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/pcf50633-gpio.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/rt4831.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dax/dax.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/chips/cfi_cmdset_0020.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/rtc/lib_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/rtc/rtc-tps65910.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-ccgx-ucsi.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-ali1563.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-pxa.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/i2c/uda1342.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/tuners/tda9887.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/dvb-frontends/au8522_decoder.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/dvb-frontends/mb86a16.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/rc/rc-core.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/common/videobuf2/videobuf2-dvb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/saa7134/saa7134-empress.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/saa7134/saa7134-dvb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/v4l2-core/v4l2-async.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/v4l2-core/v4l2-fwnode.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/power/reset/piix4-poweroff.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/watchdog/omap_wdt.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/watchdog/menz69_wdt.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mmc/core/mmc_core.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_simpleondemand.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_performance.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_userspace.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/perf/fsl_imx8_ddr_perf.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hwtracing/intel_th/intel_th_msu_sink.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvmem/nvmem-apple-efuses.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mm-interconnect.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mn-interconnect.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mp-interconnect.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/parport/parport.o -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p291bbc11c4e5cdaa922ca302d95330e6b@epcas1p2.samsung.com>]
* [RESEND PATCH 08/10] memblock: print memsize summary information [not found] ` <CGME20240521024009epcas1p291bbc11c4e5cdaa922ca302d95330e6b@epcas1p2.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim With the previous patches, now we can print summary information. Here's an example of 4GB DRAM device. Reserved : 746924 KB .kernel : 137027 KB .unusable : 609897 KB System : 3447380 KB .common : 3152468 KB .reusable : 294912 KB Total : 4194304 KB ( 4096.00 MB ) Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- mm/memblock.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mm/memblock.c b/mm/memblock.c index bb033c20ec43..0906d81f66c2 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2689,7 +2689,8 @@ static int memblock_memsize_show(struct seq_file *m, void *private) { int i; struct memsize_rgn_struct *rgn; - unsigned long reserved = 0, reusable = 0; + unsigned long reserved = 0, reusable = 0, total; + unsigned long system = totalram_pages() << PAGE_SHIFT; sort(memsize_rgn, memsize_rgn_count, sizeof(memsize_rgn[0]), memsize_rgn_cmp, NULL); @@ -2715,13 +2716,24 @@ static int memblock_memsize_show(struct seq_file *m, void *private) reserved += (unsigned long)rgn->size; } + total = memsize_kinit + reserved + system; + seq_puts(m, "\n"); + seq_printf(m, "Reserved : %7lu KB\n", + DIV_ROUND_UP(memsize_kinit + reserved, SZ_1K)); seq_printf(m, " .kernel : %7lu KB\n", DIV_ROUND_UP(memsize_kinit, SZ_1K)); seq_printf(m, " .unusable : %7lu KB\n", DIV_ROUND_UP(reserved, SZ_1K)); + seq_printf(m, "System : %7lu KB\n", + DIV_ROUND_UP(system, SZ_1K)); + seq_printf(m, " .common : %7lu KB\n", + DIV_ROUND_UP(system - reusable, SZ_1K)); seq_printf(m, " .reusable : %7lu KB\n", DIV_ROUND_UP(reusable, SZ_1K)); + seq_printf(m, "Total : %7lu KB ( %5lu.%02lu MB )\n", + DIV_ROUND_UP(total, SZ_1K), + total >> 20, ((total % SZ_1M) * 100) >> 20); return 0; } -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p441a4c458d251eec7bb6e63e671c25b4e@epcas1p4.samsung.com>]
* [RESEND PATCH 09/10] memblock: print kernel internal size [not found] ` <CGME20240521024009epcas1p441a4c458d251eec7bb6e63e671c25b4e@epcas1p4.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 2024-05-22 18:52 ` kernel test robot 0 siblings, 1 reply; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim Kernel internal size information is also useful to compare with other binary. This patch print kernel text, rwdata, rodata, bss, and others. Here's an example. Reserved : 1181708 KB .kernel : 296172 KB .text : 16960 KB .rwdata : 2299 KB .rodata : 16464 KB .bss : 7549 KB .memmap : 196608 KB .etc : 56293 KB .unusable : 885536 KB Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- include/linux/memblock.h | 6 ++++++ mm/memblock.c | 36 ++++++++++++++++++++++++++++++++++++ mm/mm_init.c | 6 +++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index a83ad98ac252..7ab8b59bfbc1 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -623,6 +623,9 @@ extern void memblock_memsize_unset_name(void); extern void memblock_memsize_enable_tracking(void); extern void memblock_memsize_disable_tracking(void); extern void memblock_memsize_mod_kernel_size(long size); +extern void memblock_memsize_mod_memmap_size(long size); +extern void memblock_memsize_kernel_code_data(unsigned long code, + unsigned long data, unsigned long ro, unsigned long bss); #else static inline void memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, @@ -633,6 +636,9 @@ static inline void memblock_memsize_unset_name(void) { } static inline void memblock_memsize_enable_tracking(void){ } static inline void memblock_memsize_disable_tracking(void){ } static inline void memblock_memsize_mod_kernel_size(long size) { } +static inline void memblock_memsize_mod_memmap_size(long size) { } +static inline void memblock_memsize_kernel_code_data(unsigned long code, + unsigned long data, unsigned long ro, unsigned long bss) { } #endif #endif /* _LINUX_MEMBLOCK_H */ diff --git a/mm/memblock.c b/mm/memblock.c index 0906d81f66c2..2fe0dc2575c5 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2061,6 +2061,11 @@ static struct memsize_rgn_struct memsize_rgn[CONFIG_MAX_MEMBLOCK_MEMSIZE] __init static int memsize_rgn_count __initdata_memblock; static const char *memblock_memsize_name __initdata_memblock; static long memsize_kinit __initdata_memblock; +static long memsize_memap __initdata_memblock; +static unsigned long memsize_code __initdata_memblock; +static unsigned long memsize_data __initdata_memblock; +static unsigned long memsize_ro __initdata_memblock; +static unsigned long memsize_bss __initdata_memblock; static bool memblock_memsize_tracking __initdata_memblock = true; void __init memblock_memsize_enable_tracking(void) @@ -2073,11 +2078,25 @@ void __init memblock_memsize_disable_tracking(void) memblock_memsize_tracking = false; } +void __init memblock_memsize_mod_memmap_size(long size) +{ + memsize_memap += size; +} + void memblock_memsize_mod_kernel_size(long size) { memsize_kinit += size; } +void __init memblock_memsize_kernel_code_data(unsigned long code, unsigned long data, + unsigned long ro, unsigned long bss) +{ + memsize_code = code; + memsize_data = data; + memsize_ro = ro; + memsize_bss = bss; +} + static void __init_memblock memsize_get_valid_name(char *valid_name, const char *name) { char *head, *tail, *found; @@ -2691,6 +2710,11 @@ static int memblock_memsize_show(struct seq_file *m, void *private) struct memsize_rgn_struct *rgn; unsigned long reserved = 0, reusable = 0, total; unsigned long system = totalram_pages() << PAGE_SHIFT; + unsigned long etc; + + etc = memsize_kinit; + etc -= memsize_code + memsize_data + memsize_ro + memsize_bss + + memsize_memap; sort(memsize_rgn, memsize_rgn_count, sizeof(memsize_rgn[0]), memsize_rgn_cmp, NULL); @@ -2723,6 +2747,18 @@ static int memblock_memsize_show(struct seq_file *m, void *private) DIV_ROUND_UP(memsize_kinit + reserved, SZ_1K)); seq_printf(m, " .kernel : %7lu KB\n", DIV_ROUND_UP(memsize_kinit, SZ_1K)); + seq_printf(m, " .text : %7lu KB\n" + " .rwdata : %7lu KB\n" + " .rodata : %7lu KB\n" + " .bss : %7lu KB\n" + " .memmap : %7lu KB\n" + " .etc : %7lu KB\n", + DIV_ROUND_UP(memsize_code, SZ_1K), + DIV_ROUND_UP(memsize_data, SZ_1K), + DIV_ROUND_UP(memsize_ro, SZ_1K), + DIV_ROUND_UP(memsize_bss, SZ_1K), + DIV_ROUND_UP(memsize_memap, SZ_1K), + DIV_ROUND_UP(etc, SZ_1K)); seq_printf(m, " .unusable : %7lu KB\n", DIV_ROUND_UP(reserved, SZ_1K)); seq_printf(m, "System : %7lu KB\n", diff --git a/mm/mm_init.c b/mm/mm_init.c index f72b852bd5b8..45187904db49 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1587,8 +1587,10 @@ void __init *memmap_alloc(phys_addr_t size, phys_addr_t align, MEMBLOCK_ALLOC_ACCESSIBLE, nid); - if (ptr && size > 0) + if (ptr && size > 0) { page_init_poison(ptr, size); + memblock_memsize_mod_memmap_size((long)size); + } return ptr; } @@ -2679,6 +2681,8 @@ static void __init mem_init_print_info(void) init_data_size = __init_end - __init_begin; init_code_size = _einittext - _sinittext; + memblock_memsize_kernel_code_data(codesize, datasize, rosize, bss_size); + /* * Detect special cases and adjust section sizes accordingly: * 1) .init.* may be embedded into .data sections -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [RESEND PATCH 09/10] memblock: print kernel internal size 2024-05-21 2:39 ` [RESEND PATCH 09/10] memblock: print kernel internal size Jaewon Kim @ 2024-05-22 18:52 ` kernel test robot 0 siblings, 0 replies; 38+ messages in thread From: kernel test robot @ 2024-05-22 18:52 UTC (permalink / raw) To: Jaewon Kim, rppt, vbabka, akpm Cc: oe-kbuild-all, linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim Hi Jaewon, kernel test robot noticed the following build warnings: [auto build test WARNING on akpm-mm/mm-everything] [also build test WARNING on robh/for-next linus/master] [cannot apply to rppt-memblock/for-next v6.9 next-20240522] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jaewon-Kim/memblock-introduce-memsize-showing-reserved-memory/20240521-104201 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20240521023957.2587005-10-jaewon31.kim%40samsung.com patch subject: [RESEND PATCH 09/10] memblock: print kernel internal size config: x86_64-randconfig-r052-20240522 (https://download.01.org/0day-ci/archive/20240523/202405230254.q2SvX2V8-lkp@intel.com/config) compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240523/202405230254.q2SvX2V8-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202405230254.q2SvX2V8-lkp@intel.com/ All warnings (new ones prefixed by >>, old ones prefixed by <<): WARNING: modpost: missing MODULE_DESCRIPTION() in vmlinux.o >> WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0x11 (section: .text) -> memsize_memap (section: .meminit.data) WARNING: modpost: missing MODULE_DESCRIPTION() in arch/x86/kernel/cpu/mce/mce-inject.o WARNING: modpost: missing MODULE_DESCRIPTION() in arch/x86/crypto/curve25519-x86_64.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/locking/locktorture.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/locking/test-ww_mutex.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/rcutorture.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/rcuscale.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/refscale.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/time/clocksource-wdtest.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/time/time_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/torture.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/resource_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/sysctl-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in mm/kasan/kasan_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in mm/dmapool_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in mm/hwpoison-inject.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/fat/fat_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nfs/nfsv4.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp437.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp737.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp860.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp864.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp936.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp949.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp1251.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-1.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-6.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp1255.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-15.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_koi8-r.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-gaelic.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-turkish.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_ucs2_utils.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/cramfs/cramfs.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/isofs/isofs.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/hfs/hfs.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/smb/common/cifs_arc4.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/smb/common/cifs_md4.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/qnx4/qnx4.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/qnx6/qnx6.o WARNING: modpost: missing MODULE_DESCRIPTION() in crypto/curve25519-generic.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-example-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/math/rational-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/string_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/string_helpers_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/find_bit_benchmark.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_firmware.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/cpumask_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_hash.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_ida.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_list_sort.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_module.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_sort.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_static_keys.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_static_key_base.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_printf.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_bitmap.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_maple_tree.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_free_pages.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_kprobes.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_ref_tracker.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/atomic64_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/bitfield_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/checksum_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/list-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/hashtable_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_bits.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/cmdline_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/slub_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/memcpy_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/is_signed_type_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/overflow_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/stackinit_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/fortify_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/siphash_kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pinctrl/pinctrl-mcp23s08_i2c.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/backlight/platform_lcd.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/clk/clk_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/clk/clk-gate_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/clk/clk-fractional-divider_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/qcom/hdma.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/dmatest.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/rt4831-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/tty/ttynull.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/lp.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/ppdev.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/tlclk.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_kunit_helpers.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_buddy_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_cmdline_parser_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_connector_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_damage_helper_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_dp_mst_helper_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_exec_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_format_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_framebuffer_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_gem_shmem_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_managed_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_mm_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpu/drm/tests/drm_modes_test.o -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p15a3290b675ee66339033c185a5a8c00b@epcas1p1.samsung.com>]
* [RESEND PATCH 10/10] memblock: support memsize reusable to consider as reusable [not found] ` <CGME20240521024009epcas1p15a3290b675ee66339033c185a5a8c00b@epcas1p1.samsung.com> @ 2024-05-21 2:39 ` Jaewon Kim 2024-05-22 22:40 ` kernel test robot [not found] ` <CGME20240522224129epcas1p10433785cc14bef5de93e9f26aa599ff0@epcms1p8> 0 siblings, 2 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:39 UTC (permalink / raw) To: rppt, vbabka, akpm; +Cc: linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim Sometimes we'd like to include some memory region as reusable even though it is actually not CMA type. In that case, add reusable in its device tree description, then memsize will consider it is reusuable and add its size to the system total memory size. Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com> --- drivers/of/of_reserved_mem.c | 3 +++ include/linux/memblock.h | 2 ++ mm/memblock.c | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index ece678e07304..7aedac213995 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -468,6 +468,9 @@ void __init fdt_init_reserved_mem(void) memblock_memsize_record(rmem->name, rmem->base, rmem->size, nomap, reusable); + if (reusable && + !of_flat_dt_is_compatible(node, "shared-dma-pool")) + memblock_memsize_mod_reusable_size(rmem->size); } } } diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 7ab8b59bfbc1..0aa6202a7a6a 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -626,6 +626,7 @@ extern void memblock_memsize_mod_kernel_size(long size); extern void memblock_memsize_mod_memmap_size(long size); extern void memblock_memsize_kernel_code_data(unsigned long code, unsigned long data, unsigned long ro, unsigned long bss); +extern void memblock_memsize_mod_reusable_size(long size); #else static inline void memblock_memsize_record(const char *name, phys_addr_t base, phys_addr_t size, bool nomap, @@ -639,6 +640,7 @@ static inline void memblock_memsize_mod_kernel_size(long size) { } static inline void memblock_memsize_mod_memmap_size(long size) { } static inline void memblock_memsize_kernel_code_data(unsigned long code, unsigned long data, unsigned long ro, unsigned long bss) { } +static inline void memblock_memsize_mod_reusable_size(long size) { } #endif #endif /* _LINUX_MEMBLOCK_H */ diff --git a/mm/memblock.c b/mm/memblock.c index 2fe0dc2575c5..a20d60d3bb40 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2066,6 +2066,7 @@ static unsigned long memsize_code __initdata_memblock; static unsigned long memsize_data __initdata_memblock; static unsigned long memsize_ro __initdata_memblock; static unsigned long memsize_bss __initdata_memblock; +static long memsize_reusable_size __initdata_memblock; static bool memblock_memsize_tracking __initdata_memblock = true; void __init memblock_memsize_enable_tracking(void) @@ -2117,6 +2118,11 @@ static void __init_memblock memsize_get_valid_name(char *valid_name, const char valid_name[val_size] = '\0'; } +void memblock_memsize_mod_reusable_size(long size) +{ + memsize_reusable_size += size; +} + static inline struct memsize_rgn_struct * __init_memblock memsize_get_new_rgn(void) { if (memsize_rgn_count == ARRAY_SIZE(memsize_rgn)) { @@ -2716,6 +2722,7 @@ static int memblock_memsize_show(struct seq_file *m, void *private) etc -= memsize_code + memsize_data + memsize_ro + memsize_bss + memsize_memap; + system += memsize_reusable_size; sort(memsize_rgn, memsize_rgn_count, sizeof(memsize_rgn[0]), memsize_rgn_cmp, NULL); for (i = 0; i < memsize_rgn_count; i++) { -- 2.25.1 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [RESEND PATCH 10/10] memblock: support memsize reusable to consider as reusable 2024-05-21 2:39 ` [RESEND PATCH 10/10] memblock: support memsize reusable to consider as reusable Jaewon Kim @ 2024-05-22 22:40 ` kernel test robot [not found] ` <CGME20240522224129epcas1p10433785cc14bef5de93e9f26aa599ff0@epcms1p8> 1 sibling, 0 replies; 38+ messages in thread From: kernel test robot @ 2024-05-22 22:40 UTC (permalink / raw) To: Jaewon Kim, rppt, vbabka, akpm Cc: oe-kbuild-all, linux-mm, linux-kernel, jaewon31.kim, Jaewon Kim Hi Jaewon, kernel test robot noticed the following build warnings: [auto build test WARNING on akpm-mm/mm-everything] [also build test WARNING on robh/for-next linus/master] [cannot apply to rppt-memblock/for-next v6.9 next-20240522] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jaewon-Kim/memblock-introduce-memsize-showing-reserved-memory/20240521-104201 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20240521023957.2587005-11-jaewon31.kim%40samsung.com patch subject: [RESEND PATCH 10/10] memblock: support memsize reusable to consider as reusable config: parisc-randconfig-r132-20240522 (https://download.01.org/0day-ci/archive/20240523/202405230627.Lbju2ReQ-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 13.2.0 reproduce: (https://download.01.org/0day-ci/archive/20240523/202405230627.Lbju2ReQ-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202405230627.Lbju2ReQ-lkp@intel.com/ All warnings (new ones prefixed by >>, old ones prefixed by <<): WARNING: modpost: missing MODULE_DESCRIPTION() in vmlinux.o WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0xc (section: .text) -> memsize_kinit (section: .meminit.data) WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0x10 (section: .text) -> memsize_kinit (section: .meminit.data) WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0x18 (section: .text) -> memsize_kinit (section: .meminit.data) >> WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_reusable_size+0xc (section: .text) -> memsize_reusable_size (section: .meminit.data) WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_reusable_size+0x10 (section: .text) -> memsize_reusable_size (section: .meminit.data) WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_reusable_size+0x18 (section: .text) -> memsize_reusable_size (section: .meminit.data) WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/rcuscale.o WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/time/time_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in mm/dmapool_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/fat/fat_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp437.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp775.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp865.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp866.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp869.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp936.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-5.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-14.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_koi8-u.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_koi8-ru.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-cyrillic.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-gaelic.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-iceland.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-romanian.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-roman.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-turkish.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_ucs2_utils.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/binfmt_script.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/ext4/ext4-inode-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/jbd2/jbd2.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/btrfs/btrfs.o WARNING: modpost: missing MODULE_DESCRIPTION() in fs/bcachefs/mean_and_variance_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in security/keys/trusted-keys/trusted.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-example-test.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/math/prime_numbers.o WARNING: modpost: missing MODULE_DESCRIPTION() in lib/asn1_encoder.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/irqchip/irq-meson-gpio.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/dwc/pci-exynos.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera-msi.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mediatek-gen3.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/backlight/platform_lcd.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/backlight/rt4831-backlight.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_accel.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_DAC1064.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_Ti3026.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/macmodes.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/via/viafb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/kyro/kyrofb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/qcom/hdma_mgmt.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/ti/omap-dma.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/dmatest.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/soc/imx/soc-imx8m.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/soc/ixp4xx/ixp4xx-qmgr.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/max20411-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/rt4831-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/reset/hisilicon/hi6220_reset.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/tty/serial/8250/8250_pxa.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/tty/serial/8250/serial_cs.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/hw_random/omap-rng.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/lp.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/ppdev.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/iommu/iova.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-kunit.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-ram.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-raw-ram.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-spmi.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-w1.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/block/loop.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/arizona.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/pcf50633-gpio.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/rt4831.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dax/dax.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/chips/cfi_cmdset_0020.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/rtc/lib_test.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/rtc/rtc-tps65910.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-ccgx-ucsi.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-ali1563.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-pxa.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/i2c/uda1342.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/tuners/tda9887.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/dvb-frontends/au8522_decoder.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/dvb-frontends/mb86a16.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/rc/rc-core.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/common/videobuf2/videobuf2-dvb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/saa7134/saa7134-empress.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/saa7134/saa7134-dvb.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/v4l2-core/v4l2-async.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/v4l2-core/v4l2-fwnode.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/power/reset/piix4-poweroff.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/watchdog/omap_wdt.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/watchdog/menz69_wdt.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mmc/core/mmc_core.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_simpleondemand.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_performance.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_userspace.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/perf/fsl_imx8_ddr_perf.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hwtracing/intel_th/intel_th_msu_sink.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvmem/nvmem-apple-efuses.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mm-interconnect.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mn-interconnect.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mp-interconnect.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/parport/parport.o -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240522224129epcas1p10433785cc14bef5de93e9f26aa599ff0@epcms1p8>]
* RE: [RESEND PATCH 10/10] memblock: support memsize reusable to consider as reusable [not found] ` <CGME20240522224129epcas1p10433785cc14bef5de93e9f26aa599ff0@epcms1p8> @ 2024-05-23 10:55 ` Jaewon Kim 0 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-23 10:55 UTC (permalink / raw) >Hi Jaewon, > >kernel test robot noticed the following build warnings: > >[auto build test WARNING on akpm-mm/mm-everything] >[also build test WARNING on robh/for-next linus/master] >[cannot apply to rppt-memblock/for-next v6.9 next-20240522] >[If your patch is applied to the wrong git tree, kindly drop us a note. >And when submitting patch, we suggest to use '--base' as documented in >https://git-scm.com/docs/git-format-patch#_base_tree_information] > >url: https://protect2.fireeye.com/v1/url?k=eeb651b5-8f3d4490-eeb7dafa-74fe485cbff6-70727e39703bc1b9&q=1&e=b37f3e53-b854-4dfb-9724-75f10a4c8c98&u=https%3A%2F%2Fgithub.com%2Fintel-lab-lkp%2Flinux%2Fcommits%2FJaewon-Kim%2Fmemblock-introduce-memsize-showing-reserved-memory%2F20240521-104201 >base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything >patch link: https://lore.kernel.org/r/20240521023957.2587005-11-jaewon31.kim%40samsung.com >patch subject: [RESEND PATCH 10/10] memblock: support memsize reusable to consider as reusable >config: parisc-randconfig-r132-20240522 (https://download.01.org/0day-ci/archive/20240523/202405230627.Lbju2ReQ-lkp@intel.com/config) >compiler: hppa-linux-gcc (GCC) 13.2.0 >reproduce: (https://download.01.org/0day-ci/archive/20240523/202405230627.Lbju2ReQ-lkp@intel.com/reproduce) > >If you fix the issue in a separate patch/commit (i.e. not just a new version of >the same patch/commit), kindly add following tags >| Reported-by: kernel test robot <lkp@intel.com> >| Closes: https://lore.kernel.org/oe-kbuild-all/202405230627.Lbju2ReQ-lkp@intel.com/ > >All warnings (new ones prefixed by >>, old ones prefixed by <<): > >WARNING: modpost: missing MODULE_DESCRIPTION() in vmlinux.o >WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0xc (section: .text) -> memsize_kinit (section: .meminit.data) >WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0x10 (section: .text) -> memsize_kinit (section: .meminit.data) >WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_kernel_size+0x18 (section: .text) -> memsize_kinit (section: .meminit.data) >>> WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_reusable_size+0xc (section: .text) -> memsize_reusable_size (section: .meminit.data) >WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_reusable_size+0x10 (section: .text) -> memsize_reusable_size (section: .meminit.data) >WARNING: modpost: vmlinux: section mismatch in reference: memblock_memsize_mod_reusable_size+0x18 (section: .text) -> memsize_reusable_size (section: .meminit.data) Thank you for this. I will remove __initdata_memblock when I submit v2 >WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/rcu/rcuscale.o >WARNING: modpost: missing MODULE_DESCRIPTION() in kernel/time/time_test.o >WARNING: modpost: missing MODULE_DESCRIPTION() in mm/dmapool_test.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/fat/fat_test.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp437.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp775.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp865.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp866.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp869.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_cp936.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-5.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_iso8859-14.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_koi8-u.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_koi8-ru.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-cyrillic.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-gaelic.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-iceland.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-romanian.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-roman.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/mac-turkish.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/nls/nls_ucs2_utils.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/binfmt_script.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/ext4/ext4-inode-test.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/jbd2/jbd2.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/btrfs/btrfs.o >WARNING: modpost: missing MODULE_DESCRIPTION() in fs/bcachefs/mean_and_variance_test.o >WARNING: modpost: missing MODULE_DESCRIPTION() in security/keys/trusted-keys/trusted.o >WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit.o >WARNING: modpost: missing MODULE_DESCRIPTION() in lib/kunit/kunit-example-test.o >WARNING: modpost: missing MODULE_DESCRIPTION() in lib/math/prime_numbers.o >WARNING: modpost: missing MODULE_DESCRIPTION() in lib/asn1_encoder.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/irqchip/irq-meson-gpio.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/dwc/pci-exynos.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera-msi.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mediatek-gen3.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/backlight/platform_lcd.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/backlight/rt4831-backlight.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_accel.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_DAC1064.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/matrox/matroxfb_Ti3026.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/macmodes.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/via/viafb.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/video/fbdev/kyro/kyrofb.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/qcom/hdma_mgmt.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/ti/omap-dma.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dma/dmatest.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/soc/imx/soc-imx8m.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/soc/ixp4xx/ixp4xx-qmgr.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/max20411-regulator.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/rt4831-regulator.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/reset/hisilicon/hi6220_reset.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/tty/serial/8250/8250_pxa.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/tty/serial/8250/serial_cs.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/hw_random/omap-rng.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/lp.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/char/ppdev.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/iommu/iova.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-kunit.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-ram.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-raw-ram.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-spmi.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-w1.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/block/loop.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/arizona.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/pcf50633-gpio.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mfd/rt4831.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/dax/dax.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mtd/chips/cfi_cmdset_0020.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/rtc/lib_test.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/rtc/rtc-tps65910.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-ccgx-ucsi.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-ali1563.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/i2c/busses/i2c-pxa.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/i2c/uda1342.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/tuners/tda9887.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/dvb-frontends/au8522_decoder.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/dvb-frontends/mb86a16.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/rc/rc-core.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/common/videobuf2/videobuf2-dvb.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/saa7134/saa7134-empress.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/pci/saa7134/saa7134-dvb.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/v4l2-core/v4l2-async.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/v4l2-core/v4l2-fwnode.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/power/reset/piix4-poweroff.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/watchdog/omap_wdt.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/watchdog/menz69_wdt.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/mmc/core/mmc_core.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_simpleondemand.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_performance.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/devfreq/governor_userspace.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/perf/fsl_imx8_ddr_perf.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hwtracing/intel_th/intel_th_msu_sink.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvmem/nvmem-apple-efuses.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mm-interconnect.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mn-interconnect.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/interconnect/imx/imx8mp-interconnect.o >WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/parport/parport.o > >-- >0-DAY CI Kernel Test Service >https://protect2.fireeye.com/v1/url?k=c4bdaedc-a536bbf9-c4bc2593-74fe485cbff6-568d928b94c01c71&q=1&e=b37f3e53-b854-4dfb-9724-75f10a4c8c98&u=https%3A%2F%2Fgithub.com%2Fintel%2Flkp-tests%2Fwiki ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p6>]
* RE: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p6> @ 2024-05-21 2:53 ` Jaewon Kim 2024-05-21 7:31 ` Mike Rapoport ` (2 more replies) 0 siblings, 3 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 2:53 UTC (permalink / raw) To: Jaewon Kim, rppt, vbabka, akpm Cc: linux-mm, linux-kernel, jaewon31.kim, tkjos >--------- 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 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-21 2:53 ` [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory Jaewon Kim @ 2024-05-21 7:31 ` Mike Rapoport [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p5> 2024-05-22 8:20 ` Wei Yang 2 siblings, 0 replies; 38+ messages in thread From: Mike Rapoport @ 2024-05-21 7:31 UTC (permalink / raw) To: Jaewon Kim; +Cc: vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos 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. ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p5>]
* RE:(2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p5> @ 2024-05-21 10:17 ` Jaewon Kim 2024-05-22 8:16 ` (2) " Wei Yang ` (2 more replies) 0 siblings, 3 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-21 10:17 UTC (permalink / raw) To: Mike Rapoport, Jaewon Kim Cc: vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos >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. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-21 10:17 ` Jaewon Kim @ 2024-05-22 8:16 ` Wei Yang 2024-05-23 14:34 ` Mike Rapoport [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p8> 2 siblings, 0 replies; 38+ messages in thread From: Wei Yang @ 2024-05-22 8:16 UTC (permalink / raw) To: Jaewon Kim Cc: Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos 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 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-21 10:17 ` Jaewon Kim 2024-05-22 8:16 ` (2) " Wei Yang @ 2024-05-23 14:34 ` Mike Rapoport 2024-05-24 17:33 ` Pintu Agarwal [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p8> 2 siblings, 1 reply; 38+ messages in thread From: Mike Rapoport @ 2024-05-23 14:34 UTC (permalink / raw) To: Jaewon Kim; +Cc: vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos 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. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-23 14:34 ` Mike Rapoport @ 2024-05-24 17:33 ` Pintu Agarwal 0 siblings, 0 replies; 38+ messages in thread From: Pintu Agarwal @ 2024-05-24 17:33 UTC (permalink / raw) To: Mike Rapoport Cc: Jaewon Kim, vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos 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 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p8>]
* RE: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p8> @ 2024-05-22 8:47 ` Jaewon Kim 2024-05-23 8:55 ` Wei Yang [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p2> 2024-05-30 10:49 ` Jaewon Kim 2024-06-03 9:33 ` Jaewon Kim 2 siblings, 2 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-22 8:47 UTC (permalink / raw) To: richard.weiyang, Jaewon Kim Cc: Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos >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 > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-22 8:47 ` Jaewon Kim @ 2024-05-23 8:55 ` Wei Yang [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p2> 1 sibling, 0 replies; 38+ messages in thread From: Wei Yang @ 2024-05-23 8:55 UTC (permalink / raw) To: Jaewon Kim Cc: richard.weiyang, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos 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 ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p2>]
* RE: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p2> @ 2024-05-23 9:23 ` 김재원 2024-05-24 9:07 ` (2) " Jaewon Kim 2024-05-27 1:35 ` Jaewon Kim 2 siblings, 0 replies; 38+ messages in thread From: 김재원 @ 2024-05-23 9:23 UTC (permalink / raw) To: richard.weiyang, 김재원 Cc: Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos >[...] >> >>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 ^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p2> 2024-05-23 9:23 ` 김재원 @ 2024-05-24 9:07 ` Jaewon Kim 2024-05-26 13:55 ` Mike Rapoport [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p7> 2024-05-27 1:35 ` Jaewon Kim 2 siblings, 2 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-24 9:07 UTC (permalink / raw) >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. I think we need a common API to easily see the reserved memory status. Through MemTotal on /proc/meminfo, we can only see only the total size of reserved memory. We don't how big kernel init size within the the total size. I think this really helps to compare different kernel and communicate with others. I think the debugfs API or early boot log shows quite much information for the reserved memory information defined in device tree. But it is difficult to see after boot, as the boot log already was removed ouf of the kernel log buffer. And it does not show some information like kernel init size, late free pages. AFAIK if some memblocks are merged to a memblock data structure, the debugfs memblock API show it a one memblock rather than showing what each memblock request. BR Jaewon Kim > >-- >Sincerely yours, >Mike. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-24 9:07 ` (2) " Jaewon Kim @ 2024-05-26 13:55 ` Mike Rapoport [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p7> 1 sibling, 0 replies; 38+ messages in thread From: Mike Rapoport @ 2024-05-26 13:55 UTC (permalink / raw) To: Jaewon Kim Cc: vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos, Wei Yang, Pintu Agarwal Hi Jaewon, Please use reply-all! I just realized my previous reply went off-list :( On Fri, May 24, 2024 at 06:07:15PM +0900, Jaewon Kim 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. > >> >> > > >> >> >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. > > I think we need a common API to easily see the reserved memory status. > Through MemTotal on /proc/meminfo, we can only see only the total size > of reserved memory. We don't how big kernel init size within the the > total size. I think this really helps to compare different kernel and > communicate with others. As was already mentioned on this thread, something like $ dmesg | grep Memory: [ 0.000000] Memory: 8058204K/8388608K available (35392K kernel code, 8706K rwdata, 23320K rodata, 16832K init, 848K bss, 297636K reserved, 32768K cma-reserved) already shows init, rodata and bss sizes. And size -A vmlinux provides detailed breakdown of the kernel image into sections. > I think the debugfs API or early boot log shows quite much information > for the reserved memory information defined in device tree. But it is > difficult to see after boot, as the boot log already was removed ouf of > the kernel log buffer. Kernel log is persisted, isn't it? > And it does not show some information like kernel init size, late free > pages. AFAIK if some memblocks are merged to a memblock data structure, > the debugfs memblock API show it a one memblock rather than showing what > each memblock request. The reason to merge reserved regions is to save memory and CPU and in vast majority of cases it is not important from where memblock_reserve() was called. If it's really important to keep some of the reservations distinct, it can be achieved by e.g. using .flags field in the reserved regions. Your repost of the patches still does not address my comment from two years ago: You propose complex mechanism that seems to fit very particular scenario and sprinkle some calls to this mechanism at random places because you need to "compare reserved memory map with other map". As I said then, I don't mind providing more visibility into reserved memory attributes in general, but I'd like to see something way more simple and localized with a clear description what problem it solves and how it works in a general case. > BR > Jaewon Kim -- Sincerely yours, Mike. ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p7>]
* RE: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p7> @ 2024-05-27 1:30 ` Jaewon Kim [not found] ` <20240529095119epcms1p73f0e9ff756bcb2ee6a14db459128a644@epcms1p7> 1 sibling, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-27 1:30 UTC (permalink / raw) >Hi Jaewon, > >Please use reply-all! > >I just realized my previous reply went off-list :( Oh I'm very sorry I didn't know that. I just found that I had sent the mail to all as email secret recipient. > >On Fri, May 24, 2024 at 06:07:15PM +0900, Jaewon Kim 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. >> >> >> > >> >> >> >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. >> >> I think we need a common API to easily see the reserved memory status. >> Through MemTotal on /proc/meminfo, we can only see only the total size >> of reserved memory. We don't how big kernel init size within the the >> total size. I think this really helps to compare different kernel and >> communicate with others. > >As was already mentioned on this thread, something like > >$ dmesg | grep Memory: >[ 0.000000] Memory: 8058204K/8388608K available (35392K kernel code, 8706K rwdata, 23320K rodata, 16832K init, 848K bss, 297636K reserved, 32768K cma-reserved) > >already shows init, rodata and bss sizes. > >And size -A vmlinux provides detailed breakdown of the kernel image into >sections. > >> I think the debugfs API or early boot log shows quite much information >> for the reserved memory information defined in device tree. But it is >> difficult to see after boot, as the boot log already was removed ouf of >> the kernel log buffer. > >Kernel log is persisted, isn't it? Early kernel log is removed after other log is written to the log buffer. I may not be able to get it, after waiting for the target device is ready to be connected from host PC. I wanted to keep that information. Actually the commit aeb9267eb6b1 ("of: reserved-mem: print out reserved-mem details during boot") seems to show most of information if I can get the early boot log. If you don't mind, let me ask one question. How can we easily find the undefined DRAM memory regions in kernel persective. Do we have to look into the debugfs memblock/memory and combine the information with the kernel log information? case1) Actual DRAM is mapped as two regions like, 2GB @ 0x00000000_80000000 and 6GB @ 0x00000008_80000000, how can we find the hole, 0x00000000_80000000--0x00000008_7FFFFFFF ? case2) If some region is already carved out at bootloader stage like. 0x00000000_81200000-0x00000000_812FFFFF was not initinally on memblock. 0x00000000_80000000-0x00000000_81200000 was removed as no-map through device tree. how can we find the hole, 0x00000000_81200000-0x00000000_812FFFFF ? > >> And it does not show some information like kernel init size, late free >> pages. AFAIK if some memblocks are merged to a memblock data structure, >> the debugfs memblock API show it a one memblock rather than showing what >> each memblock request. > >The reason to merge reserved regions is to save memory and CPU and in vast >majority of cases it is not important from where memblock_reserve() was >called. If it's really important to keep some of the reservations distinct, >it can be achieved by e.g. using .flags field in the reserved regions. > >Your repost of the patches still does not address my comment from two >years ago: > > You propose complex mechanism that seems to fit very particular > scenario and sprinkle some calls to this mechanism at random places > because you need to "compare reserved memory map with other map". > >As I said then, I don't mind providing more visibility into reserved memory >attributes in general, but I'd like to see something way more simple and >localized with a clear description what problem it solves and how it works >in a general case. > >> BR >> Jaewon Kim > >-- >Sincerely yours, >Mike. ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <20240529095119epcms1p73f0e9ff756bcb2ee6a14db459128a644@epcms1p7>]
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <20240529095119epcms1p73f0e9ff756bcb2ee6a14db459128a644@epcms1p7> @ 2024-05-29 11:35 ` Wei Yang 2024-05-29 13:10 ` Jaewon Kim 0 siblings, 1 reply; 38+ messages in thread From: Wei Yang @ 2024-05-29 11:35 UTC (permalink / raw) To: Jaewon Kim Cc: Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos, Wei Yang, Pintu Agarwal On Wed, May 29, 2024 at 06:51:19PM +0900, Jaewon Kim wrote: ><!DOCTYPE html> ><html> ><head> ... Would you mind sending it in pure text again? -- Wei Yang Help you, Help me ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-29 11:35 ` Wei Yang @ 2024-05-29 13:10 ` Jaewon Kim 2024-05-30 0:03 ` Wei Yang 0 siblings, 1 reply; 38+ messages in thread From: Jaewon Kim @ 2024-05-29 13:10 UTC (permalink / raw) To: Wei Yang Cc: Jaewon Kim, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, tkjos, Pintu Agarwal (Sorry I might forget to change to be plain text) Oh good thing, I did not know this patch. Thanks. By the way, I've tried to get memblock/memory and kernel log from a device based on v6.6.17 kernel device, to see upstream patches above. memblok/memory does not show region for 0x00000000_80000000..0x0x00000000_8195ffff. 0: 0x0000000081960000..0x00000000819fffff 0 NONE The kernel log shows information for 0x0000000080000000..0x00000000813fffff, but we don't see information for 0x0000000081400000..0x000000008195ffff from kernel log. (I removed the name.) <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable AAA <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable BBB <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable CCC <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DD A smart parser should gather these kernel log and memblock/memory log and should show log like my memsize logic shows below. 0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap unusable unknown Thank you Jaewon On Wed, May 29, 2024 at 8:35 PM Wei Yang <richard.weiyang@gmail.com> wrote: > > On Wed, May 29, 2024 at 06:51:19PM +0900, Jaewon Kim wrote: > ><!DOCTYPE html> > ><html> > ><head> > ... > > Would you mind sending it in pure text again? > > -- > Wei Yang > Help you, Help me ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-29 13:10 ` Jaewon Kim @ 2024-05-30 0:03 ` Wei Yang 0 siblings, 0 replies; 38+ messages in thread From: Wei Yang @ 2024-05-30 0:03 UTC (permalink / raw) To: Jaewon Kim Cc: Wei Yang, Jaewon Kim, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, tkjos, Pintu Agarwal On Wed, May 29, 2024 at 10:10:29PM +0900, Jaewon Kim wrote: >(Sorry I might forget to change to be plain text) > >Oh good thing, I did not know this patch. Thanks. > >By the way, I've tried to get memblock/memory and kernel log from a >device based on >v6.6.17 kernel device, to see upstream patches above. >memblok/memory does not show region for memblock/memory only shows ranges put in "memory". memblock/reserved shows ranges put in "reserved". If we just put them in "reserved", it will not displayed in "memory". >0x00000000_80000000..0x0x00000000_8195ffff. > > 0: 0x0000000081960000..0x00000000819fffff 0 NONE > >The kernel log shows information for 0x0000000080000000..0x00000000813fffff, but >we don't see information for 0x0000000081400000..0x000000008195ffff >from kernel log. > >(I removed the name.) ><6>[ 0.000000][ T0] OF: reserved mem: >0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable >AAA ><6>[ 0.000000][ T0] OF: reserved mem: >0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable >BBB ><6>[ 0.000000][ T0] OF: reserved mem: >0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable >CCC ><6>[ 0.000000][ T0] OF: reserved mem: >0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DD > I guess those ranges are only put into "reserved"? Have those ranges put in "memory"? Would you mind point the code where those messages are printed? >A smart parser should gather these kernel log and memblock/memory log >and should show >log like my memsize logic shows below. >0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap >unusable unknown > >Thank you >Jaewon > >On Wed, May 29, 2024 at 8:35 PM Wei Yang <richard.weiyang@gmail.com> wrote: >> >> On Wed, May 29, 2024 at 06:51:19PM +0900, Jaewon Kim wrote: >> ><!DOCTYPE html> >> ><html> >> ><head> >> ... >> >> Would you mind sending it in pure text again? >> >> -- >> Wei Yang >> Help you, Help me -- Wei Yang Help you, Help me ^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p2> 2024-05-23 9:23 ` 김재원 2024-05-24 9:07 ` (2) " Jaewon Kim @ 2024-05-27 1:35 ` Jaewon Kim 2024-05-27 16:22 ` Mike Rapoport 2 siblings, 1 reply; 38+ messages in thread From: Jaewon Kim @ 2024-05-27 1:35 UTC (permalink / raw) To: Mike Rapoport, Jaewon Kim Cc: vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos, Wei Yang, Pintu Agarwal >Hi Jaewon, > >Please use reply-all! > >I just realized my previous reply went off-list :( Oh I'm very sorry I didn't know that. I just found that I had sent the mail to all as email secret recipient. > >On Fri, May 24, 2024 at 06:07:15PM +0900, Jaewon Kim 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. >> >> >> > >> >> >> >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. >> >> I think we need a common API to easily see the reserved memory status. >> Through MemTotal on /proc/meminfo, we can only see only the total size >> of reserved memory. We don't how big kernel init size within the the >> total size. I think this really helps to compare different kernel and >> communicate with others. > >As was already mentioned on this thread, something like > >$ dmesg | grep Memory: >[ 0.000000] Memory: 8058204K/8388608K available (35392K kernel code, 8706K rwdata, 23320K rodata, 16832K init, 848K bss, 297636K reserved, 32768K cma-reserved) > >already shows init, rodata and bss sizes. > >And size -A vmlinux provides detailed breakdown of the kernel image into >sections. > >> I think the debugfs API or early boot log shows quite much information >> for the reserved memory information defined in device tree. But it is >> difficult to see after boot, as the boot log already was removed ouf of >> the kernel log buffer. > >Kernel log is persisted, isn't it? Early kernel log is removed after other log is written to the log buffer. I may not be able to get it, after waiting for the target device is ready to be connected from host PC. I wanted to keep that information. Actually the commit aeb9267eb6b1 ("of: reserved-mem: print out reserved-mem details during boot") seems to show most of information if I can get the early boot log. If you don't mind, let me ask one question. How can we easily find the undefined DRAM memory regions in kernel persective. Do we have to look into the debugfs memblock/memory and combine the information with the kernel log information? case1) Actual DRAM is mapped as two regions like, 2GB @ 0x00000000_80000000 and 6GB @ 0x00000008_80000000, how can we find the hole, 0x00000000_80000000--0x00000008_7FFFFFFF ? case2) If some region is already carved out at bootloader stage like. 0x00000000_81200000-0x00000000_812FFFFF was not initinally on memblock. 0x00000000_80000000-0x00000000_81200000 was removed as no-map through device tree. how can we find the hole, 0x00000000_81200000-0x00000000_812FFFFF ? > >> And it does not show some information like kernel init size, late free >> pages. AFAIK if some memblocks are merged to a memblock data structure, >> the debugfs memblock API show it a one memblock rather than showing what >> each memblock request. > >The reason to merge reserved regions is to save memory and CPU and in vast >majority of cases it is not important from where memblock_reserve() was >called. If it's really important to keep some of the reservations distinct, >it can be achieved by e.g. using .flags field in the reserved regions. > >Your repost of the patches still does not address my comment from two >years ago: > > You propose complex mechanism that seems to fit very particular > scenario and sprinkle some calls to this mechanism at random places > because you need to "compare reserved memory map with other map". > >As I said then, I don't mind providing more visibility into reserved memory >attributes in general, but I'd like to see something way more simple and >localized with a clear description what problem it solves and how it works >in a general case. > >> BR >> Jaewon Kim > >-- >Sincerely yours, >Mike. ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-27 1:35 ` Jaewon Kim @ 2024-05-27 16:22 ` Mike Rapoport 0 siblings, 0 replies; 38+ messages in thread From: Mike Rapoport @ 2024-05-27 16:22 UTC (permalink / raw) To: Jaewon Kim Cc: vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos, Wei Yang, Pintu Agarwal On Mon, May 27, 2024 at 10:35:04AM +0900, Jaewon Kim wrote: > >On Fri, May 24, 2024 at 06:07:15PM +0900, Jaewon Kim 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: > >> >> >> > >> >> >> 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. > >> > >> I think we need a common API to easily see the reserved memory status. > >> Through MemTotal on /proc/meminfo, we can only see only the total size > >> of reserved memory. We don't how big kernel init size within the the > >> total size. I think this really helps to compare different kernel and > >> communicate with others. > > > > As was already mentioned on this thread, something like > > > > $ dmesg | grep Memory: > > [ 0.000000] Memory: 8058204K/8388608K available (35392K kernel code, 8706K rwdata, 23320K rodata, 16832K init, 848K bss, 297636K reserved, 32768K cma-reserved) > > > > already shows init, rodata and bss sizes. > > > > And size -A vmlinux provides detailed breakdown of the kernel image into > > sections. > > > >> I think the debugfs API or early boot log shows quite much information > >> for the reserved memory information defined in device tree. But it is > >> difficult to see after boot, as the boot log already was removed ouf of > >> the kernel log buffer. > > > > Kernel log is persisted, isn't it? > > Early kernel log is removed after other log is written to the log buffer. I may > not be able to get it, after waiting for the target device is ready to be > connected from host PC. I wanted to keep that information. > > Actually the commit aeb9267eb6b1 ("of: reserved-mem: print out reserved-mem > details during boot") seems to show most of information if I can get the early > boot log. Unless the kernel log is stored on the target you need to redirect target's console to a file on the host, then all of the boot log will be accessible on the host. Then with memblock=debug kernel parameter you'll be able to get much more information about memblock reservations. > If you don't mind, let me ask one question. How can we easily find the undefined > DRAM memory regions in kernel persective. Do we have to look into the debugfs > memblock/memory and combine the information with the kernel log information? > > case1) Actual DRAM is mapped as two regions like, > 2GB @ 0x00000000_80000000 and 6GB @ 0x00000008_80000000, > how can we find the hole, 0x00000000_80000000--0x00000008_7FFFFFFF ? The actual memory banks reported to Linux are shown at debugfs/memblock/memory > case2) If some region is already carved out at bootloader stage like. > 0x00000000_81200000-0x00000000_812FFFFF was not initinally on memblock. > 0x00000000_80000000-0x00000000_81200000 was removed as no-map through device tree. > how can we find the hole, 0x00000000_81200000-0x00000000_812FFFFF ? nomap regions are shown in debugfs/memblock/memory as NOMAP. -- Sincerely yours, Mike. ^ permalink raw reply [flat|nested] 38+ messages in thread
* RE:(2) (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p8> 2024-05-22 8:47 ` Jaewon Kim @ 2024-05-30 10:49 ` Jaewon Kim 2024-05-31 1:05 ` (2) " Wei Yang [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p4> 2024-06-03 9:33 ` Jaewon Kim 2 siblings, 2 replies; 38+ messages in thread From: Jaewon Kim @ 2024-05-30 10:49 UTC (permalink / raw) To: richard.weiyang, Jaewon Kim Cc: Jaewon Kim, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, tkjos, Pintu Agarwal >On Wed, May 29, 2024 at 10:10:29PM +0900, Jaewon Kim wrote: >>(Sorry I might forget to change to be plain text) >> >>Oh good thing, I did not know this patch. Thanks. >> >>By the way, I've tried to get memblock/memory and kernel log from a >>device based on >>v6.6.17 kernel device, to see upstream patches above. >>memblok/memory does not show region for > >memblock/memory only shows ranges put in "memory". >memblock/reserved shows ranges put in "reserved". > >If we just put them in "reserved", it will not displayed in "memory". > Hi Let me explain more. In this case, the intially passed memory starts from 0000000081960000 so memblock/memory shows as it is. # xxd -g 8 /proc/device-tree/memory/reg 00000000: 0000000081960000 00000000000a0000 ................ 00000010: 0000000081a40000 00000000001c0000 ................ # cat sys/kernel/debug/memblock/memory 0: 0x0000000081960000..0x00000000819fffff 0 NONE 1: 0x0000000081a40000..0x0000000081bfffff 0 NONE # cat sys/kernel/debug/memblock/reserved 0: 0x0000000082800000..0x00000000847fffff 0 NONE The memblock information in the kernel log may report like it allocated those memblock regions, as there was not overlapped even though it is already no-map. (I removed the name.) <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable AAA <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable BBB <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable CCC <6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DDD So a smart parser should combine the krenel log and the memblock/memory log. In my memsize feature shows it like this though. 0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap unusable unknown BR >>0x00000000_80000000..0x0x00000000_8195ffff. >> >> 0: 0x0000000081960000..0x00000000819fffff 0 NONE >> >>The kernel log shows information for 0x0000000080000000..0x00000000813fffff, but >>we don't see information for 0x0000000081400000..0x000000008195ffff >>from kernel log. >> >>(I removed the name.) >><6>[ 0.000000][ T0] OF: reserved mem: >>0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable >>AAA >><6>[ 0.000000][ T0] OF: reserved mem: >>0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable >>BBB >><6>[ 0.000000][ T0] OF: reserved mem: >>0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable >>CCC >><6>[ 0.000000][ T0] OF: reserved mem: >>0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DD >> > >I guess those ranges are only put into "reserved"? Have those ranges put in >"memory"? Would you mind point the code where those messages are printed? > >>A smart parser should gather these kernel log and memblock/memory log >>and should show >>log like my memsize logic shows below. >>0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap >>unusable unknown >> >>Thank you >>Jaewon >> >>On Wed, May 29, 2024 at 8:35?PM Wei Yang <richard.weiyang@gmail.com> wrote: >>> >>> On Wed, May 29, 2024 at 06:51:19PM +0900, Jaewon Kim wrote: >>> ><!DOCTYPE html> >>> ><html> >>> ><head> >>> ... >>> >>> Would you mind sending it in pure text again? >>> >>> -- >>> Wei Yang >>> Help you, Help me > >-- >Wei Yang >Help you, Help me ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-30 10:49 ` Jaewon Kim @ 2024-05-31 1:05 ` Wei Yang [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p4> 1 sibling, 0 replies; 38+ messages in thread From: Wei Yang @ 2024-05-31 1:05 UTC (permalink / raw) To: Jaewon Kim Cc: richard.weiyang, Jaewon Kim, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, tkjos, Pintu Agarwal On Thu, May 30, 2024 at 07:49:28PM +0900, Jaewon Kim wrote: >>On Wed, May 29, 2024 at 10:10:29PM +0900, Jaewon Kim wrote: >>>(Sorry I might forget to change to be plain text) >>> >>>Oh good thing, I did not know this patch. Thanks. >>> >>>By the way, I've tried to get memblock/memory and kernel log from a >>>device based on >>>v6.6.17 kernel device, to see upstream patches above. >>>memblok/memory does not show region for >> >>memblock/memory only shows ranges put in "memory". >>memblock/reserved shows ranges put in "reserved". >> >>If we just put them in "reserved", it will not displayed in "memory". > >Hi >Let me explain more. > >In this case, the intially passed memory starts from 0000000081960000 so memblock/memory shows as it is. > ># xxd -g 8 /proc/device-tree/memory/reg >00000000: 0000000081960000 00000000000a0000 ................ >00000010: 0000000081a40000 00000000001c0000 ................ > ># cat sys/kernel/debug/memblock/memory > 0: 0x0000000081960000..0x00000000819fffff 0 NONE > 1: 0x0000000081a40000..0x0000000081bfffff 0 NONE > ># cat sys/kernel/debug/memblock/reserved > 0: 0x0000000082800000..0x00000000847fffff 0 NONE > >The memblock information in the kernel log may report like it allocated those memblock regions, as there was not overlapped even though it is already no-map. > >(I removed the name.) ><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable AAA ><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable BBB ><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable CCC ><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DDD > This looks not printed by memblock_reserve(), right? It is printed by your own driver? >So a smart parser should combine the krenel log and the memblock/memory log. > >In my memsize feature shows it like this though. > >0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap unusable unknown > >BR > I am sorry, I still not catch your point. Let me try to understand your message. You mentioned several regions, let me put them in order. (1) 0x0000000080000000..0x0000000080dfffff printed by driver (2) 0x0000000080e00000..0x00000000811fffff printed by driver (3) 0x0000000081200000..0x00000000813fffff printed by driver (4) 0x0000000081400000..0x0000000081960000 expected to print in new debugfs (5) 0x0000000081960000..0x00000000819fffff listed in reg/memory (6) 0x0000000081a00000..0x0000000081a3ffff printed by driver (7) 0x0000000081a40000..0x0000000081bfffff listed in reg/memory (8) 0x0000000082800000..0x00000000847fffff listed in reserved If you just want information for region (4), sound we can do it in user-space? BTW, are region 1, 2, 3, 6, reserved in membock? -- Wei Yang Help you, Help me ^ permalink raw reply [flat|nested] 38+ messages in thread
[parent not found: <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p4>]
* RE: (2) (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p4> @ 2024-05-31 8:21 ` Jaewon Kim 2024-06-01 1:40 ` Wei Yang 0 siblings, 1 reply; 38+ messages in thread From: Jaewon Kim @ 2024-05-31 8:21 UTC (permalink / raw) To: richard.weiyang, Jaewon Kim Cc: Jaewon Kim, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, tkjos, Pintu Agarwal >On Thu, May 30, 2024 at 07:49:28PM +0900, Jaewon Kim wrote: >>>On Wed, May 29, 2024 at 10:10:29PM +0900, Jaewon Kim wrote: >>>>(Sorry I might forget to change to be plain text) >>>> >>>>Oh good thing, I did not know this patch. Thanks. >>>> >>>>By the way, I've tried to get memblock/memory and kernel log from a >>>>device based on >>>>v6.6.17 kernel device, to see upstream patches above. >>>>memblok/memory does not show region for >>> >>>memblock/memory only shows ranges put in "memory". >>>memblock/reserved shows ranges put in "reserved". >>> >>>If we just put them in "reserved", it will not displayed in "memory". >> >>Hi >>Let me explain more. >> >>In this case, the intially passed memory starts from 0000000081960000 so memblock/memory shows as it is. >> >># xxd -g 8 /proc/device-tree/memory/reg >>00000000: 0000000081960000 00000000000a0000 ................ >>00000010: 0000000081a40000 00000000001c0000 ................ >> >># cat sys/kernel/debug/memblock/memory >> 0: 0x0000000081960000..0x00000000819fffff 0 NONE >> 1: 0x0000000081a40000..0x0000000081bfffff 0 NONE >> >># cat sys/kernel/debug/memblock/reserved >> 0: 0x0000000082800000..0x00000000847fffff 0 NONE >> >>The memblock information in the kernel log may report like it allocated those memblock regions, as there was not overlapped even though it is already no-map. >> >>(I removed the name.) >><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable AAA >><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable BBB >><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable CCC >><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DDD >> > >This looks not printed by memblock_reserve(), right? It is printed by your own >driver? AFAIK these log came from the commit below. aeb9267eb6b1 of: reserved-mem: print out reserved-mem details during boot > >>So a smart parser should combine the krenel log and the memblock/memory log. >> >>In my memsize feature shows it like this though. >> >>0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap unusable unknown >> >>BR >> > >I am sorry, I still not catch your point. Let me try to understand your message. > >You mentioned several regions, let me put them in order. > >(1) 0x0000000080000000..0x0000000080dfffff printed by driver >(2) 0x0000000080e00000..0x00000000811fffff printed by driver >(3) 0x0000000081200000..0x00000000813fffff printed by driver >(4) 0x0000000081400000..0x0000000081960000 expected to print in new debugfs >(5) 0x0000000081960000..0x00000000819fffff listed in reg/memory >(6) 0x0000000081a00000..0x0000000081a3ffff printed by driver >(7) 0x0000000081a40000..0x0000000081bfffff listed in reg/memory >(8) 0x0000000082800000..0x00000000847fffff listed in reserved > >If you just want information for region (4), sound we can do it in user-space? > >BTW, are region 1, 2, 3, 6, reserved in membock? Yes correct, I though (4) case could be shown to easily catch these hidden regions. As I said, I think 1, 2, 3, 6 seem to be not passed to kernel, it was just tried as they are defined in kernel device tree. > >-- >Wei Yang >Help you, Help me ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: (2) (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-31 8:21 ` Jaewon Kim @ 2024-06-01 1:40 ` Wei Yang 0 siblings, 0 replies; 38+ messages in thread From: Wei Yang @ 2024-06-01 1:40 UTC (permalink / raw) To: Jaewon Kim Cc: richard.weiyang, Jaewon Kim, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, tkjos, Pintu Agarwal On Fri, May 31, 2024 at 05:21:41PM +0900, Jaewon Kim wrote: >>On Thu, May 30, 2024 at 07:49:28PM +0900, Jaewon Kim wrote: >>>>On Wed, May 29, 2024 at 10:10:29PM +0900, Jaewon Kim wrote: >>>>>(Sorry I might forget to change to be plain text) >>>>> >>>>>Oh good thing, I did not know this patch. Thanks. >>>>> >>>>>By the way, I've tried to get memblock/memory and kernel log from a >>>>>device based on >>>>>v6.6.17 kernel device, to see upstream patches above. >>>>>memblok/memory does not show region for >>>> >>>>memblock/memory only shows ranges put in "memory". >>>>memblock/reserved shows ranges put in "reserved". >>>> >>>>If we just put them in "reserved", it will not displayed in "memory". >>> >>>Hi >>>Let me explain more. >>> >>>In this case, the intially passed memory starts from 0000000081960000 so memblock/memory shows as it is. >>> >>># xxd -g 8 /proc/device-tree/memory/reg >>>00000000: 0000000081960000 00000000000a0000 ................ >>>00000010: 0000000081a40000 00000000001c0000 ................ >>> >>># cat sys/kernel/debug/memblock/memory >>> 0: 0x0000000081960000..0x00000000819fffff 0 NONE >>> 1: 0x0000000081a40000..0x0000000081bfffff 0 NONE >>> >>># cat sys/kernel/debug/memblock/reserved >>> 0: 0x0000000082800000..0x00000000847fffff 0 NONE >>> >>>The memblock information in the kernel log may report like it allocated those memblock regions, as there was not overlapped even though it is already no-map. >>> >>>(I removed the name.) >>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable AAA >>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable BBB >>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable CCC >>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DDD >>> >> >>This looks not printed by memblock_reserve(), right? It is printed by your own >>driver? > >AFAIK these log came from the commit below. >aeb9267eb6b1 of: reserved-mem: print out reserved-mem details during boot > >> >>>So a smart parser should combine the krenel log and the memblock/memory log. >>> >>>In my memsize feature shows it like this though. >>> >>>0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap unusable unknown >>> >>>BR >>> >> >>I am sorry, I still not catch your point. Let me try to understand your message. >> >>You mentioned several regions, let me put them in order. >> >>(1) 0x0000000080000000..0x0000000080dfffff printed by driver >>(2) 0x0000000080e00000..0x00000000811fffff printed by driver >>(3) 0x0000000081200000..0x00000000813fffff printed by driver >>(4) 0x0000000081400000..0x0000000081960000 expected to print in new debugfs >>(5) 0x0000000081960000..0x00000000819fffff listed in reg/memory >>(6) 0x0000000081a00000..0x0000000081a3ffff printed by driver >>(7) 0x0000000081a40000..0x0000000081bfffff listed in reg/memory >>(8) 0x0000000082800000..0x00000000847fffff listed in reserved >> >>If you just want information for region (4), sound we can do it in user-space? >> >>BTW, are region 1, 2, 3, 6, reserved in membock? > >Yes correct, I though (4) case could be shown to easily catch these hidden regions. >As I said, I think 1, 2, 3, 6 seem to be not passed to kernel, it was just tried as >they are defined in kernel device tree. > As you mentioned above, 1, 2, 3, 6, is printed by "of" driver. And those information is not shown in memblock/reserve. I am afraid the proper way is to let memblock know those ranges. Sounds "of" driver doesn't tell memblock about these. > >> >>-- >>Wei Yang >>Help you, Help me -- Wei Yang Help you, Help me ^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: (2) (2) [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p8> 2024-05-22 8:47 ` Jaewon Kim 2024-05-30 10:49 ` Jaewon Kim @ 2024-06-03 9:33 ` Jaewon Kim 2 siblings, 0 replies; 38+ messages in thread From: Jaewon Kim @ 2024-06-03 9:33 UTC (permalink / raw) To: richard.weiyang, Jaewon Kim Cc: Jaewon Kim, Mike Rapoport, vbabka, akpm, linux-mm, linux-kernel, tkjos, Pintu Agarwal >On Fri, May 31, 2024 at 05:21:41PM +0900, Jaewon Kim wrote: >>>On Thu, May 30, 2024 at 07:49:28PM +0900, Jaewon Kim wrote: >>>>>On Wed, May 29, 2024 at 10:10:29PM +0900, Jaewon Kim wrote: >>>>>>(Sorry I might forget to change to be plain text) >>>>>> >>>>>>Oh good thing, I did not know this patch. Thanks. >>>>>> >>>>>>By the way, I've tried to get memblock/memory and kernel log from a >>>>>>device based on >>>>>>v6.6.17 kernel device, to see upstream patches above. >>>>>>memblok/memory does not show region for >>>>> >>>>>memblock/memory only shows ranges put in "memory". >>>>>memblock/reserved shows ranges put in "reserved". >>>>> >>>>>If we just put them in "reserved", it will not displayed in "memory". >>>> >>>>Hi >>>>Let me explain more. >>>> >>>>In this case, the intially passed memory starts from 0000000081960000 so memblock/memory shows as it is. >>>> >>>># xxd -g 8 /proc/device-tree/memory/reg >>>>00000000: 0000000081960000 00000000000a0000 ................ >>>>00000010: 0000000081a40000 00000000001c0000 ................ >>>> >>>># cat sys/kernel/debug/memblock/memory >>>> 0: 0x0000000081960000..0x00000000819fffff 0 NONE >>>> 1: 0x0000000081a40000..0x0000000081bfffff 0 NONE >>>> >>>># cat sys/kernel/debug/memblock/reserved >>>> 0: 0x0000000082800000..0x00000000847fffff 0 NONE >>>> >>>>The memblock information in the kernel log may report like it allocated those memblock regions, as there was not overlapped even though it is already no-map. >>>> >>>>(I removed the name.) >>>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080000000..0x0000000080dfffff (14336 KiB) nomap non-reusable AAA >>>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000080e00000..0x00000000811fffff (4096 KiB) nomap non-reusable BBB >>>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081200000..0x00000000813fffff (2048 KiB) nomap non-reusable CCC >>>><6>[ 0.000000][ T0] OF: reserved mem: 0x0000000081a00000..0x0000000081a3ffff (256 KiB) nomap non-reusable DDD >>>> >>> >>>This looks not printed by memblock_reserve(), right? It is printed by your own >>>driver? >> >>AFAIK these log came from the commit below. >>aeb9267eb6b1 of: reserved-mem: print out reserved-mem details during boot >> >>> >>>>So a smart parser should combine the krenel log and the memblock/memory log. >>>> >>>>In my memsize feature shows it like this though. >>>> >>>>0x0000000081400000-0x0000000081960000 0x00560000 ( 5504 KB ) nomap unusable unknown >>>> >>>>BR >>>> >>> >>>I am sorry, I still not catch your point. Let me try to understand your message. >>> >>>You mentioned several regions, let me put them in order. >>> >>>(1) 0x0000000080000000..0x0000000080dfffff printed by driver >>>(2) 0x0000000080e00000..0x00000000811fffff printed by driver >>>(3) 0x0000000081200000..0x00000000813fffff printed by driver >>>(4) 0x0000000081400000..0x0000000081960000 expected to print in new debugfs >>>(5) 0x0000000081960000..0x00000000819fffff listed in reg/memory >>>(6) 0x0000000081a00000..0x0000000081a3ffff printed by driver >>>(7) 0x0000000081a40000..0x0000000081bfffff listed in reg/memory >>>(8) 0x0000000082800000..0x00000000847fffff listed in reserved >>> >>>If you just want information for region (4), sound we can do it in user-space? >>> >>>BTW, are region 1, 2, 3, 6, reserved in membock? >> >>Yes correct, I though (4) case could be shown to easily catch these hidden regions. >>As I said, I think 1, 2, 3, 6 seem to be not passed to kernel, it was just tried as >>they are defined in kernel device tree. >> > >As you mentioned above, 1, 2, 3, 6, is printed by "of" driver. And those >information is not shown in memblock/reserve. > >I am afraid the proper way is to let memblock know those ranges. Sounds "of" >driver doesn't tell memblock about these. > Yes that is the reason why I added some code to 'of' driver, too. As I said, if we don't change 'of' driver and memblck, we need a smart parser looking into kernel log and memblock info, and understand these special cases. BR >> >>> >>>-- >>>Wei Yang >>>Help you, Help me > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory 2024-05-21 2:53 ` [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory Jaewon Kim 2024-05-21 7:31 ` Mike Rapoport [not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p5> @ 2024-05-22 8:20 ` Wei Yang 2 siblings, 0 replies; 38+ messages in thread From: Wei Yang @ 2024-05-22 8:20 UTC (permalink / raw) To: Jaewon Kim Cc: rppt, vbabka, akpm, linux-mm, linux-kernel, jaewon31.kim, tkjos 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 ^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2024-06-03 9:33 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcas1p1.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory Jaewon Kim
[not found] ` <CGME20240521024009epcas1p4451928c8f5b32bf84082a24c59ca7dd0@epcas1p4.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 01/10] " Jaewon Kim
[not found] ` <CGME20240521024009epcas1p3e80e90863a453053d5aac901ef644070@epcas1p3.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 02/10] memblock: detect hidden memory hole size Jaewon Kim
[not found] ` <CGME20240521024009epcas1p152671a613e86fa83d840962ee3db50fb@epcas1p1.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 03/10] memblock: handle overlapped reserved memory region Jaewon Kim
[not found] ` <CGME20240521024009epcas1p3440f857e3b31b319c270e2d658379383@epcas1p3.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 04/10] memblock: take a region intersecting an unknown region Jaewon Kim
[not found] ` <CGME20240521024009epcas1p20ddcabed3d037904a9c651d27f82c077@epcas1p2.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 05/10] memblock: track memblock changed at early param Jaewon Kim
[not found] ` <CGME20240521024009epcas1p40d0ea59e8ae93f6cc89846626fea4207@epcas1p4.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 06/10] memblock: recognize late freed size by checking PageReserved Jaewon Kim
[not found] ` <CGME20240521024009epcas1p3ccda7b2d9e6518b4575427c957e19377@epcas1p3.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 07/10] memblock: track kernel size on memsize Jaewon Kim
2024-05-22 19:03 ` kernel test robot
[not found] ` <CGME20240521024009epcas1p291bbc11c4e5cdaa922ca302d95330e6b@epcas1p2.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 08/10] memblock: print memsize summary information Jaewon Kim
[not found] ` <CGME20240521024009epcas1p441a4c458d251eec7bb6e63e671c25b4e@epcas1p4.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 09/10] memblock: print kernel internal size Jaewon Kim
2024-05-22 18:52 ` kernel test robot
[not found] ` <CGME20240521024009epcas1p15a3290b675ee66339033c185a5a8c00b@epcas1p1.samsung.com>
2024-05-21 2:39 ` [RESEND PATCH 10/10] memblock: support memsize reusable to consider as reusable Jaewon Kim
2024-05-22 22:40 ` kernel test robot
[not found] ` <CGME20240522224129epcas1p10433785cc14bef5de93e9f26aa599ff0@epcms1p8>
2024-05-23 10:55 ` Jaewon Kim
[not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p6>
2024-05-21 2:53 ` [RESEND PATCH 00/10] memblock: introduce memsize showing reserved memory Jaewon Kim
2024-05-21 7:31 ` Mike Rapoport
[not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p5>
2024-05-21 10:17 ` Jaewon Kim
2024-05-22 8:16 ` (2) " Wei Yang
2024-05-23 14:34 ` Mike Rapoport
2024-05-24 17:33 ` Pintu Agarwal
[not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p8>
2024-05-22 8:47 ` Jaewon Kim
2024-05-23 8:55 ` Wei Yang
[not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p2>
2024-05-23 9:23 ` 김재원
2024-05-24 9:07 ` (2) " Jaewon Kim
2024-05-26 13:55 ` Mike Rapoport
[not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p7>
2024-05-27 1:30 ` Jaewon Kim
[not found] ` <20240529095119epcms1p73f0e9ff756bcb2ee6a14db459128a644@epcms1p7>
2024-05-29 11:35 ` Wei Yang
2024-05-29 13:10 ` Jaewon Kim
2024-05-30 0:03 ` Wei Yang
2024-05-27 1:35 ` Jaewon Kim
2024-05-27 16:22 ` Mike Rapoport
2024-05-30 10:49 ` Jaewon Kim
2024-05-31 1:05 ` (2) " Wei Yang
[not found] ` <CGME20240521024009epcas1p10ed9f9b929203183a29f79508e79bb76@epcms1p4>
2024-05-31 8:21 ` Jaewon Kim
2024-06-01 1:40 ` Wei Yang
2024-06-03 9:33 ` Jaewon Kim
2024-05-22 8:20 ` Wei Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox