The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alessandro Carminati <acarmina@redhat.com>
Cc: linux-kselftest@vger.kernel.org,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Kees Cook <keescook@chromium.org>,
	Daniel Diaz <daniel.diaz@linaro.org>,
	David Gow <davidgow@google.com>,
	Arthur Grillo <arthurgrillo@riseup.net>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Maxime Ripard <mripard@kernel.org>,
	Ville Syrjala <ville.syrjala@linux.intel.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Guenter Roeck <linux@roeck-us.net>,
	Alessandro Carminati <alessandro.carminati@gmail.com>,
	Jani Nikula <jani.nikula@intel.com>,
	Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Linux Kernel Functional Testing <lkft@linaro.org>,
	dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/5] bug/kunit: Core support for suppressing warning backtraces
Date: Thu, 29 May 2025 11:01:29 +0200	[thread overview]
Message-ID: <20250529090129.GZ24938@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250526132755.166150-2-acarmina@redhat.com>

On Mon, May 26, 2025 at 01:27:51PM +0000, Alessandro Carminati wrote:

>  #define __WARN()		__WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
>  #define __WARN_printf(taint, arg...) do {				\
> -		instrumentation_begin();				\
> -		__warn_printk(arg);					\
> -		__WARN_FLAGS(BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\
> -		instrumentation_end();					\
> +		if (!KUNIT_IS_SUPPRESSED_WARNING(__func__)) {		\
> +			instrumentation_begin();			\
> +			__warn_printk(arg);				\
> +			__WARN_FLAGS(BUGFLAG_NO_CUT_HERE |		\
> +				BUGFLAG_TAINT(taint));			\
> +			instrumentation_end();				\
> +		}							\
>  	} while (0)
>  #define WARN_ON_ONCE(condition) ({				\
>  	int __ret_warn_on = !!(condition);			\
> -	if (unlikely(__ret_warn_on))				\
> +	if (unlikely(__ret_warn_on) && !KUNIT_IS_SUPPRESSED_WARNING(__func__))	\
>  		__WARN_FLAGS(BUGFLAG_ONCE |			\
>  			     BUGFLAG_TAINT(TAINT_WARN));	\
>  	unlikely(__ret_warn_on);				\
> @@ -121,7 +130,7 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
>  #ifndef WARN_ON
>  #define WARN_ON(condition) ({						\
>  	int __ret_warn_on = !!(condition);				\
> -	if (unlikely(__ret_warn_on))					\
> +	if (unlikely(__ret_warn_on) && !KUNIT_IS_SUPPRESSED_WARNING(__func__))	\
>  		__WARN();						\
>  	unlikely(__ret_warn_on);					\
>  })
> @@ -138,7 +147,7 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
>  
>  #define WARN_TAINT(condition, taint, format...) ({			\
>  	int __ret_warn_on = !!(condition);				\
> -	if (unlikely(__ret_warn_on))					\
> +	if (unlikely(__ret_warn_on) && !KUNIT_IS_SUPPRESSED_WARNING(__func__))	\
>  		__WARN_printf(taint, format);				\
>  	unlikely(__ret_warn_on);					\
>  })
> @@ -157,8 +166,10 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
>  #else /* !CONFIG_BUG */
>  #ifndef HAVE_ARCH_BUG
>  #define BUG() do {		\
> -	do {} while (1);	\
> -	unreachable();		\
> +	if (!KUNIT_IS_SUPPRESSED_WARNING(__func__)) {			\
> +		do {} while (1);					\
> +		unreachable();						\
> +	}								\
>  } while (0)
>  #endif

NAK

This is again doing it wrong -- this will bloat every frigging bug/warn
site for no reason. 

Like I said before; you need to do this on the report_bug() size of
things.

  parent reply	other threads:[~2025-05-29  9:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-26 13:27 [PATCH v5 0/5] kunit: Add support for suppressing warning backtraces Alessandro Carminati
2025-05-26 13:27 ` [PATCH v5 1/5] bug/kunit: Core " Alessandro Carminati
2025-05-28 22:47   ` Kees Cook
2025-05-29  9:02     ` Peter Zijlstra
2025-05-29 17:46       ` Kees Cook
2025-05-30  9:25         ` Peter Zijlstra
2025-05-29  9:01   ` Peter Zijlstra [this message]
2025-05-29 10:36     ` Alessandro Carminati
2025-05-30 14:01       ` Peter Zijlstra
2025-05-30 17:48         ` Kees Cook
2025-05-31 10:23           ` Peter Zijlstra
2025-05-31 13:51             ` Kees Cook
2025-06-02  7:57               ` Peter Zijlstra
2025-06-02 10:38                 ` Maxime Ripard
2025-06-03 11:40                   ` Simona Vetter
2025-06-02 11:13             ` Maxime Ripard
2025-06-03 12:26               ` Peter Zijlstra
2025-06-04  3:30                 ` Daniel Latypov
2025-06-06  8:05                 ` Maxime Ripard
2025-05-31 10:25           ` Peter Zijlstra
2025-05-31  7:46         ` Peter Zijlstra
2025-05-31  7:52         ` Alessandro Carminati
2025-05-30  9:26   ` Peter Zijlstra
2025-05-26 13:27 ` [PATCH v5 2/5] bug/kunit: Suppressing warning backtraces reduced impact on WARN*() sites Alessandro Carminati
2025-05-28 22:52   ` Kees Cook
2025-05-26 13:27 ` [PATCH v5 3/5] Add unit tests to verify that warning backtrace suppression works Alessandro Carminati
2025-05-26 13:27 ` [PATCH v5 4/5] drm: Suppress intentional warning backtraces in scaling unit tests Alessandro Carminati
2025-05-26 13:27 ` [PATCH v5 5/5] kunit: Add documentation for warning backtrace suppression API Alessandro Carminati
2025-06-02  7:24 ` [PATCH v5 0/5] kunit: Add support for suppressing warning backtraces Dan Carpenter
2025-06-02 10:47   ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250529090129.GZ24938@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acarmina@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alessandro.carminati@gmail.com \
    --cc=arthurgrillo@riseup.net \
    --cc=brendan.higgins@linux.dev \
    --cc=dan.carpenter@linaro.org \
    --cc=daniel.diaz@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=davidgow@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=jpoimboe@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lkft@linaro.org \
    --cc=mripard@kernel.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=skhan@linuxfoundation.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox