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]
Date:	Sun, 5 Nov 2006 09:20:12 -0800 (PST)
From:	Linus Torvalds <torvalds@...l.org>
To:	Andi Kleen <ak@...e.de>
cc:	Benjamin LaHaise <bcrl@...ck.org>,
	Zachary Amsden <zach@...are.com>,
	Chuck Ebbert <76306.1226@...puserve.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [rfc patch] i386: don't save eflags on task switch



On Sun, 5 Nov 2006, Andi Kleen wrote:
> 
> > - mispredicted branches on a P4 are potentially worse than  
> > the popf cost.
> 
> They are far less than 48 cycles. The P4 is not _that_ bad in this
> area.

You wanna bet? Use the newer P4 cores. A branch mispredict is over 20 
cycles, and I bet the "sti" isn't cheap either.

In other words, I suspect the difference between "popfl" and "conditional 
jump over sti" is basically zero - exactly because the sti isn't exactly a 
no-op.

(Enabling interrupts is actually much more complex than you'd expect. 
Interrupt delivery in a HT core is not simple in itself, and "sti" in many 
ways is actually more complex than "popf", because it has the additional 
"single-cycle interrupt shadow", ie the interrupt isn't actually enabled 
after the sti, it's enabled after the _next_ instruction after the sti. So 
from a uarch standpoint, "popf" is actually somewhat simpler.)

Anyway, what both you and Chuck seem to be missing is that trying to save 
a couple of CPU cycles is NOT WORTH IT, if it makes the code harder and 
more fragile. The "save eflags over context switch" that we do now is 
_obvious_ code. That's worth a lot in itself. And the costs of context 
switching isn't actually a couple of cycles - the real costs are all 
elsewhere.

			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

Powered by Openwall GNU/*/Linux Powered by OpenVZ