From: David Gow <davidgow@google.com>
To: Alessandro Carminati <acarmina@redhat.com>
Cc: linux-kselftest@vger.kernel.org,
"David Airlie" <airlied@gmail.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Maíra Canal" <mcanal@igalia.com>,
"Dan Carpenter" <dan.carpenter@linaro.org>,
"Kees Cook" <keescook@chromium.org>,
"Daniel Diaz" <daniel.diaz@linaro.org>,
"Arthur Grillo" <arthurgrillo@riseup.net>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"Naresh Kamboju" <naresh.kamboju@linaro.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Maxime Ripard" <mripard@kernel.org>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Guenter Roeck" <linux@roeck-us.net>,
"Alessandro Carminati" <alessandro.carminati@gmail.com>,
"Jani Nikula" <jani.nikula@intel.com>,
dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com,
linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,
linux-sh@vger.kernel.org, loongarch@lists.linux.dev,
x86@kernel.org,
"Linux Kernel Functional Testing" <lkft@linaro.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>
Subject: Re: [PATCH v4 06/14] x86: Add support for suppressing warning backtraces
Date: Sat, 29 Mar 2025 16:04:01 +0800 [thread overview]
Message-ID: <CABVgOSmofN-jw9AWpOTAvhE-d-oLW_MBnPx8QQ1GVLZb-sMEhg@mail.gmail.com> (raw)
In-Reply-To: <20250313114329.284104-7-acarmina@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3859 bytes --]
On Thu, 13 Mar 2025 at 19:44, Alessandro Carminati <acarmina@redhat.com> wrote:
>
> From: Guenter Roeck <linux@roeck-us.net>
>
> Add name of functions triggering warning backtraces to the __bug_table
> object section to enable support for suppressing WARNING backtraces.
>
> To limit image size impact, the pointer to the function name is only added
> to the __bug_table section if both CONFIG_KUNIT_SUPPRESS_BACKTRACE and
> CONFIG_DEBUG_BUGVERBOSE are enabled. Otherwise, the __func__ assembly
> parameter is replaced with a (dummy) NULL parameter to avoid an image size
> increase due to unused __func__ entries (this is necessary because __func__
> is not a define but a virtual variable).
>
> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Acked-by: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
> ---
Reviewed-by: David Gow <davidgow@google.com>
Cheers,
-- David
> arch/x86/include/asm/bug.h | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
> index e85ac0c7c039..f6e13fc675ab 100644
> --- a/arch/x86/include/asm/bug.h
> +++ b/arch/x86/include/asm/bug.h
> @@ -35,18 +35,28 @@
>
> #ifdef CONFIG_DEBUG_BUGVERBOSE
>
> +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE
> +# define HAVE_BUG_FUNCTION
> +# define __BUG_FUNC_PTR __BUG_REL(%c1)
> +# define __BUG_FUNC __func__
> +#else
> +# define __BUG_FUNC_PTR
> +# define __BUG_FUNC NULL
> +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */
> +
> #define _BUG_FLAGS(ins, flags, extra) \
> do { \
> asm_inline volatile("1:\t" ins "\n" \
> ".pushsection __bug_table,\"aw\"\n" \
> "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
> "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \
> - "\t.word %c1" "\t# bug_entry::line\n" \
> - "\t.word %c2" "\t# bug_entry::flags\n" \
> - "\t.org 2b+%c3\n" \
> + "\t" __BUG_FUNC_PTR "\t# bug_entry::function\n" \
> + "\t.word %c2" "\t# bug_entry::line\n" \
> + "\t.word %c3" "\t# bug_entry::flags\n" \
> + "\t.org 2b+%c4\n" \
> ".popsection\n" \
> extra \
> - : : "i" (__FILE__), "i" (__LINE__), \
> + : : "i" (__FILE__), "i" (__BUG_FUNC), "i" (__LINE__),\
> "i" (flags), \
> "i" (sizeof(struct bug_entry))); \
> } while (0)
> @@ -92,7 +102,8 @@ do { \
> do { \
> __auto_type __flags = BUGFLAG_WARNING|(flags); \
> instrumentation_begin(); \
> - _BUG_FLAGS(ASM_UD2, __flags, ANNOTATE_REACHABLE(1b)); \
> + if (!KUNIT_IS_SUPPRESSED_WARNING(__func__)) \
> + _BUG_FLAGS(ASM_UD2, __flags, ANNOTATE_REACHABLE(1b)); \
> instrumentation_end(); \
> } while (0)
>
> --
> 2.34.1
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5281 bytes --]
next prev parent reply other threads:[~2025-03-29 8:04 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 11:43 [PATCH v4 00/14] Add support for suppressing warning backtraces Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 01/14] bug/kunit: Core " Alessandro Carminati
2025-03-29 8:03 ` David Gow
2025-03-13 11:43 ` [PATCH v4 02/14] kunit: bug: Count suppressed " Alessandro Carminati
2025-03-29 8:03 ` David Gow
2025-03-13 11:43 ` [PATCH v4 03/14] kunit: Add test cases for backtrace warning suppression Alessandro Carminati
2025-03-29 8:03 ` David Gow
2025-03-13 11:43 ` [PATCH v4 04/14] kunit: Add documentation for warning backtrace suppression API Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 05/14] drm: Suppress intentional warning backtraces in scaling unit tests Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 06/14] x86: Add support for suppressing warning backtraces Alessandro Carminati
2025-03-29 8:04 ` David Gow [this message]
2025-04-01 17:08 ` Peter Zijlstra
2025-04-01 17:53 ` Guenter Roeck
2025-04-01 20:00 ` Josh Poimboeuf
2025-04-02 7:42 ` Peter Zijlstra
2025-04-02 7:45 ` Peter Zijlstra
2025-03-13 11:43 ` [PATCH v4 07/14] arm64: " Alessandro Carminati
2025-03-13 12:25 ` Will Deacon
2025-03-13 16:40 ` Alessandro Carminati
2025-03-18 15:59 ` Will Deacon
2025-03-18 16:39 ` Guenter Roeck
2025-03-19 8:05 ` Christophe Leroy
2025-03-19 10:20 ` Dan Carpenter
2025-03-19 13:11 ` Guenter Roeck
2025-03-13 11:43 ` [PATCH v4 08/14] loongarch: " Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 09/14] parisc: " Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 10/14] s390: " Alessandro Carminati
2025-03-21 17:05 ` Guenter Roeck
2025-03-21 17:33 ` Arnd Bergmann
2025-03-21 21:05 ` Alessandro Carminati
2025-03-24 10:47 ` Heiko Carstens
2025-03-13 11:43 ` [PATCH v4 11/14] sh: " Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 12/14] sh: Move defines needed " Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 13/14] riscv: Add support " Alessandro Carminati
2025-03-13 11:43 ` [PATCH v4 14/14] powerpc: " Alessandro Carminati
2025-03-13 17:17 ` [PATCH v4 00/14] " Kees Cook
2025-03-13 17:24 ` Maxime Ripard
2025-03-13 18:31 ` Guenter Roeck
2025-03-13 22:05 ` Andrew Morton
2025-03-28 22:14 ` Shuah Khan
2025-03-28 22:53 ` Andrew Morton
2025-03-28 10:38 ` Mickaël Salaün
2025-03-28 14:20 ` Maxime Ripard
2025-03-29 8:03 ` David Gow
2025-04-26 2:32 ` Andrew Morton
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=CABVgOSmofN-jw9AWpOTAvhE-d-oLW_MBnPx8QQ1GVLZb-sMEhg@mail.gmail.com \
--to=davidgow@google.com \
--cc=acarmina@redhat.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alessandro.carminati@gmail.com \
--cc=arnd@arndb.de \
--cc=arthurgrillo@riseup.net \
--cc=bp@alien8.de \
--cc=brendan.higgins@linux.dev \
--cc=dan.carpenter@linaro.org \
--cc=daniel.diaz@linaro.org \
--cc=daniel@ffwll.ch \
--cc=dave.hansen@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=keescook@chromium.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkft@linaro.org \
--cc=loongarch@lists.linux.dev \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mcanal@igalia.com \
--cc=mingo@redhat.com \
--cc=mripard@kernel.org \
--cc=naresh.kamboju@linaro.org \
--cc=tglx@linutronix.de \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.intel.com \
--cc=x86@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;
as well as URLs for NNTP newsgroup(s).