From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643AbdBOLW4 (ORCPT ); Wed, 15 Feb 2017 06:22:56 -0500 Received: from foss.arm.com ([217.140.101.70]:54200 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbdBOLWy (ORCPT ); Wed, 15 Feb 2017 06:22:54 -0500 Date: Wed, 15 Feb 2017 11:22:53 +0000 From: Will Deacon To: Arnd Bergmann Cc: Catalin Marinas , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: define BUG() instruction without CONFIG_BUG Message-ID: <20170215112253.GB9630@arm.com> References: <20170214213941.3026318-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170214213941.3026318-1-arnd@arndb.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 > > -#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