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]
Date:	Mon, 4 May 2015 15:42:57 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Ingo Molnar <mingo@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, Borislav Petkov <bp@...en8.de>,
	Jakub Jelinek <jakub@...hat.com>
Subject: Re: [PATCH] x86: Optimize variable_test_bit()

On Fri, May 01, 2015 at 05:16:30PM +0200, Peter Zijlstra wrote:

> diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
> index cfe3b954d5e4..bcf4fa77c04f 100644
> --- a/arch/x86/include/asm/bitops.h
> +++ b/arch/x86/include/asm/bitops.h
> @@ -313,6 +313,15 @@ static __always_inline int constant_test_bit(long nr, const volatile unsigned lo
>  
>  static inline int variable_test_bit(long nr, volatile const unsigned long *addr)
>  {
> +#ifdef CC_HAVE_ASM_GOTO
> +	asm_volatile_goto ("bt %1, %0\n\t"
> +			   "jc %l[cc_label]"
> +			   : : "m" (*(unsigned long *)addr), "Ir" (nr)
> +			   : : cc_label);
> +	return 0;
> +cc_label:
> +	return 1;
> +#else

I figured I'd try both jc and jnc versions:

   text           data     bss     dec            hex   filename
12203914        1738112 1081344 15023370         e53d0a defconfig-build/vmlinux
12204228        1738112 1081344 15023684         e53e44 defconfig-build/vmlinux-jc
12203240        1738112 1081344 15022696         e53a68 defconfig-build/vmlinux-jnc

Clearly I picked the wrong one :-) It also shows there is real value in
exposing this decision to GCC.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ