From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755253AbdC3H05 (ORCPT ); Thu, 30 Mar 2017 03:26:57 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35412 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752733AbdC3H0z (ORCPT ); Thu, 30 Mar 2017 03:26:55 -0400 Date: Thu, 30 Mar 2017 09:26:50 +0200 From: Ingo Molnar To: Peter Zijlstra Cc: Arnd Bergmann , Ingo Molnar , Josh Triplett , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, Josh Poimboeuf , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/debug: define BUG() againfor !CONFIG_BUG Message-ID: <20170330072650.GA20032@gmail.com> References: <20170329211646.2707365-1-arnd@arndb.de> <20170330071019.nrjbg6wsmm7c3qas@hirez.programming.kicks-ass.net> <20170330071707.GA12758@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170330071707.GA12758@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar wrote: > > * Peter Zijlstra wrote: > > > On Wed, Mar 29, 2017 at 11:16:31PM +0200, Arnd Bergmann wrote: > > > The latest change to the BUG() macro inadvertently reverted the earlier > > > commit b06dd879f5db ("x86: always define BUG() and HAVE_ARCH_BUG, even > > > with !CONFIG_BUG") that sanitized the behavior with CONFIG_BUG=n. > > > > > > I noticed this as some warnings have appeared again that were previously > > > fixed as a side effect of that patch: > > > > > > kernel/seccomp.c: In function '__seccomp_filter': > > > kernel/seccomp.c:670:1: error: no return statement in function returning non-void [-Werror=return-type] > > > > > > drivers/gpu/drm/i915/intel_sprite.c: In function 'intel_check_sprite_plane': > > > drivers/gpu/drm/i915/intel_sprite.c:936:20: error: 'src_h' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > > src->y2 = (src_y + src_h) << 16; > > > ~~~~~~~^~~~~~~~ > > > drivers/gpu/drm/i915/intel_sprite.c:934:20: error: 'src_w' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > > src->x2 = (src_x + src_w) << 16; > > > ~~~~~~~^~~~~~~~ > > > drivers/gpu/drm/i915/intel_sprite.c:936:20: error: 'src_y' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > > src->y2 = (src_y + src_h) << 16; > > > ~~~~~~~^~~~~~~~ > > > drivers/gpu/drm/i915/intel_sprite.c:934:20: error: 'src_x' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > > src->x2 = (src_x + src_w) << 16; > > > ~~~~~~~^~~~~~~~ > > > > > > This combines the two patches and uses the ud2 macro to define BUG() > > > in case of CONFIG_BUG=n. > > > > OK, fair enough I suppose. However, I cribbed this from arm64. What does > > that do for BUG=n ? > > I think we'll get a U2D crash in this case, without any bug information. > > I.e. only marginally debuggable, but it's a deterministic outcome - instead of the > crazy GCC code generation variant of the day when the warning triggers, or the > similarly crazy infinite loop hang. > > I'm not entirely sure though, I don't think many people actually _use_ > CONFIG_BUG=n, it's essentially a crazy thing to do even on constrainted hardware. > Debugging and maintenance costs almost always trump marginal hardware costs of a > bit more debugging code. So I've applied Arnd's patch to restore the previous behavior - but I agree with you that the situation isn't entirely logical at the moment. At minimum we need a comment explaining it or so. Thanks, Ingo