lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 17 Mar 2021 22:38:55 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched: replace if (cond) BUG() with BUG_ON()

On Wed, Mar 17, 2021 at 9:05 PM Ingo Molnar <mingo@...nel.org> wrote:
> * Arnd Bergmann <arnd@...nel.org> wrote:
> > On Wed, Mar 17, 2021 at 9:45 AM Ingo Molnar <mingo@...nel.org> wrote:
> > >
> > > More importantly, we use this pattern when we don't want !CONFIG_BUG
> > > to remove the 'condition'.
> > >
> > > I.e. the "side effect" here is important scheduler logic. It must
> > > never be optimized out.
> >
> > This behavior for !CONFIG_BUG has changed a while ago, it is now safe
> > to rely on the side-effect of the BUG_ON() condition regardless of
> > CONFIG_BUG. When that option is disabled, running into the condition
> > just ends up in a "do {} while (1)" loop.
>
> Dunno, I still think it's not a particularly clean pattern to 'hide'
> significant side effects within a BUG_ON().

Fair enough. Readability really is the key here, and I agree the current
version is easier to understand. The only architectures that even define
an optimized BUG_ON() are mips and powerpc, and saving a few cycles
is barely worth it in a fast path, which this is clearly not.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ