• Jan Beulich's avatar
    x86-64: Slightly shorten line system call entry and exit paths · 46db09d3
    Jan Beulich authored
    GET_THREAD_INFO() involves a memory read immediately followed by
    an "sub" on the value read, in turn (in several cases)
    immediately followed by a use of the calculated value as the
    base address of a memory access. This combination of
    instructions has a non-negligible potential for stalls.
    
    In the system call entry point code, however, the (fixed) offset
    of the stack pointer from the end of the stack is generally
    known, and hence we can instead avoid the memory load and
    subtract, and instead do the memory reference using %rsp as the
    base register. To do so in a legible fashion, introduce a
    THREAD_INFO() macro which, provided a register (generally %rsp)
    and the known offset from the end of the stack, produces a
    suitable memory access operand.
    
    The patch attempts to only touch the fast paths (no auditing and
    alike), but manages to do so only in the 64-bit entry point
    case; the compatibility mode entry points have so many
    interdependencies between their various branch targets that it
    was necessary to also adjust the slow paths to eliminate the
    risk of having missed some register dependency during code
    analysis.
    Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
    Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
    Link: http://lkml.kernel.org/r/4ED4CD690200007800064075@nat28.tlf.novell.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
    46db09d3
entry_64.S 37.4 KB