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: <20150421130916.GC28895@pd.tnic>
Date:	Tue, 21 Apr 2015 15:09:16 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Andy Lutomirski <luto@...nel.org>,
	Andrew Cooper <andrew.cooper3@...rix.com>,
	Xen-devel <xen-devel@...ts.xen.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Boris Ostrovsky <boris.ostrovsky@...cle.com>,
	David Vrabel <david.vrabel@...rix.com>,
	Rusty Russell <rusty@...tcorp.com.au>, lguest@...ts.ozlabs.org,
	Denys Vlasenko <vda.linux@...glemail.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [RFC PATCH] x86/asm/irq: Don't use POPF but STI

On Tue, Apr 21, 2015 at 02:45:58PM +0200, Ingo Molnar wrote:
> From 6f01f6381e8293c360b7a89f516b8605e357d563 Mon Sep 17 00:00:00 2001
> From: Ingo Molnar <mingo@...nel.org>
> Date: Tue, 21 Apr 2015 13:32:13 +0200
> Subject: [PATCH] x86/asm/irq: Don't use POPF but STI
> 
> So because the POPF instruction is slow and STI is faster on 
> essentially all x86 CPUs that matter, instead of:
> 
>   ffffffff81891848:       9d                      popfq
> 
> we can do:
> 
>   ffffffff81661a2e:       41 f7 c4 00 02 00 00    test   $0x200,%r12d
>   ffffffff81661a35:       74 01                   je     ffffffff81661a38 <snd_pcm_stream_unlock_irqrestore+0x28>
>   ffffffff81661a37:       fb                      sti
>   ffffffff81661a38:
> 
> This bloats the kernel a bit, by about 1K on the 64-bit defconfig:
> 
>    text    data     bss     dec     hex filename
>    12258634        1812120 1085440 15156194         e743e2 vmlinux.before
>    12259582        1812120 1085440 15157142         e74796 vmlinux.after
> 
> the other cost is the extra branching, adding extra pressure to the
> branch prediction hardware and also potential branch misses.

Do we care? After we enable interrupts, we'll most likely go somewhere
cache "cold" anyway, so the branch misses will happen anyway.

The question is, would the cost drop from POPF -> STI cover the increase
in branch misses overhead?

Hmm, interesting.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
--
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