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
| ||
|
Date: Tue, 10 Sep 2013 09:34:52 -0700 From: Linus Torvalds <torvalds@...ux-foundation.org> To: Ingo Molnar <mingo@...nel.org> Cc: Peter Zijlstra <peterz@...radead.org>, Andi Kleen <ak@...ux.intel.com>, Peter Anvin <hpa@...or.com>, Mike Galbraith <bitbucket@...ine.de>, Thomas Gleixner <tglx@...utronix.de>, Arjan van de Ven <arjan@...ux.intel.com>, Frederic Weisbecker <fweisbec@...il.com>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org> Subject: Re: [PATCH 0/7] preempt_count rework -v2 On Tue, Sep 10, 2013 at 6:56 AM, Ingo Molnar <mingo@...nel.org> wrote: > > +static __always_inline bool __preempt_count_dec_and_test(void) > +{ > + unsigned char c; > + > + asm ("decl " __percpu_arg(0) "; sete %1" > + : "+m" (__preempt_count), "=qm" (c)); > + > + return c != 0; > +} > > And that's where the sete and test originates from. We could make this use "asm goto" instead. An "asm goto" cannot have outputs, but this particular one doesn't _need_ outputs. You could mark the preempt_count memory as an input, and then have a memory clobber. I think you need the memory clobber anyway for that preempt-count thing. So I _think_ something like static __always_inline bool __preempt_count_dec_and_test(void) { asm goto("decl " __percpu_arg(0) "\n\t" "je %l[became_zero]" : :"m" (__preempt_count):"memory":became_zero); return 0; became_zero: return 1; } would work. You need to wrap it in #ifdef CC_HAVE_ASM_GOTO and then have the old "sete" version for older compilers, but for newer ones you'd get pretty much perfect code. UNTESTED. Linus -- 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