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]
Message-ID: <alpine.DEB.2.20.1612091723170.3423@nanos>
Date:   Fri, 9 Dec 2016 17:25:00 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Kyle Huey <me@...ehuey.com>
cc:     Ingo Molnar <mingo@...hat.com>, "H. Peter Anvin" <hpa@...or.com>,
        x86@...nel.org, linux-kernel@...r.kernel.org,
        Robert O'Callahan <robert@...llahan.org>
Subject: Re: [PATCH] x86: Optimize TIF checking in __switch_to_xtra.

On Fri, 9 Dec 2016, Thomas Gleixner wrote:
> On Tue, 6 Dec 2016, Kyle Huey wrote:
> > I propose the following patch, which results in GCC generating this code:
> > 
> >     mov    (%rsi),%rax
> >     xor    (%rdi),%rax
> >     mov    %rdi,%rbx
> >     mov    %rsi,%r12
> >     test   $0x2000000,%eax
> >     mov    %rax,%rdx
> >     jne    3f
> > 1:  test   $0x10000,%edx
> >     je     2f
> >     /* do some more work */
> > 2:  /* the rest of the function */
> >     ret
> > 3:  /* do work */
> >     mov    (%r12),%rdx
> >     xor    (%rbx),%rdx
> >     jmp    1b
> > 
> > When we are not doing the work controlled by these flags this is significantly
> > better. We only have to load the flags from memory once, and we do a single
> > XOR that we can test multiple times instead of repeatedly isolating bits.
> 
> You rely on the compiler doing the right thing. And it's non obvious from
> the code that this gets optimized as above.

On i386 this creates worse code due to register pressure it seems.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ