• Peter Zijlstra's avatar
    x86/entry: Optimize common_interrupt_return() · c5162137
    Peter Zijlstra authored
    The code in common_interrupt_return() does a bunch of unconditional
    work that is really only needed on PTI kernels. Specifically it
    unconditionally copies the IRET frame back onto the entry stack,
    swizzles onto the entry stack and does IRET from there.
    
    However, without PTI we can simply IRET from whatever stack we're on.
    
      ivb-ep, mitigations=off, gettid-1m:
    
      PRE:
           140,118,538      cycles:k                                                      ( +-  0.01% )
           236,692,878      instructions:k            #    1.69  insn per cycle           ( +-  0.00% )
    
      POST:
           140,026,608      cycles:k                                                      ( +-  0.01% )
           236,696,176      instructions:k            #    1.69  insn per cycle           ( +-  0.00% )
    
    (this is with --repeat 100 and the run-to-run variance is bigger than
    the difference shown)
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://lore.kernel.org/r/20231120143626.638107480@infradead.org
    c5162137
calling.h 11.6 KB