Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754778AbdLTJBj (ORCPT ); Wed, 20 Dec 2017 04:01:39 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:33538 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752128AbdLTJBb (ORCPT ); Wed, 20 Dec 2017 04:01:31 -0500 X-Google-Smtp-Source: ACJfBosDu4E/lH279zbq/y1aunVBafRrrsIZM8coahJXUe/DB0y7iAJmjLh9E8mjTQiKXCT9TIdoXtCHH0I8jBvaY/A= MIME-Version: 1.0 In-Reply-To: References: <20171219114112.939391-1-arnd@arndb.de> <8e42a1de-f619-7a4e-6d58-f90f53f5f38f@synopsys.com> From: Arnd Bergmann Date: Wed, 20 Dec 2017 10:01:27 +0100 X-Google-Sender-Auth: MgmQkox3a6iKh2cBuXP3kg1vOWM Message-ID: Subject: Re: [PATCH] bug.h: Work around GCC PR82365 in BUG() To: Vineet Gupta Cc: "linux-arch@vger.kernel.org" , Andrew Morton , "linux-kbuild@vger.kernel.org" , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , "David S. Miller" , Christopher Li , Thomas Gleixner , Peter Zijlstra , Kees Cook , Ingo Molnar , Josh Poimboeuf , Will Deacon , "Steven Rostedt (VMware)" , Mark Rutland , "linux-snps-arc@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-cris-kernel@axis.com" , "linux-ia64@vger.kernel.org" , "linux-m68k@lists.linux-m68k.org" , "sparclinux@vger.kernel.org" , "linux-sparse@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1750 Lines: 54 On Tue, Dec 19, 2017 at 11:38 PM, Vineet Gupta wrote: > On 12/19/2017 12:13 PM, Arnd Bergmann wrote: >> >> >>> I suppose BUG() implies "dead end" like semantics - which ARC was lacking >>> before ? >> >> Correct. Using __builtin_trap() here avoids the 'control reaches end of >> non-void >> function' warnings, but then makes us run into the stack size problem that >> I work around with the barrier_before_unreachable(). >> >> It would be good if you could give this a quick test to see if you get >> sensible >> output from the __builtin_trap(); > > > It does, added a BUG() arbit, hits an abort() > > ... > ISA Extn : atomic ll64 unalign (not used) > : mpy[opt 9] div_rem norm barrel-shift swap minmax swape > BPU : partial match, cache:2048, Predict Table:16384 > BUG: failure at ../arch/arc/mm/tlb.c:827/arc_mmu_init()! > > > Tested-by: Vineet Gupta I meant whether it prints the right registers and stack trace, but I assume you tested that and just did not list it above. > FWIW newer ARC gcc actually implements the builtin so we get a trap 5 > instruction now, vs., abort() calls before. > > BTW I missed reading the hunk of your changelog where this addresses the > long standing mystery with ARC builds and numerous -Wreturn-type warnings. I > always wondered why they were not fixed upstream already, being too lazy to > investigate myself, and turns out this was due to this BUG() thingy. phew ! Hmm, so with the new definition of abort(), +__weak void abort(void) +{ + BUG(); + + /* if that doesn't kill us, halt */ + panic("Oops failed to kill thread"); +} won't that run into an endless recursion? Or do you then override abort() for ARC? Arnd