• Christophe Leroy's avatar
    powerpc/signal32: Transform save_user_regs() and save_tm_user_regs() in 'unsafe' version · ef75e731
    Christophe Leroy authored
    Change those two functions to be used within a user access block.
    
    For that, change save_general_regs() to and unsafe_save_general_regs(),
    then replace all user accesses by unsafe_ versions.
    
    This series leads to a reduction from 2.55s to 1.73s of
    the system CPU time with the following microbench app
    on an mpc832x with KUAP (approx 32%)
    
    Without KUAP, the difference is in the noise.
    
    	void sigusr1(int sig) { }
    
    	int main(int argc, char **argv)
    	{
    		int i = 100000;
    
    		signal(SIGUSR1, sigusr1);
    		for (;i--;)
    		    raise(SIGUSR1);
    		exit(0);
    	}
    
    An additional 0.10s reduction is achieved by removing
    CONFIG_PPC_FPU, as the mpc832x has no FPU.
    
    A bit less spectacular on an 8xx as KUAP is less heavy, prior to
    the series (with KUAP) it ran in 8.10 ms. Once applies the removal
    of FPU regs handling, we get 7.05s. With the full series, we get 6.9s.
    If artificially re-activating FPU regs handling with the full series,
    we get 7.6s.
    
    So for the 8xx, the removal of the FPU regs copy is what makes the
    difference, but the rework of handle_signal also have a benefit.
    
    Same as above, without KUAP the difference is in the noise.
    Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
    [mpe: Fixup typo in SPE handling]
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/c7b37b385ccf9666066452e58f018a86573f83e8.1597770847.git.christophe.leroy@csgroup.eu
    ef75e731
signal_32.c 38.3 KB