From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] [v2] arm64: define BUG() instruction without CONFIG_BUG
Date: Mon, 20 Mar 2017 19:09:39 +0000 [thread overview]
Message-ID: <20170320190939.GR17263@arm.com> (raw)
In-Reply-To: <20170314213939.3874497-1-arnd@arndb.de>
Hi Arnd,
On Tue, Mar 14, 2017 at 10:39:21PM +0100, Arnd Bergmann wrote:
> This mirrors commit e9c38ceba8d9 ("ARM: 8455/1: define __BUG as
> asm(BUG_INSTR) without CONFIG_BUG") to make the behavior of
> arm64 consistent with arm and x86, and avoids lots of warnings in
> randconfig builds, such as:
>
> kernel/seccomp.c: In function '__seccomp_filter':
> kernel/seccomp.c:666:1: error: no return statement in function returning non-void [-Werror=return-type]
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Originally submitted v1 on Feb 14 as a simple addition of a few lines.
> v2 is a new version doing the same thing with a cleaner rewrite of
> the file, using three lines less, after a suggested from Will Deacon.
>
> No need to get this into v4.11 though, especially as the rewrite
> makes it a bit risky. Please queue this for v4.12 if you like the
> new version.
> ---
> arch/arm64/include/asm/bug.h | 34 ++++++++++++++++++++--------------
> 1 file changed, 20 insertions(+), 14 deletions(-)
Thanks for updating this. It looks correct to me, but I have one question
below.
> diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h
> index 561190d15881..bfc6021760e5 100644
> --- a/arch/arm64/include/asm/bug.h
> +++ b/arch/arm64/include/asm/bug.h
> @@ -20,9 +20,6 @@
>
> #include <asm/brk-imm.h>
>
> -#ifdef CONFIG_GENERIC_BUG
> -#define HAVE_ARCH_BUG
> -
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
> #define __BUGVERBOSE_LOCATION(file, line) \
> @@ -36,28 +33,37 @@
> #define _BUGVERBOSE_LOCATION(file, line)
> #endif
>
> -#define _BUG_FLAGS(flags) __BUG_FLAGS(flags)
> +#ifdef CONFIG_GENERIC_BUG
>
> -#define __BUG_FLAGS(flags) asm volatile ( \
> +#define __BUG_ENTRY(flags) \
> ".pushsection __bug_table,\"a\"\n\t" \
> ".align 2\n\t" \
> "0: .long 1f - 0b\n\t" \
> _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
> ".short " #flags "\n\t" \
> ".popsection\n" \
> - \
> - "1: brk %[imm]" \
> - :: [imm] "i" (BUG_BRK_IMM) \
> -)
> + "1: "
> +#else
> +#define __BUG_ENTRY(flags) ""
> +#endif
> +
> +#define __BUG_FLAGS(flags) \
> + asm volatile ( \
> + __BUG_ENTRY(0) \
> + "brk %[imm]" :: [imm] "i" (BUG_BRK_IMM) \
> + );
>
> -#define BUG() do { \
> - _BUG_FLAGS(0); \
> - unreachable(); \
> +#define _BUG_FLAGS(flags) __BUG_FLAGS(flags)
What is this for? I don't see _BUG_FLAGS used anywhere, but I could
be missing some macro expansion.
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [v2] arm64: define BUG() instruction without CONFIG_BUG
Date: Mon, 20 Mar 2017 19:09:39 +0000 [thread overview]
Message-ID: <20170320190939.GR17263@arm.com> (raw)
In-Reply-To: <20170314213939.3874497-1-arnd@arndb.de>
Hi Arnd,
On Tue, Mar 14, 2017 at 10:39:21PM +0100, Arnd Bergmann wrote:
> This mirrors commit e9c38ceba8d9 ("ARM: 8455/1: define __BUG as
> asm(BUG_INSTR) without CONFIG_BUG") to make the behavior of
> arm64 consistent with arm and x86, and avoids lots of warnings in
> randconfig builds, such as:
>
> kernel/seccomp.c: In function '__seccomp_filter':
> kernel/seccomp.c:666:1: error: no return statement in function returning non-void [-Werror=return-type]
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Originally submitted v1 on Feb 14 as a simple addition of a few lines.
> v2 is a new version doing the same thing with a cleaner rewrite of
> the file, using three lines less, after a suggested from Will Deacon.
>
> No need to get this into v4.11 though, especially as the rewrite
> makes it a bit risky. Please queue this for v4.12 if you like the
> new version.
> ---
> arch/arm64/include/asm/bug.h | 34 ++++++++++++++++++++--------------
> 1 file changed, 20 insertions(+), 14 deletions(-)
Thanks for updating this. It looks correct to me, but I have one question
below.
> diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h
> index 561190d15881..bfc6021760e5 100644
> --- a/arch/arm64/include/asm/bug.h
> +++ b/arch/arm64/include/asm/bug.h
> @@ -20,9 +20,6 @@
>
> #include <asm/brk-imm.h>
>
> -#ifdef CONFIG_GENERIC_BUG
> -#define HAVE_ARCH_BUG
> -
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
> #define __BUGVERBOSE_LOCATION(file, line) \
> @@ -36,28 +33,37 @@
> #define _BUGVERBOSE_LOCATION(file, line)
> #endif
>
> -#define _BUG_FLAGS(flags) __BUG_FLAGS(flags)
> +#ifdef CONFIG_GENERIC_BUG
>
> -#define __BUG_FLAGS(flags) asm volatile ( \
> +#define __BUG_ENTRY(flags) \
> ".pushsection __bug_table,\"a\"\n\t" \
> ".align 2\n\t" \
> "0: .long 1f - 0b\n\t" \
> _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
> ".short " #flags "\n\t" \
> ".popsection\n" \
> - \
> - "1: brk %[imm]" \
> - :: [imm] "i" (BUG_BRK_IMM) \
> -)
> + "1: "
> +#else
> +#define __BUG_ENTRY(flags) ""
> +#endif
> +
> +#define __BUG_FLAGS(flags) \
> + asm volatile ( \
> + __BUG_ENTRY(0) \
> + "brk %[imm]" :: [imm] "i" (BUG_BRK_IMM) \
> + );
>
> -#define BUG() do { \
> - _BUG_FLAGS(0); \
> - unreachable(); \
> +#define _BUG_FLAGS(flags) __BUG_FLAGS(flags)
What is this for? I don't see _BUG_FLAGS used anywhere, but I could
be missing some macro expansion.
Will
next prev parent reply other threads:[~2017-03-20 19:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 21:39 [PATCH] [v2] arm64: define BUG() instruction without CONFIG_BUG Arnd Bergmann
2017-03-14 21:39 ` Arnd Bergmann
2017-03-20 19:09 ` Will Deacon [this message]
2017-03-20 19:09 ` Will Deacon
2017-03-21 10:35 ` Arnd Bergmann
2017-03-21 10:35 ` Arnd Bergmann
2017-03-21 11:51 ` Will Deacon
2017-03-21 11:51 ` Will Deacon
2017-03-21 14:11 ` Catalin Marinas
2017-03-21 14:11 ` Catalin Marinas
2017-03-22 14:37 ` Catalin Marinas
2017-03-22 14:37 ` Catalin Marinas
2017-03-22 14:51 ` Arnd Bergmann
2017-03-22 14:51 ` Arnd Bergmann
2017-03-22 15:32 ` Catalin Marinas
2017-03-22 15:32 ` Catalin Marinas
2017-03-22 16:29 ` Arnd Bergmann
2017-03-22 16:29 ` Arnd Bergmann
2017-03-22 16:57 ` Catalin Marinas
2017-03-22 16:57 ` Catalin Marinas
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=20170320190939.GR17263@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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.