From: Charlie Jenkins <charlie@rivosinc.com>
To: Guenter Roeck <linux@roeck-us.net>
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>,
"David Gow" <davidgow@google.com>,
"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>,
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,
netdev@vger.kernel.org, x86@kernel.org,
"Linux Kernel Functional Testing" <lkft@linaro.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v3 14/15] riscv: Add support for suppressing warning backtraces
Date: Mon, 22 Apr 2024 13:40:53 -0400 [thread overview]
Message-ID: <ZiahJT8MTFqAlD5A@ghost> (raw)
In-Reply-To: <20240403131936.787234-15-linux@roeck-us.net>
On Wed, Apr 03, 2024 at 06:19:35AM -0700, Guenter Roeck wrote:
> 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).
>
> To simplify the implementation, unify the __BUG_ENTRY_ADDR and
> __BUG_ENTRY_FILE macros into a single macro named __BUG_REL() which takes
> the address, file, or function reference as parameter.
>
> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Acked-by: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2:
> - Rebased to v6.9-rc1
> - Added Tested-by:, Acked-by:, and Reviewed-by: tags
> - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option
> v3:
> - Rebased to v6.9-rc2
>
> arch/riscv/include/asm/bug.h | 38 ++++++++++++++++++++++++------------
> 1 file changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h
> index 1aaea81fb141..79f360af4ad8 100644
> --- a/arch/riscv/include/asm/bug.h
> +++ b/arch/riscv/include/asm/bug.h
> @@ -30,26 +30,39 @@
> typedef u32 bug_insn_t;
>
> #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
> -#define __BUG_ENTRY_ADDR RISCV_INT " 1b - ."
> -#define __BUG_ENTRY_FILE RISCV_INT " %0 - ."
> +#define __BUG_REL(val) RISCV_INT " " __stringify(val) " - ."
> #else
> -#define __BUG_ENTRY_ADDR RISCV_PTR " 1b"
> -#define __BUG_ENTRY_FILE RISCV_PTR " %0"
> +#define __BUG_REL(val) RISCV_PTR " " __stringify(val)
> #endif
>
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> +
> +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE
> +# define HAVE_BUG_FUNCTION
> +# define __BUG_FUNC_PTR __BUG_REL(%1)
> +#else
> +# define __BUG_FUNC_PTR
> +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */
> +
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - __BUG_ENTRY_FILE "\n\t" \
> - RISCV_SHORT " %1\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + __BUG_REL(%0) "\n\t" \
> + __BUG_FUNC_PTR "\n\t" \
> + RISCV_SHORT " %2\n\t" \
> + RISCV_SHORT " %3"
> #else
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + RISCV_SHORT " %3"
> #endif
>
> #ifdef CONFIG_GENERIC_BUG
> +#ifdef HAVE_BUG_FUNCTION
> +# define __BUG_FUNC __func__
> +#else
> +# define __BUG_FUNC NULL
> +#endif
> +
> #define __BUG_FLAGS(flags) \
> do { \
> __asm__ __volatile__ ( \
> @@ -58,10 +71,11 @@ do { \
> ".pushsection __bug_table,\"aw\"\n\t" \
> "2:\n\t" \
> __BUG_ENTRY "\n\t" \
> - ".org 2b + %3\n\t" \
> + ".org 2b + %4\n\t" \
> ".popsection" \
> : \
> - : "i" (__FILE__), "i" (__LINE__), \
> + : "i" (__FILE__), "i" (__BUG_FUNC), \
> + "i" (__LINE__), \
> "i" (flags), \
> "i" (sizeof(struct bug_entry))); \
> } while (0)
> --
> 2.39.2
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
- Charlie
WARNING: multiple messages have this Message-ID (diff)
From: Charlie Jenkins <charlie@rivosinc.com>
To: Guenter Roeck <linux@roeck-us.net>
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>,
"David Gow" <davidgow@google.com>,
"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>,
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,
netdev@vger.kernel.org, x86@kernel.org,
"Linux Kernel Functional Testing" <lkft@linaro.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v3 14/15] riscv: Add support for suppressing warning backtraces
Date: Mon, 22 Apr 2024 13:40:53 -0400 [thread overview]
Message-ID: <ZiahJT8MTFqAlD5A@ghost> (raw)
In-Reply-To: <20240403131936.787234-15-linux@roeck-us.net>
On Wed, Apr 03, 2024 at 06:19:35AM -0700, Guenter Roeck wrote:
> 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).
>
> To simplify the implementation, unify the __BUG_ENTRY_ADDR and
> __BUG_ENTRY_FILE macros into a single macro named __BUG_REL() which takes
> the address, file, or function reference as parameter.
>
> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Acked-by: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2:
> - Rebased to v6.9-rc1
> - Added Tested-by:, Acked-by:, and Reviewed-by: tags
> - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option
> v3:
> - Rebased to v6.9-rc2
>
> arch/riscv/include/asm/bug.h | 38 ++++++++++++++++++++++++------------
> 1 file changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h
> index 1aaea81fb141..79f360af4ad8 100644
> --- a/arch/riscv/include/asm/bug.h
> +++ b/arch/riscv/include/asm/bug.h
> @@ -30,26 +30,39 @@
> typedef u32 bug_insn_t;
>
> #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
> -#define __BUG_ENTRY_ADDR RISCV_INT " 1b - ."
> -#define __BUG_ENTRY_FILE RISCV_INT " %0 - ."
> +#define __BUG_REL(val) RISCV_INT " " __stringify(val) " - ."
> #else
> -#define __BUG_ENTRY_ADDR RISCV_PTR " 1b"
> -#define __BUG_ENTRY_FILE RISCV_PTR " %0"
> +#define __BUG_REL(val) RISCV_PTR " " __stringify(val)
> #endif
>
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> +
> +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE
> +# define HAVE_BUG_FUNCTION
> +# define __BUG_FUNC_PTR __BUG_REL(%1)
> +#else
> +# define __BUG_FUNC_PTR
> +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */
> +
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - __BUG_ENTRY_FILE "\n\t" \
> - RISCV_SHORT " %1\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + __BUG_REL(%0) "\n\t" \
> + __BUG_FUNC_PTR "\n\t" \
> + RISCV_SHORT " %2\n\t" \
> + RISCV_SHORT " %3"
> #else
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + RISCV_SHORT " %3"
> #endif
>
> #ifdef CONFIG_GENERIC_BUG
> +#ifdef HAVE_BUG_FUNCTION
> +# define __BUG_FUNC __func__
> +#else
> +# define __BUG_FUNC NULL
> +#endif
> +
> #define __BUG_FLAGS(flags) \
> do { \
> __asm__ __volatile__ ( \
> @@ -58,10 +71,11 @@ do { \
> ".pushsection __bug_table,\"aw\"\n\t" \
> "2:\n\t" \
> __BUG_ENTRY "\n\t" \
> - ".org 2b + %3\n\t" \
> + ".org 2b + %4\n\t" \
> ".popsection" \
> : \
> - : "i" (__FILE__), "i" (__LINE__), \
> + : "i" (__FILE__), "i" (__BUG_FUNC), \
> + "i" (__LINE__), \
> "i" (flags), \
> "i" (sizeof(struct bug_entry))); \
> } while (0)
> --
> 2.39.2
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
- Charlie
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Charlie Jenkins <charlie@rivosinc.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: x86@kernel.org, loongarch@lists.linux.dev,
linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org,
"Brendan Higgins" <brendan.higgins@linux.dev>,
linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org,
"David Airlie" <airlied@gmail.com>,
"Arthur Grillo" <arthurgrillo@riseup.net>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
"Daniel Diaz" <daniel.diaz@linaro.org>,
linux-sh@vger.kernel.org,
"Naresh Kamboju" <naresh.kamboju@linaro.org>,
"Maíra Canal" <mcanal@igalia.com>,
"Dan Carpenter" <dan.carpenter@linaro.org>,
"Linux Kernel Functional Testing" <lkft@linaro.org>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Kees Cook" <keescook@chromium.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"David Gow" <davidgow@google.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
linux-arm-kernel@lists.infra
Subject: Re: [PATCH v3 14/15] riscv: Add support for suppressing warning backtraces
Date: Mon, 22 Apr 2024 13:40:53 -0400 [thread overview]
Message-ID: <ZiahJT8MTFqAlD5A@ghost> (raw)
In-Reply-To: <20240403131936.787234-15-linux@roeck-us.net>
On Wed, Apr 03, 2024 at 06:19:35AM -0700, Guenter Roeck wrote:
> 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).
>
> To simplify the implementation, unify the __BUG_ENTRY_ADDR and
> __BUG_ENTRY_FILE macros into a single macro named __BUG_REL() which takes
> the address, file, or function reference as parameter.
>
> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Acked-by: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2:
> - Rebased to v6.9-rc1
> - Added Tested-by:, Acked-by:, and Reviewed-by: tags
> - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option
> v3:
> - Rebased to v6.9-rc2
>
> arch/riscv/include/asm/bug.h | 38 ++++++++++++++++++++++++------------
> 1 file changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h
> index 1aaea81fb141..79f360af4ad8 100644
> --- a/arch/riscv/include/asm/bug.h
> +++ b/arch/riscv/include/asm/bug.h
> @@ -30,26 +30,39 @@
> typedef u32 bug_insn_t;
>
> #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
> -#define __BUG_ENTRY_ADDR RISCV_INT " 1b - ."
> -#define __BUG_ENTRY_FILE RISCV_INT " %0 - ."
> +#define __BUG_REL(val) RISCV_INT " " __stringify(val) " - ."
> #else
> -#define __BUG_ENTRY_ADDR RISCV_PTR " 1b"
> -#define __BUG_ENTRY_FILE RISCV_PTR " %0"
> +#define __BUG_REL(val) RISCV_PTR " " __stringify(val)
> #endif
>
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> +
> +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE
> +# define HAVE_BUG_FUNCTION
> +# define __BUG_FUNC_PTR __BUG_REL(%1)
> +#else
> +# define __BUG_FUNC_PTR
> +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */
> +
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - __BUG_ENTRY_FILE "\n\t" \
> - RISCV_SHORT " %1\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + __BUG_REL(%0) "\n\t" \
> + __BUG_FUNC_PTR "\n\t" \
> + RISCV_SHORT " %2\n\t" \
> + RISCV_SHORT " %3"
> #else
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + RISCV_SHORT " %3"
> #endif
>
> #ifdef CONFIG_GENERIC_BUG
> +#ifdef HAVE_BUG_FUNCTION
> +# define __BUG_FUNC __func__
> +#else
> +# define __BUG_FUNC NULL
> +#endif
> +
> #define __BUG_FLAGS(flags) \
> do { \
> __asm__ __volatile__ ( \
> @@ -58,10 +71,11 @@ do { \
> ".pushsection __bug_table,\"aw\"\n\t" \
> "2:\n\t" \
> __BUG_ENTRY "\n\t" \
> - ".org 2b + %3\n\t" \
> + ".org 2b + %4\n\t" \
> ".popsection" \
> : \
> - : "i" (__FILE__), "i" (__LINE__), \
> + : "i" (__FILE__), "i" (__BUG_FUNC), \
> + "i" (__LINE__), \
> "i" (flags), \
> "i" (sizeof(struct bug_entry))); \
> } while (0)
> --
> 2.39.2
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
- Charlie
WARNING: multiple messages have this Message-ID (diff)
From: Charlie Jenkins <charlie@rivosinc.com>
To: Guenter Roeck <linux@roeck-us.net>
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>,
"David Gow" <davidgow@google.com>,
"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>,
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,
netdev@vger.kernel.org, x86@kernel.org,
"Linux Kernel Functional Testing" <lkft@linaro.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v3 14/15] riscv: Add support for suppressing warning backtraces
Date: Mon, 22 Apr 2024 13:40:53 -0400 [thread overview]
Message-ID: <ZiahJT8MTFqAlD5A@ghost> (raw)
In-Reply-To: <20240403131936.787234-15-linux@roeck-us.net>
On Wed, Apr 03, 2024 at 06:19:35AM -0700, Guenter Roeck wrote:
> 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).
>
> To simplify the implementation, unify the __BUG_ENTRY_ADDR and
> __BUG_ENTRY_FILE macros into a single macro named __BUG_REL() which takes
> the address, file, or function reference as parameter.
>
> Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Acked-by: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2:
> - Rebased to v6.9-rc1
> - Added Tested-by:, Acked-by:, and Reviewed-by: tags
> - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option
> v3:
> - Rebased to v6.9-rc2
>
> arch/riscv/include/asm/bug.h | 38 ++++++++++++++++++++++++------------
> 1 file changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/bug.h b/arch/riscv/include/asm/bug.h
> index 1aaea81fb141..79f360af4ad8 100644
> --- a/arch/riscv/include/asm/bug.h
> +++ b/arch/riscv/include/asm/bug.h
> @@ -30,26 +30,39 @@
> typedef u32 bug_insn_t;
>
> #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
> -#define __BUG_ENTRY_ADDR RISCV_INT " 1b - ."
> -#define __BUG_ENTRY_FILE RISCV_INT " %0 - ."
> +#define __BUG_REL(val) RISCV_INT " " __stringify(val) " - ."
> #else
> -#define __BUG_ENTRY_ADDR RISCV_PTR " 1b"
> -#define __BUG_ENTRY_FILE RISCV_PTR " %0"
> +#define __BUG_REL(val) RISCV_PTR " " __stringify(val)
> #endif
>
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> +
> +#ifdef CONFIG_KUNIT_SUPPRESS_BACKTRACE
> +# define HAVE_BUG_FUNCTION
> +# define __BUG_FUNC_PTR __BUG_REL(%1)
> +#else
> +# define __BUG_FUNC_PTR
> +#endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */
> +
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - __BUG_ENTRY_FILE "\n\t" \
> - RISCV_SHORT " %1\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + __BUG_REL(%0) "\n\t" \
> + __BUG_FUNC_PTR "\n\t" \
> + RISCV_SHORT " %2\n\t" \
> + RISCV_SHORT " %3"
> #else
> #define __BUG_ENTRY \
> - __BUG_ENTRY_ADDR "\n\t" \
> - RISCV_SHORT " %2"
> + __BUG_REL(1b) "\n\t" \
> + RISCV_SHORT " %3"
> #endif
>
> #ifdef CONFIG_GENERIC_BUG
> +#ifdef HAVE_BUG_FUNCTION
> +# define __BUG_FUNC __func__
> +#else
> +# define __BUG_FUNC NULL
> +#endif
> +
> #define __BUG_FLAGS(flags) \
> do { \
> __asm__ __volatile__ ( \
> @@ -58,10 +71,11 @@ do { \
> ".pushsection __bug_table,\"aw\"\n\t" \
> "2:\n\t" \
> __BUG_ENTRY "\n\t" \
> - ".org 2b + %3\n\t" \
> + ".org 2b + %4\n\t" \
> ".popsection" \
> : \
> - : "i" (__FILE__), "i" (__LINE__), \
> + : "i" (__FILE__), "i" (__BUG_FUNC), \
> + "i" (__LINE__), \
> "i" (flags), \
> "i" (sizeof(struct bug_entry))); \
> } while (0)
> --
> 2.39.2
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
- Charlie
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-22 17:40 UTC|newest]
Thread overview: 108+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 13:19 [PATCH v3 00/15] Add support for suppressing warning backtraces Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 01/15] bug/kunit: Core " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-03 13:19 ` [PATCH v3 02/15] kunit: bug: Count suppressed " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-03 13:19 ` [PATCH v3 03/15] kunit: Add test cases for backtrace warning suppression Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 18:11 ` Guenter Roeck
2024-04-09 18:11 ` Guenter Roeck
2024-04-09 18:11 ` Guenter Roeck
2024-04-09 18:11 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 04/15] kunit: Add documentation for warning backtrace suppression API Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-09 8:29 ` David Gow
2024-04-03 13:19 ` [PATCH v3 05/15] drm: Suppress intentional warning backtraces in scaling unit tests Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 06/15] net: kunit: Suppress lock warning noise at end of dev_addr_lists tests Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-04 1:34 ` Jakub Kicinski
2024-04-04 1:34 ` Jakub Kicinski
2024-04-04 1:34 ` Jakub Kicinski
2024-04-04 1:34 ` Jakub Kicinski
2024-04-08 16:34 ` Guenter Roeck
2024-04-08 16:34 ` Guenter Roeck
2024-04-08 16:34 ` Guenter Roeck
2024-04-08 16:34 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 07/15] x86: Add support for suppressing warning backtraces Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 08/15] arm64: " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 09/15] loongarch: " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 10/15] parisc: " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 11/15] s390: " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 12/15] sh: " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` [PATCH v3 13/15] sh: Move defines needed " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-05 18:31 ` Simon Horman
2024-04-05 18:31 ` Simon Horman
2024-04-05 18:31 ` Simon Horman
2024-04-05 18:31 ` Simon Horman
2024-04-03 13:19 ` [PATCH v3 14/15] riscv: Add support " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-22 17:40 ` Charlie Jenkins [this message]
2024-04-22 17:40 ` Charlie Jenkins
2024-04-22 17:40 ` Charlie Jenkins
2024-04-22 17:40 ` Charlie Jenkins
2024-04-03 13:19 ` [PATCH v3 15/15] powerpc: " Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-03 13:19 ` Guenter Roeck
2024-04-04 2:14 ` Michael Ellerman
2024-04-04 2:14 ` Michael Ellerman
2024-04-04 2:14 ` Michael Ellerman
2024-04-04 2:14 ` Michael Ellerman
2024-04-03 21:20 ` [PATCH v3 00/15] " Kees Cook
2024-04-03 21:20 ` Kees Cook
2024-04-03 21:20 ` Kees Cook
2024-04-03 21:20 ` Kees Cook
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=ZiahJT8MTFqAlD5A@ghost \
--to=charlie@rivosinc.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--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=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=mripard@kernel.org \
--cc=naresh.kamboju@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.