• Nicholas Piggin's avatar
    powerpc/64: Avoid restore_math call if possible in syscall exit · bc4f65e4
    Nicholas Piggin authored
    The syscall exit code that branches to restore_math is quite heavy on
    Book3S, consisting of 2 mtmsr instructions. Threads that don't use both
    FP and vector can get caught here if the kernel ever uses FP or vector.
    Lazy-FP/vec context switching also trips this case.
    
    So check for lazy FP and vector before switching RI for restore_math.
    Move most of this case out of line.
    
    For threads that do want to restore math registers, the MSR switches are
    still suboptimal. Future direction may be to use a soft-RI bit to avoid
    MSR switches in kernel (similar to soft-EE), but for now at least the
    no-restore
    
    POWER9 context switch rate increases by about 5% due to sched_yield(2)
    return performance. I haven't constructed a test to measure the syscall
    cost.
    Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    bc4f65e4
entry_64.S 28.3 KB