lib/test_vmalloc.c: Use late_initcall() if built-in for init ordering
Subsystems (3)
Uladzislau Rezki (Sony)
maintainerPATCH 1/2 lib/test_vmalloc.c: Use late_initcall() if built-in for init ordering
When the vmalloc test code is compiled as a built-in, use late_initcall() instead of module_init() to defer a vmalloc test execution until most subsystems are up and running.
It avoids interfering with components that may not yet be initialized at module_init() time. For example, there was a recent report of memory profiling infrastructure not being ready early enough leading to kernel crash.
By using late_initcall() in the built-in case, we ensure the tests are run at a safer point during a boot sequence.
--- lib/test_vmalloc.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/test_vmalloc.c +4 -0
@@ -598,7 +598,11 @@ static int __init vmalloc_test_init(void)return IS_BUILTIN (CONFIG_TEST_VMALLOC ) ?0 :-EAGAIN ; } +#ifdef MODULE module_init (vmalloc_test_init) +#else +late_initcall (vmalloc_test_init); +#endif MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Uladzislau Rezki" );
Signature · 1 line
2.39.5
Uladzislau Rezki (Sony)
maintainerPATCH 2/2 lib/test_vmalloc.c: Restrict default test mask to avoid test warnings
When the vmalloc test is built into the kernel, it runs automatically during the boot. The current-default "run_test_mask" includes all test cases, including those which are designed to fail and which trigger kernel warnings.
These kernel splats can be misinterpreted as actual kernel bugs, leading to false alarms and unnecessary reports.
To address this, limit the default test mask to only the first few tests which are expected to pass cleanly. These tests are safe and should not generate any warnings unless there is a real bug.
Users who wish to explicitly run specific test cases have to pass the run_test_mask as a boot parameter or at module load time.
--- lib/test_vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_vmalloc.c +1 -1
@@ -41,7 +41,7 @@ __param(int, nr_pages, 0,__param (bool, use_huge, false,"Use vmalloc_huge in fix_size_alloc_test" ); -__param (int, run_test_mask,INT_MAX , +__param (int, run_test_mask,7 ,"Set tests specified in the mask.\n\n" "\t\tid: 1, name: fix_size_alloc_test\n" "\t\tid: 2, name: full_fit_alloc_test\n"
Signature · 1 line
2.39.5
Re: [PATCH 2/2] lib/test_vmalloc.c: Restrict default test mask to avoid test warnings
Quoted 15 lines · Uladzislau Rezki (Sony)
When the vmalloc test is built into the kernel, it runs automatically during the boot. The current-default "
run_test_mask" includes all test cases, including those which are designed to fail and which trigger kernel warnings.These kernel splats can be misinterpreted as actual kernel bugs, leading to false alarms and unnecessary reports.
To address this, limit the default test mask to only the first few tests which are expected to pass cleanly. These tests are safe and should not generate any warnings unless there is a real bug.
Users who wish to explicitly run specific test cases have to pass the
run_test_maskas a boot parameter or at module load time.
Quoted 7 lines
Cc Harry Yoo <[email protected]>Cc Suren Baghdasaryan <[email protected]>Cc David Wang <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- lib/test_vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
lib/test_vmalloc.c +1
-1@@ -41,7 +41,7 @@ __param(int, nr_pages, 0,__param (bool, use_huge, false,"Use vmalloc_huge in fix_size_alloc_test" ); -__param (int, run_test_mask,INT_MAX , +__param (int, run_test_mask,7 ,"Set tests specified in the mask.\n\n" "\t\tid: 1, name: fix_size_alloc_test\n" "\t\tid: 2, name: full_fit_alloc_test\n"Signature · 1 line
2.39.5
Quoted 12 lines · Uladzislau Rezki (Sony)
When the vmalloc test code is compiled as a built-in, use
late_initcall()instead ofmodule_init()to defer a vmalloc test execution until most subsystems are up and running.It avoids interfering with components that may not yet be initialized at
module_init()time. For example, there was a recent report of memory profiling infrastructure not being ready early enough leading to kernel crash.By using
late_initcall()in the built-in case, we ensure the tests are run at a safer point during a boot sequence.
Quoted 7 lines
Cc Harry Yoo <[email protected]>Cc Suren Baghdasaryan <[email protected]>Cc David Wang <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- lib/test_vmalloc.c | 4 ++++ 1 file changed, 4 insertions(+)
LGTM,
Quoted 21 lines
lib/test_vmalloc.c +4
-0@@ -598,7 +598,11 @@ static int __init vmalloc_test_init(void)return IS_BUILTIN (CONFIG_TEST_VMALLOC ) ?0 :-EAGAIN ; } +#ifdef MODULE module_init (vmalloc_test_init) +#else +late_initcall (vmalloc_test_init); +#endif MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Uladzislau Rezki" );Signature · 1 line
2.39.5
Quoted 25 lines · Uladzislau Rezki (Sony)
When the vmalloc test code is compiled as a built-in, use
late_initcall()instead ofmodule_init()to defer a vmalloc test execution until most subsystems are up and running.It avoids interfering with components that may not yet be initialized at
module_init()time. For example, there was a recent report of memory profiling infrastructure not being ready early enough leading to kernel crash.By using
late_initcall()in the built-in case, we ensure the tests are run at a safer point during a boot sequence.Cc Harry Yoo <[email protected]>Cc Suren Baghdasaryan <[email protected]>Cc David Wang <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>---
lib/test_vmalloc.c| 4 ++++1 file changed, 4 insertions(+)lib/test_vmalloc.c +0
-0
lib/test_vmalloc.c static int __init vmalloc_test_init(void) · line 606
Quoted 9 lines
lib/test_vmalloc.c +4
-0@@ -598,7 +598,11 @@ static int __init vmalloc_test_init(void)return IS_BUILTIN (CONFIG_TEST_VMALLOC ) ?0 :-EAGAIN ; } +#ifdef MODULE module_init (vmalloc_test_init) +#else +late_initcall (vmalloc_test_init); +#endif
When MODULE defined, late_initcall is defined as module_init in ./include/linux/module.h I think the MODULE check here is redundant, (it is clearer though)
Quoted 5 lines
lib/test_vmalloc.c +0
-0MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Uladzislau Rezki" );Signature · 1 line
2.39.5
Uladzislau Rezki
maintainerQuoted 35 lines · David Wang
Quoted 32 lines · Uladzislau Rezki (Sony)
When the vmalloc test code is compiled as a built-in, use
late_initcall()instead ofmodule_init()to defer a vmalloc test execution until most subsystems are up and running.It avoids interfering with components that may not yet be initialized at
module_init()time. For example, there was a recent report of memory profiling infrastructure not being ready early enough leading to kernel crash.By using
late_initcall()in the built-in case, we ensure the tests are run at a safer point during a boot sequence.Cc Harry Yoo <[email protected]>Cc Suren Baghdasaryan <[email protected]>Cc David Wang <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>---
lib/test_vmalloc.c| 4 ++++1 file changed, 4 insertions(+)lib/test_vmalloc.c +3
-0@@ -598,7 +598,11 @@ static int __init vmalloc_test_init(void)return IS_BUILTIN (CONFIG_TEST_VMALLOC ) ?0 :-EAGAIN ; } +#ifdef MODULE module_init (vmalloc_test_init) +#else +late_initcall (vmalloc_test_init);
Quoted 6 lines
lib/test_vmalloc.c static int __init vmalloc_test_init(void) · line 605
Quoted 1 line
lib/test_vmalloc.c +1
-0+#endif When MODULE defined,
late_initcallis defined asmodule_initin./include/linux/module.hI think the MODULE check here is redundant, (it is clearer though)
That was an idea to use MODULE, because late_initcall is designed not for module.s It would require the comment then.
--
Uladzislau Rezki