module_alloc() first tries to allocate module text within
24 bits direct jump from kernel text, and tries a wider
allocation if first one fails.
When first allocation fails the following is observed in kernel logs:
vmap allocation for size 2400256 failed: use vmalloc=<size> to increase size
systemd-udevd: vmalloc error: size 2395133, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null)
CPU: 0 PID: 127 Comm: systemd-udevd Tainted: G W 5.15.5-gentoo-PowerMacG4 #9
Call Trace:
[e2a53a50] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable)
[e2a53a70] [c0540128] warn_alloc+0x11c/0x2b4
[e2a53b50] [c0531be8] __vmalloc_node_range+0xd8/0x64c
[e2a53c10] [c00338c0] module_alloc+0xa0/0xac
[e2a53c40] [c027a368] load_module+0x2ae0/0x8148
[e2a53e30] [c027fc78] sys_finit_module+0xfc/0x130
[e2a53f30] [c0035098] ret_from_syscall+0x0/0x28
@@ -90,16 +90,17 @@ int module_finalize(const Elf_Ehdr *hdr,}static__always_inlinevoid*-__module_alloc(unsignedlongsize,unsignedlongstart,unsignedlongend)+__module_alloc(unsignedlongsize,unsignedlongstart,unsignedlongend,boolnowarn){pgprot_tprot=strict_module_rwx_enabled()?PAGE_KERNEL:PAGE_KERNEL_EXEC;+gfp_tgfp=GFP_KERNEL|(nowarn?__GFP_NOWARN:0);/**Don'tdohugepageallocationsformodulesyetuntilmoretesting*isdone.STRICT_MODULE_RWXmayrequireextraworktosupportthis*too.*/-return__vmalloc_node_range(size,1,start,end,GFP_KERNEL,prot,+return__vmalloc_node_range(size,1,start,end,gfp,prot,VM_FLUSH_RESET_PERMS|VM_NO_HUGE_VMAP,NUMA_NO_NODE,__builtin_return_address(0));}
@@ -114,13 +115,13 @@ void *module_alloc(unsigned long size)/* First try within 32M limit from _etext to avoid branch trampolines */if(MODULES_VADDR<PAGE_OFFSET&&MODULES_END>limit)-ptr=__module_alloc(size,limit,MODULES_END);+ptr=__module_alloc(size,limit,MODULES_END,true);if(!ptr)-ptr=__module_alloc(size,MODULES_VADDR,MODULES_END);+ptr=__module_alloc(size,MODULES_VADDR,MODULES_END,false);returnptr;#else-return__module_alloc(size,VMALLOC_START,VMALLOC_END);+return__module_alloc(size,VMALLOC_START,VMALLOC_END,false);#endif}
From: Erhard F. <hidden> Date: 2021-11-30 14:07:07
On Tue, 30 Nov 2021 11:10:43 +0100
Christophe Leroy [off-list ref] wrote:
quoted hunk
module_alloc() first tries to allocate module text within
24 bits direct jump from kernel text, and tries a wider
allocation if first one fails.
When first allocation fails the following is observed in kernel logs:
vmap allocation for size 2400256 failed: use vmalloc=<size> to increase size
systemd-udevd: vmalloc error: size 2395133, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null)
CPU: 0 PID: 127 Comm: systemd-udevd Tainted: G W 5.15.5-gentoo-PowerMacG4 #9
Call Trace:
[e2a53a50] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable)
[e2a53a70] [c0540128] warn_alloc+0x11c/0x2b4
[e2a53b50] [c0531be8] __vmalloc_node_range+0xd8/0x64c
[e2a53c10] [c00338c0] module_alloc+0xa0/0xac
[e2a53c40] [c027a368] load_module+0x2ae0/0x8148
[e2a53e30] [c027fc78] sys_finit_module+0xfc/0x130
[e2a53f30] [c0035098] ret_from_syscall+0x0/0x28
@@ -90,16 +90,17 @@ int module_finalize(const Elf_Ehdr *hdr,}static__always_inlinevoid*-__module_alloc(unsignedlongsize,unsignedlongstart,unsignedlongend)+__module_alloc(unsignedlongsize,unsignedlongstart,unsignedlongend,boolnowarn){pgprot_tprot=strict_module_rwx_enabled()?PAGE_KERNEL:PAGE_KERNEL_EXEC;+gfp_tgfp=GFP_KERNEL|(nowarn?__GFP_NOWARN:0);/**Don'tdohugepageallocationsformodulesyetuntilmoretesting*isdone.STRICT_MODULE_RWXmayrequireextraworktosupportthis*too.*/-return__vmalloc_node_range(size,1,start,end,GFP_KERNEL,prot,+return__vmalloc_node_range(size,1,start,end,gfp,prot,VM_FLUSH_RESET_PERMS|VM_NO_HUGE_VMAP,NUMA_NO_NODE,__builtin_return_address(0));}
@@ -114,13 +115,13 @@ void *module_alloc(unsigned long size)/* First try within 32M limit from _etext to avoid branch trampolines */if(MODULES_VADDR<PAGE_OFFSET&&MODULES_END>limit)-ptr=__module_alloc(size,limit,MODULES_END);+ptr=__module_alloc(size,limit,MODULES_END,true);if(!ptr)-ptr=__module_alloc(size,MODULES_VADDR,MODULES_END);+ptr=__module_alloc(size,MODULES_VADDR,MODULES_END,false);returnptr;#else-return__module_alloc(size,VMALLOC_START,VMALLOC_END);+return__module_alloc(size,VMALLOC_START,VMALLOC_END,false);#endif}
--
2.33.1
The patch applies on 5.15.5 but I still get this vmalloc error. Looks a bit different though:
[..]
Running code patching self-tests ...
vmap allocation for size 33562624 failed: use vmalloc=<size> to increase size
swapper/0: vmalloc error: size 33558528, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null)
CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 5.15.5-PowerMacG4+ #2
Call Trace:
[f1033ba0] [c0b9fff0] dump_stack_lvl+0x80/0xb0 (unreliable)
[f1033bc0] [c05400d0] warn_alloc+0x11c/0x2b4
[f1033ca0] [c0531b90] __vmalloc_node_range+0xd8/0x64c
[f1033d60] [c05319a8] __vmalloc_node+0xec/0xf4
[f1033da0] [c1c0f998] test_code_patching+0x72c/0xd50
[f1033de0] [c0008994] do_one_initcall+0x2a0/0x5ac
[f1033eb0] [c1c040b0] kernel_init_freeable+0x590/0x5a4
[f1033f10] [c000946c] kernel_init+0x28/0x154
[f1033f30] [c0035148] ret_from_kernel_thread+0x14/0x1c
Mem-Info:
active_anon:0 inactive_anon:0 isolated_anon:0
active_file:0 inactive_file:0 isolated_file:0
unevictable:0 dirty:0 writeback:0
slab_reclaimable:1154 slab_unreclaimable:4207
mapped:0 shmem:0 pagetables:0 bounce:0
kernel_misc_reclaimable:0
free:474202 free_pcp:630 free_cma:0
Node 0 active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB writeback_tmp:0kB kernel_stack:848kB pagetables:0kB all_unreclaimable? no
DMA free:587836kB min:3140kB low:3924kB high:4708kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:786432kB managed:616760kB mlocked:0kB bounce:0kB free_pcp:1864kB local_pcp:1460kB free_cma:0kB
lowmem_reserve[]: 0 0 1280 1280
HighMem free:1308972kB min:512kB low:2180kB high:3848kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:1310720kB managed:1310720kB mlocked:0kB bounce:0kB free_pcp:656kB local_pcp:52kB free_cma:0kB
lowmem_reserve[]: 0 0 0 0
DMA: 5*4kB (UM) 1*8kB (M) 4*16kB (M) 3*32kB (UME) 4*64kB (ME) 3*128kB (ME) 5*256kB (UME) 6*512kB (UME) 3*1024kB (M) 3*2048kB (ME) 140*4096kB (M) = 587836kB
HighMem: 3*4kB (U) 2*8kB (U) 5*16kB (U) 0*32kB 1*64kB (U) 1*128kB (U) 0*256kB 0*512kB 0*1024kB 1*2048kB (U) 319*4096kB (M) = 1308972kB
0 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap = 0kB
Total swap = 0kB
524288 pages RAM
327680 pages HighMem/MovableOnly
42418 pages reserved
code-patching: test failed at line 598
[...]
Updated /sys/kernel/debug/kernel_page_tables with the patch applied and default LOWMEM_SIZE=0x30000000 in the original bug report: https://bugzilla.kernel.org/show_bug.cgi?id=205099
Regards,
Erhard
On Tue, 30 Nov 2021 11:10:43 +0100
Christophe Leroy [off-list ref] wrote:
quoted
module_alloc() first tries to allocate module text within
24 bits direct jump from kernel text, and tries a wider
allocation if first one fails.
When first allocation fails the following is observed in kernel logs:
vmap allocation for size 2400256 failed: use vmalloc=<size> to increase size
systemd-udevd: vmalloc error: size 2395133, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null)
CPU: 0 PID: 127 Comm: systemd-udevd Tainted: G W 5.15.5-gentoo-PowerMacG4 #9
Call Trace:
[e2a53a50] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable)
[e2a53a70] [c0540128] warn_alloc+0x11c/0x2b4
[e2a53b50] [c0531be8] __vmalloc_node_range+0xd8/0x64c
[e2a53c10] [c00338c0] module_alloc+0xa0/0xac
[e2a53c40] [c027a368] load_module+0x2ae0/0x8148
[e2a53e30] [c027fc78] sys_finit_module+0xfc/0x130
[e2a53f30] [c0035098] ret_from_syscall+0x0/0x28
@@ -90,16 +90,17 @@ int module_finalize(const Elf_Ehdr *hdr,}static__always_inlinevoid*-__module_alloc(unsignedlongsize,unsignedlongstart,unsignedlongend)+__module_alloc(unsignedlongsize,unsignedlongstart,unsignedlongend,boolnowarn){pgprot_tprot=strict_module_rwx_enabled()?PAGE_KERNEL:PAGE_KERNEL_EXEC;+gfp_tgfp=GFP_KERNEL|(nowarn?__GFP_NOWARN:0);/**Don'tdohugepageallocationsformodulesyetuntilmoretesting*isdone.STRICT_MODULE_RWXmayrequireextraworktosupportthis*too.*/-return__vmalloc_node_range(size,1,start,end,GFP_KERNEL,prot,+return__vmalloc_node_range(size,1,start,end,gfp,prot,VM_FLUSH_RESET_PERMS|VM_NO_HUGE_VMAP,NUMA_NO_NODE,__builtin_return_address(0));}
@@ -114,13 +115,13 @@ void *module_alloc(unsigned long size)/* First try within 32M limit from _etext to avoid branch trampolines */if(MODULES_VADDR<PAGE_OFFSET&&MODULES_END>limit)-ptr=__module_alloc(size,limit,MODULES_END);+ptr=__module_alloc(size,limit,MODULES_END,true);if(!ptr)-ptr=__module_alloc(size,MODULES_VADDR,MODULES_END);+ptr=__module_alloc(size,MODULES_VADDR,MODULES_END,false);returnptr;#else-return__module_alloc(size,VMALLOC_START,VMALLOC_END);+return__module_alloc(size,VMALLOC_START,VMALLOC_END,false);#endif}
--
2.33.1
The patch applies on 5.15.5 but I still get this vmalloc error. Looks a bit different though:
[..]
Running code patching self-tests ...
vmap allocation for size 33562624 failed: use vmalloc=<size> to increase size
swapper/0: vmalloc error: size 33558528, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null)
CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 5.15.5-PowerMacG4+ #2
Call Trace:
[f1033ba0] [c0b9fff0] dump_stack_lvl+0x80/0xb0 (unreliable)
[f1033bc0] [c05400d0] warn_alloc+0x11c/0x2b4
[f1033ca0] [c0531b90] __vmalloc_node_range+0xd8/0x64c
[f1033d60] [c05319a8] __vmalloc_node+0xec/0xf4
[f1033da0] [c1c0f998] test_code_patching+0x72c/0xd50
This one is something different.
The one I fixed with this patch is the one that was almost at the end of
your dmesg, it was related to the loading of some module.
The one that remains comes from test_code_patching() and is a real
failure that is due to LOWMEM being to high. This one should disappear
when you reduce LOWMEM.
Christophe
From: Michael Ellerman <hidden> Date: 2021-12-07 13:28:44
On Tue, 30 Nov 2021 11:10:43 +0100, Christophe Leroy wrote:
quoted hunk
module_alloc() first tries to allocate module text within
24 bits direct jump from kernel text, and tries a wider
allocation if first one fails.
When first allocation fails the following is observed in kernel logs:
vmap allocation for size 2400256 failed: use vmalloc=<size> to increase size
systemd-udevd: vmalloc error: size 2395133, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null)
CPU: 0 PID: 127 Comm: systemd-udevd Tainted: G W 5.15.5-gentoo-PowerMacG4 #9
Call Trace:
[e2a53a50] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable)
[e2a53a70] [c0540128] warn_alloc+0x11c/0x2b4
[e2a53b50] [c0531be8] __vmalloc_node_range+0xd8/0x64c
[e2a53c10] [c00338c0] module_alloc+0xa0/0xac
[e2a53c40] [c027a368] load_module+0x2ae0/0x8148
[e2a53e30] [c027fc78] sys_finit_module+0xfc/0x130
[e2a53f30] [c0035098] ret_from_syscall+0x0/0x28