From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH] asm-generic: bug: add unlikely() to BUG_ON() Date: Fri, 7 Sep 2018 22:41:00 +0200 Message-ID: References: <20180907192119.4931-1-igor.stoppa@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20180907192119.4931-1-igor.stoppa@huawei.com> Sender: linux-kernel-owner@vger.kernel.org To: Igor Stoppa Cc: igor.stoppa@huawei.com, linux-arch , Linux Kernel Mailing List List-Id: linux-arch.vger.kernel.org On Fri, Sep 7, 2018 at 9:21 PM Igor Stoppa wrote: > > Add a hint to the compiler. > If BUG_ON() is used instead of BUG(), it means that probably the > preferred outcome is to not BUG(). > > The optimization is disabled, in case CONFIG_PROFILE_ANNOTATED_BRANCHES > is turned on. This sounds like a good idea, as this is one of the more likely causes of false-positive -Wmaybe-uninitialized warnings with CONFIG_PROFILE_ANNOTATED_BRANCHES Could you add a comment about -Wmaybe-uninitialized next to the definition? Otherwise that is easily lost. Also, I see that the file has two separate definitions of BUG_ON(), and the other one does have an unlikely() in it already. Can you change both to do the same thing with unlikely() or not unlikely()? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-f193.google.com ([209.85.222.193]:43255 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725986AbeIHBXy (ORCPT ); Fri, 7 Sep 2018 21:23:54 -0400 MIME-Version: 1.0 References: <20180907192119.4931-1-igor.stoppa@huawei.com> In-Reply-To: <20180907192119.4931-1-igor.stoppa@huawei.com> From: Arnd Bergmann Date: Fri, 7 Sep 2018 22:41:00 +0200 Message-ID: Subject: Re: [PATCH] asm-generic: bug: add unlikely() to BUG_ON() Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: To: Igor Stoppa Cc: igor.stoppa@huawei.com, linux-arch , Linux Kernel Mailing List Message-ID: <20180907204100.dK7WEm2q0UbmSssdOYc6AvVm460eu5pbP_xF-jyZ49Q@z> On Fri, Sep 7, 2018 at 9:21 PM Igor Stoppa wrote: > > Add a hint to the compiler. > If BUG_ON() is used instead of BUG(), it means that probably the > preferred outcome is to not BUG(). > > The optimization is disabled, in case CONFIG_PROFILE_ANNOTATED_BRANCHES > is turned on. This sounds like a good idea, as this is one of the more likely causes of false-positive -Wmaybe-uninitialized warnings with CONFIG_PROFILE_ANNOTATED_BRANCHES Could you add a comment about -Wmaybe-uninitialized next to the definition? Otherwise that is easily lost. Also, I see that the file has two separate definitions of BUG_ON(), and the other one does have an unlikely() in it already. Can you change both to do the same thing with unlikely() or not unlikely()? Arnd