Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1580892 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-02-14 22:50 +0100 |
| Last post | 2017-02-15 12:40 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] arm64: define BUG() instruction without CONFIG_BUG Arnd Bergmann <arnd@arndb.de> - 2017-02-14 22:50 +0100
Re: [PATCH] arm64: define BUG() instruction without CONFIG_BUG Will Deacon <will.deacon@arm.com> - 2017-02-15 12:30 +0100
Re: [PATCH] arm64: define BUG() instruction without CONFIG_BUG Arnd Bergmann <arnd@arndb.de> - 2017-02-15 12:40 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-02-14 22:50 +0100 |
| Subject | [PATCH] arm64: define BUG() instruction without CONFIG_BUG |
| Message-ID | <taT90-79j-21@gated-at.bofh.it> |
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>
---
arch/arm64/include/asm/bug.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h
index 561190d15881..461751429fc3 100644
--- a/arch/arm64/include/asm/bug.h
+++ b/arch/arm64/include/asm/bug.h
@@ -20,9 +20,10 @@
#include <asm/brk-imm.h>
-#ifdef CONFIG_GENERIC_BUG
#define HAVE_ARCH_BUG
+#ifdef CONFIG_GENERIC_BUG
+
#ifdef CONFIG_DEBUG_BUGVERBOSE
#define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
#define __BUGVERBOSE_LOCATION(file, line) \
@@ -57,6 +58,14 @@ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
#define __WARN_TAINT(taint) _BUG_FLAGS(BUGFLAG_TAINT(taint))
+#else
+
+#define BUG() do { \
+ asm volatile("brk %[imm]" \
+ :: [imm] "i" (BUG_BRK_IMM)); \
+ unreachable(); \
+} while (0)
+
#endif /* ! CONFIG_GENERIC_BUG */
#include <asm-generic/bug.h>
--
2.9.0
[toc] | [next] | [standalone]
| From | Will Deacon <will.deacon@arm.com> |
|---|---|
| Date | 2017-02-15 12:30 +0100 |
| Message-ID | <tb5Wy-7HU-3@gated-at.bofh.it> |
| In reply to | #1580892 |
On Tue, Feb 14, 2017 at 10:39:28PM +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>
> ---
> arch/arm64/include/asm/bug.h | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h
> index 561190d15881..461751429fc3 100644
> --- a/arch/arm64/include/asm/bug.h
> +++ b/arch/arm64/include/asm/bug.h
> @@ -20,9 +20,10 @@
>
> #include <asm/brk-imm.h>
>
> -#ifdef CONFIG_GENERIC_BUG
> #define HAVE_ARCH_BUG
>
> +#ifdef CONFIG_GENERIC_BUG
> +
> #ifdef CONFIG_DEBUG_BUGVERBOSE
> #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
> #define __BUGVERBOSE_LOCATION(file, line) \
> @@ -57,6 +58,14 @@ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
>
> #define __WARN_TAINT(taint) _BUG_FLAGS(BUGFLAG_TAINT(taint))
>
> +#else
> +
> +#define BUG() do { \
> + asm volatile("brk %[imm]" \
> + :: [imm] "i" (BUG_BRK_IMM)); \
> + unreachable(); \
> +} while (0)
Do we need to duplicate the asm, or can we reuse the existing BUG
definition in this header? The only extra thing we do is push a __bug_table
entry, but I can't see why that would be a problem.
Will
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-02-15 12:40 +0100 |
| Message-ID | <tb66d-7Lf-9@gated-at.bofh.it> |
| In reply to | #1581227 |
On Wed, Feb 15, 2017 at 12:22 PM, Will Deacon <will.deacon@arm.com> wrote:
> On Tue, Feb 14, 2017 at 10:39:28PM +0100, Arnd Bergmann wrote:
>> @@ -57,6 +58,14 @@ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
>>
>> #define __WARN_TAINT(taint) _BUG_FLAGS(BUGFLAG_TAINT(taint))
>>
>> +#else
>> +
>> +#define BUG() do { \
>> + asm volatile("brk %[imm]" \
>> + :: [imm] "i" (BUG_BRK_IMM)); \
>> + unreachable(); \
>> +} while (0)
>
> Do we need to duplicate the asm, or can we reuse the existing BUG
> definition in this header? The only extra thing we do is push a __bug_table
> entry, but I can't see why that would be a problem.
The only reason for turning off CONFIG_BUG is to save a little extra space
in the kernel image, so I think we really don't want the __bug_table to be
generated.
However, we could split the existing asm in two and have only one definition
for the asm containing the brk instruction.
Arnd
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web