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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171009.161708.963726434970115075.davem@davemloft.net>
Date:   Mon, 09 Oct 2017 16:17:08 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     alexei.starovoitov@...il.com
Cc:     alexander.levin@...izon.com, devtimhansen@...il.com,
        willemb@...gle.com, edumazet@...gle.com, soheil@...gle.com,
        pabeni@...hat.com, elena.reshetova@...el.com, tom@...ntonium.net,
        Jason@...c4.com, fw@...len.de, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] net/core: Fix BUG to BUG_ON conditionals.

From: Alexei Starovoitov <alexei.starovoitov@...il.com>
Date: Mon, 9 Oct 2017 16:06:20 -0700

>> For these archs, wouldn't it then be more efficient to use BUG_ON
>> rather than BUG()?
> 
> why more efficient? any data to prove that?

It can completely eliminate a branch.

For example on powerpc if you use BUG() then the code generated is:

	test condition
	branch_not_true	1f
	unconditional_trap
1:

Whereas with BUG_ON() it's just:

	test condition
	trap_if_true

Which is a lot better even when the branches in the first case are
well predicted.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ