From: David Gow <david@davidgow.net>
To: Albert Esteve <aesteve@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
Brendan Higgins <brendan.higgins@linux.dev>,
Rae Moar <raemoar63@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
dri-devel@lists.freedesktop.org, workflows@vger.kernel.org,
linux-doc@vger.kernel.org, peterz@infradead.org,
Alessandro Carminati <acarmina@redhat.com>
Subject: Re: [PATCH v7 2/5] bug/kunit: Reduce runtime impact of warning backtrace suppression
Date: Wed, 22 Apr 2026 20:19:58 +0800 [thread overview]
Message-ID: <a1ddabac-8e50-4730-b936-4ddef949487e@davidgow.net> (raw)
In-Reply-To: <20260420-kunit_add_support-v7-2-e8bc6e0f70de@redhat.com>
Le 20/04/2026 à 8:28 PM, Albert Esteve a écrit :
> From: Alessandro Carminati <acarmina@redhat.com>
>
> KUnit support is not consistently present across distributions, some
> include it in their stock kernels, while others do not.
> While both KUNIT and KUNIT_SUPPRESS_BACKTRACE can be considered debug
> features, the fact that some distros ship with KUnit enabled means it's
> important to minimize the runtime impact of this patch.
>
> To that end, this patch adds an atomic counter that tracks the number
> of active suppressions. __kunit_is_suppressed_warning() checks this
> counter first and returns immediately when no suppressions are active,
> avoiding RCU-protected list traversal in the common case.
>
> Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
> Signed-off-by: Albert Esteve <aesteve@redhat.com>
> ---
I'm not sure how much of an improvement this is.
It might be worth putting things behind the kunit_running static branch.
You could even add a new kunit_has_suppressed_warnings static branch,
though I doubt anyone's too worried about the runtime performance of
WARN() during testing, but with no suppressions, so it's likely not
worth it.
Have a look at, e.g., kunit_fail_current_test() in
include/kunit/test-bug.h, which uses the existing hooks implementation
and static branch to reduce the overhead as much as I'd expect we need.
That'd also potentially let you move the backtrace suppression code into
the kunit.ko module, so you're not even paying more than ~a pointer's
worth of memory if no tests are even loaded.
Cheers,
-- David
next prev parent reply other threads:[~2026-04-22 12:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 12:28 [PATCH v7 0/5] kunit: Add support for suppressing warning backtraces Albert Esteve
2026-04-20 12:28 ` [PATCH v7 1/5] bug/kunit: Core " Albert Esteve
2026-04-20 14:39 ` Peter Zijlstra
2026-04-21 8:22 ` Albert Esteve
2026-04-20 14:45 ` Peter Zijlstra
2026-04-21 8:29 ` Albert Esteve
2026-04-22 12:19 ` David Gow
2026-04-20 12:28 ` [PATCH v7 2/5] bug/kunit: Reduce runtime impact of warning backtrace suppression Albert Esteve
2026-04-20 14:44 ` Peter Zijlstra
2026-04-21 8:41 ` Albert Esteve
2026-04-22 12:19 ` David Gow [this message]
2026-04-20 12:28 ` [PATCH v7 3/5] kunit: Add backtrace suppression self-tests Albert Esteve
2026-04-22 12:20 ` David Gow
2026-04-20 12:28 ` [PATCH v7 4/5] drm: Suppress intentional warning backtraces in scaling unit tests Albert Esteve
2026-04-20 14:47 ` Peter Zijlstra
2026-04-21 8:49 ` Albert Esteve
2026-04-21 11:50 ` Jani Nikula
2026-04-22 12:20 ` David Gow
2026-04-20 12:28 ` [PATCH v7 5/5] kunit: Add documentation for warning backtrace suppression API Albert Esteve
2026-04-22 12:20 ` David Gow
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=a1ddabac-8e50-4730-b936-4ddef949487e@davidgow.net \
--to=david@davidgow.net \
--cc=acarmina@redhat.com \
--cc=aesteve@redhat.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=brendan.higgins@linux.dev \
--cc=corbet@lwn.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=peterz@infradead.org \
--cc=raemoar63@gmail.com \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--cc=tzimmermann@suse.de \
--cc=workflows@vger.kernel.org \
/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