Skip to contentSkip to conversation

kunit/bug.c: fix backtrace-supression-test failure as a module

PATCH In review Nico Pache 2 participants 3 messages Jul 7 – Jul 8 Library code

lore
Share & tools
lore

Nico Pache

author
#0 lore raw

PATCH 1/1 kunit/bug.c: fix backtrace-supression-test failure as a module

When running the backtrace-supression-test as a module most cases produce failures.

Upon further investigating the issue presents itself due to the ifdef that wraps the kunit_is_supressed_warning, which is not compiled in if using CONFIG_KUNIT_MODULE.

Fix this by switching to IS_ENABLED(CONFIG_KUNIT) which properly checks for either CONFIG_KUNIT_MODULE or CONFIG_KUNIT.

Fixes bbc960d009a6 ("kunit: Add backtrace suppression self-tests")
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -1
index 292420f45811..b9820a0226f5 100644
@@ -219,7 +219,7 @@ static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long buga
 	no_cut   = bug->flags & BUGFLAG_NO_CUT_HERE;
 	has_args = bug->flags & BUGFLAG_ARGS;
 
-#ifdef CONFIG_KUNIT
+#if IS_ENABLED(CONFIG_KUNIT)
 	/*
 	 * Before the once logic so suppressed warnings do not consume
 	 * the single-fire budget of WARN_ON_ONCE().
Signature · 1 line
2.54.0
#1 lore raw
Quoted 8 lines · Nico Pache

When running the backtrace-supression-test as a module most cases produce failures.

Upon further investigating the issue presents itself due to the ifdef that wraps the kunit_is_supressed_warning, which is not compiled in if using CONFIG_KUNIT_MODULE.

Quoted 5 lines

Fix this by switching to IS_ENABLED(CONFIG_KUNIT) which properly checks for either CONFIG_KUNIT_MODULE or CONFIG_KUNIT.

Fixes bbc960d009a6 ("kunit: Add backtrace suppression self-tests")

Hi Nico,

Thanks for the patch! It looks like Bartosz submitted the exact same fix a bit earlier:
https://lore.kernel.org/all/[email protected]/

Let's move the review over to that thread. Also, the Fixed label should point to 85347718ab0d ("bug/kunit: Core support for suppressing warning backtraces") as in the thread above. Feel free to take a look and leave your Rb tag if it works for you.

BR,
Albert.

Quoted 20 lines
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -2
index 292420f45811..b9820a0226f5 100644
@@ -219,7 +219,7 @@ static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long buga
        no_cut   = bug->flags & BUGFLAG_NO_CUT_HERE;
        has_args = bug->flags & BUGFLAG_ARGS;
 
-#ifdef CONFIG_KUNIT
+#if IS_ENABLED(CONFIG_KUNIT)
        /*
         * Before the once logic so suppressed warnings do not consume
         * the single-fire budget of WARN_ON_ONCE().
--

2.54.0

author
#2 lore raw
Quoted 13 lines · Albert Esteve
Quoted 11 lines · Nico Pache

When running the backtrace-supression-test as a module most cases produce failures.

Upon further investigating the issue presents itself due to the ifdef that wraps the kunit_is_supressed_warning, which is not compiled in if using CONFIG_KUNIT_MODULE.

Fix this by switching to IS_ENABLED(CONFIG_KUNIT) which properly checks for either CONFIG_KUNIT_MODULE or CONFIG_KUNIT.

Quoted 8 lines
Quoted 2 lines
Fixes bbc960d009a6 ("kunit: Add backtrace suppression self-tests")

Hi Nico,

Thanks for the patch! It looks like Bartosz submitted the exact same fix a bit earlier:
https://lore.kernel.org/all/[email protected]/

Ah ok thank you for pointing that out!

Quoted 5 lines

Let's move the review over to that thread. Also, the Fixed label should point to 85347718ab0d ("bug/kunit: Core support for suppressing warning backtraces") as in the thread above. Feel free to take a look and leave your Rb tag if it works for you.

Sounds good ill put my ack/tested by on their patch :)

Cheers,
-- Nico

Quoted 25 lines

BR,
Albert.

Quoted 20 lines
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bug.c +1 -2
index 292420f45811..b9820a0226f5 100644
@@ -219,7 +219,7 @@ static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long buga
        no_cut   = bug->flags & BUGFLAG_NO_CUT_HERE;
        has_args = bug->flags & BUGFLAG_ARGS;
 
-#ifdef CONFIG_KUNIT
+#if IS_ENABLED(CONFIG_KUNIT)
        /*
         * Before the once logic so suppressed warnings do not consume
         * the single-fire budget of WARN_ON_ONCE().
--

2.54.0