lkml.org 
[lkml]   [2015]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 3/4] x86: open-code register save/restore in trace_hardirqs thunks
On Sat, Jan 10, 2015 at 10:02 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Sat, Jan 10, 2015 at 12:42 PM, Borislav Petkov <bp@alien8.de> wrote:
>> On Sat, Jan 10, 2015 at 12:17:13PM -0800, Andy Lutomirski wrote:
>>> I asked this once, and someone told me that push/pop has lower
>>> throughput. I find this surprising.
>>
>> Implicit dependency on %rsp probably. The MOVs allow you to start more
>> stuff out-of-order I'd guess...
>
> AIUI modern CPUs have fancy stack engines that match call/ret pairs,
> and presumably they can speculate rsp values across multiple pushes
> and pops very quickly.

Yes, stack engine hangs off the pipeline right after decode stage.

> Also, don't compilers generally use push and pop to save and restore
> callee-saved registers? I think that function calls are common enough
> that the CPU vendors would have made these sequences fast.

Compilers can't predict which functions are hottest.
Using mov's would bloat prologues by about factor of 5.

I think using push/pop is okay. In the very hottest code paths
you may want to prefer mov's.


\
 
 \ /
  Last update: 2015-01-10 22:21    [W:0.042 / U:1.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site