linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] vmalloc: Modify the alloc_vmap_area() error message for better diagnostics
@ 2024-06-03 21:30 Shubhang Kaushik OS
  2024-06-03 23:35 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Shubhang Kaushik OS @ 2024-06-03 21:30 UTC (permalink / raw)
  To: ampere-linux-kernel
  Cc: cl, Andrew Morton, Uladzislau Rezki, Christoph Hellwig,
	Lorenzo Stoakes, linux-mm

'vmap allocation for size %lu failed: use vmalloc=<size> to increase size'
The above warning is seen in the kernel functionality for allocation of
the restricted virtual memory range till exhaustion.

This message is misleading because 'vmalloc=' is not a valid kernel
parameter on a number of platforms, in particular it is not supported
on arm64. With the update, the output gets modified to include the function
parameters along with the start and end of the virtual memory range allowed

The warning message after fix on kernel version 6.10.0-rc1+:

vmalloc_node_range for size 33619968 failed: Address range restricted between 0xffff800082640000 - 0xffff800084650000

Backtrace with the misleading error message:

	vmap allocation for size 33619968 failed: use vmalloc=<size> to increase size
	insmod: vmalloc error: size 33554432, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null),cpuset=/,mems_allowed=0
	CPU: 46 PID: 1977 Comm: insmod Tainted: G            E      6.10.0-rc1+ #79
	Hardware name: INGRASYS Yushan Server iSystem TEMP-S000141176+10/Yushan Motherboard, BIOS 2.10.20230517 (SCP: xxx) yyyy/mm/dd
	Call trace:
		dump_backtrace+0xa0/0x128
		show_stack+0x20/0x38
		dump_stack_lvl+0x78/0x90
		dump_stack+0x18/0x28
		warn_alloc+0x12c/0x1b8
		__vmalloc_node_range_noprof+0x28c/0x7e0
		custom_init+0xb4/0xfff8 [test_driver]
		do_one_initcall+0x60/0x290
		do_init_module+0x68/0x250
		load_module+0x236c/0x2428
		init_module_from_file+0x8c/0xd8
		__arm64_sys_finit_module+0x1b4/0x388
		invoke_syscall+0x78/0x108
		el0_svc_common.constprop.0+0x48/0xf0
		do_el0_svc+0x24/0x38
		el0_svc+0x3c/0x130
		el0t_64_sync_handler+0x100/0x130
		el0t_64_sync+0x190/0x198

Reviewed-by: Christoph Lameter (Ampere) <cl@linux.com>
Signed-off-by: Shubhang Kaushik <shubhang@os.amperecomputing.com>
---
 mm/vmalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 5d3aa2dc88a8..75ad551e90ba 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2055,8 +2055,8 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
 	}
 
 	if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit())
-		pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n",
-			size);
+		pr_warn("vmalloc_node_range for size %lu failed: Address range restricted to %#lx - %#lx\n",
+				size, addr, addr+size);
 
 	kmem_cache_free(vmap_area_cachep, va);
 	return ERR_PTR(-EBUSY);
-- 
2.39.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] vmalloc: Modify the alloc_vmap_area() error message for better diagnostics
  2024-06-03 21:30 [PATCH v2] vmalloc: Modify the alloc_vmap_area() error message for better diagnostics Shubhang Kaushik OS
@ 2024-06-03 23:35 ` Matthew Wilcox
       [not found]   ` <3329c844-509b-8769-01b6-a191b60bee35@linux.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2024-06-03 23:35 UTC (permalink / raw)
  To: Shubhang Kaushik OS
  Cc: ampere-linux-kernel, cl, Andrew Morton, Uladzislau Rezki,
	Christoph Hellwig, Lorenzo Stoakes, linux-mm

On Mon, Jun 03, 2024 at 09:30:54PM +0000, Shubhang Kaushik OS wrote:
> 'vmap allocation for size %lu failed: use vmalloc=<size> to increase size'
> The above warning is seen in the kernel functionality for allocation of
> the restricted virtual memory range till exhaustion.
> 
> This message is misleading because 'vmalloc=' is not a valid kernel
> parameter on a number of platforms, in particular it is not supported
> on arm64. With the update, the output gets modified to include the function

Why not fix arm64?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] vmalloc: Modify the alloc_vmap_area() error message for better diagnostics
       [not found]   ` <3329c844-509b-8769-01b6-a191b60bee35@linux.com>
@ 2024-06-04  2:30     ` Anshuman Khandual
  0 siblings, 0 replies; 3+ messages in thread
From: Anshuman Khandual @ 2024-06-04  2:30 UTC (permalink / raw)
  To: Christoph Lameter (Ampere), Matthew Wilcox
  Cc: Shubhang Kaushik OS, ampere-linux-kernel, Andrew Morton,
	Uladzislau Rezki, Christoph Hellwig, Lorenzo Stoakes, linux-mm,
	linux-arm-kernel



On 6/4/24 05:46, Christoph Lameter (Ampere) wrote:
> On Tue, 4 Jun 2024, Matthew Wilcox wrote:
> 
>> On Mon, Jun 03, 2024 at 09:30:54PM +0000, Shubhang Kaushik OS wrote:
>>> 'vmap allocation for size %lu failed: use vmalloc=<size> to increase size'
>>> The above warning is seen in the kernel functionality for allocation of
>>> the restricted virtual memory range till exhaustion.
>>>
>>> This message is misleading because 'vmalloc=' is not a valid kernel
>>> parameter on a number of platforms, in particular it is not supported
>>> on arm64. With the update, the output gets modified to include the function
>>
>> Why not fix arm64?
> 
> Arm64 does not need vmalloc= tuning and the problem is not related to being out of vmalloc space in general.
> 
> This occurs if the virtual range during a vmalloc was restricted and is not available (f.e. if one wants a module to be loaded in optimal branch distance to the kernel text segment and we loaded too many modules). The error message needs to indicate the virtual memory restriction which helps the developer/user to debug the situation and not create a wild goose chase for a kernel parmaeter that does not exist.

Agreed, current warning message here is misleading pointing to a non-existent
kernel command line parameter on the given platform.

This kernel parameter i.e 'vmalloc=' seems to be supported only on the x86 and
arm (32) platforms. Should not Documentation/admin-guide/kernel-parameters.txt
be updated as well making this bit clear ?

> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-04  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-03 21:30 [PATCH v2] vmalloc: Modify the alloc_vmap_area() error message for better diagnostics Shubhang Kaushik OS
2024-06-03 23:35 ` Matthew Wilcox
     [not found]   ` <3329c844-509b-8769-01b6-a191b60bee35@linux.com>
2024-06-04  2:30     ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox