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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <50323427020000780009660E@nat28.tlf.novell.com>
Date:	Mon, 20 Aug 2012 11:57:11 +0100
From:	"Jan Beulich" <JBeulich@...e.com>
To:	"Andi Kleen" <andi@...stfloor.org>
Cc:	<x86@...nel.org>, <akpm@...ux-foundation.org>,
	<ak@...ux.intel.com>, <mmarek@...e.cz>,
	<linux-kbuild@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 46/74] x86, lto: Disable fancy hweight
 optimizations for LTO

>>> On 19.08.12 at 17:15, Andi Kleen <andi@...stfloor.org> wrote:
>> >--- a/arch/x86/include/asm/arch_hweight.h
>> >+++ b/arch/x86/include/asm/arch_hweight.h
>> >@@ -25,9 +25,14 @@ static inline unsigned int __arch_hweight32(unsigned int w)
>> >{
>> >    unsigned int res = 0;
>>  >
>> >+#ifdef CONFIG_LTO
>> >+    res  = __sw_hweight32(w);
>> >+#else
>> >+
>> >    asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT)
>> >             : "="REG_OUT (res)
>> >             : REG_IN (w));
>> >+#endif
>>  
>> Isn't this a little to harsh? Rather than not using popcnt at all, why don't 
>> you just add the necessary clobbers to the asm() in the LTO case?
> 
> gcc lacks the means to declare that a asm uses an external symbol
> currently. Ok we could make it visible. But there's no way to make the
> special calling convention work anyways, at least not without someone 
> changing gcc to allow to declare this per function.

That's not the point: The point really is that you could allow the
alternative regardless of LTO, and just penalize the LTO case
by having even the asm clobber the registers that a function call
would not preserve.

> I'm not sure the optimization is really worth it anyways, hweight should
> be uncommon.

That's a separate question (but I sort of agree - not sure whether
CPU mask weights ever get calculated on hot paths).

Jan

--
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