mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kunit/bug.c: fix backtrace-supression-test failure as a module
@ 2026-07-07 18:54 Nico Pache
  2026-07-08  7:26 ` Albert Esteve
  0 siblings, 1 reply; 3+ messages in thread
From: Nico Pache @ 2026-07-07 18:54 UTC (permalink / raw)
  To: kunit-dev, acarmina, kees, aesteve, error27, linux-kernel
  Cc: skhan, david, linux, akpm, 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.

Fixes: bbc960d009a6 ("kunit: Add backtrace suppression self-tests")
Signed-off-by: Nico Pache <npache@redhat.com>
---
 lib/bug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bug.c b/lib/bug.c
index 292420f45811..b9820a0226f5 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -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


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

* Re: [PATCH] kunit/bug.c: fix backtrace-supression-test failure as a module
  2026-07-07 18:54 [PATCH] kunit/bug.c: fix backtrace-supression-test failure as a module Nico Pache
@ 2026-07-08  7:26 ` Albert Esteve
  2026-07-08 13:34   ` Nico Pache
  0 siblings, 1 reply; 3+ messages in thread
From: Albert Esteve @ 2026-07-08  7:26 UTC (permalink / raw)
  To: Nico Pache
  Cc: kunit-dev, acarmina, kees, error27, linux-kernel, skhan, david,
	linux, akpm

On Tue, Jul 7, 2026 at 8:52 PM Nico Pache <npache@redhat.com> wrote:
>
> 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")
> Signed-off-by: Nico Pache <npache@redhat.com>

Hi Nico,

Thanks for the patch! It looks like Bartosz submitted the exact same
fix a bit earlier:
https://lore.kernel.org/all/20260707125837.57256-1-bartosz.golaszewski@oss.qualcomm.com/

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.

> ---
>  lib/bug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/bug.c b/lib/bug.c
> index 292420f45811..b9820a0226f5 100644
> --- a/lib/bug.c
> +++ b/lib/bug.c
> @@ -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
>


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

* Re: [PATCH] kunit/bug.c: fix backtrace-supression-test failure as a module
  2026-07-08  7:26 ` Albert Esteve
@ 2026-07-08 13:34   ` Nico Pache
  0 siblings, 0 replies; 3+ messages in thread
From: Nico Pache @ 2026-07-08 13:34 UTC (permalink / raw)
  To: Albert Esteve
  Cc: kunit-dev, acarmina, kees, error27, linux-kernel, skhan, david,
	linux, akpm

On Wed, Jul 8, 2026 at 1:26 AM Albert Esteve <aesteve@redhat.com> wrote:
>
> On Tue, Jul 7, 2026 at 8:52 PM Nico Pache <npache@redhat.com> wrote:
> >
> > 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")
> > Signed-off-by: Nico Pache <npache@redhat.com>
>
> Hi Nico,
>
> Thanks for the patch! It looks like Bartosz submitted the exact same
> fix a bit earlier:
> https://lore.kernel.org/all/20260707125837.57256-1-bartosz.golaszewski@oss.qualcomm.com/

Ah ok thank you for pointing that out!

>
> 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

>
> BR,
> Albert.
>
> > ---
> >  lib/bug.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/bug.c b/lib/bug.c
> > index 292420f45811..b9820a0226f5 100644
> > --- a/lib/bug.c
> > +++ b/lib/bug.c
> > @@ -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
> >
>


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

end of thread, other threads:[~2026-07-08 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-07 18:54 [PATCH] kunit/bug.c: fix backtrace-supression-test failure as a module Nico Pache
2026-07-08  7:26 ` Albert Esteve
2026-07-08 13:34   ` Nico Pache

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