Re: [PATCH v4 20/23] powerpc/syscall: Do not check unsupported scv vector on PPC32
From: Nicholas Piggin <npiggin@gmail.com>
Date: 2021-01-26 11:35:45
Also in:
lkml
Excerpts from Christophe Leroy's message of January 26, 2021 12:48 am:
quoted hunk ↗ jump to hunk
Only PPC64 has scv. No need to check the 0x7ff0 trap on PPC32. And ignore the scv parameter in syscall_exit_prepare (Save 14 cycles 346 => 332 cycles) Signed-off-by: Christophe Leroy <redacted> --- arch/powerpc/kernel/entry_32.S | 1 - arch/powerpc/kernel/syscall.c | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-)diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 9922a04650f7..6ae9c7bcb06c 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S@@ -343,7 +343,6 @@ transfer_to_syscall: ret_from_syscall: addi r4,r1,STACK_FRAME_OVERHEAD - li r5,0 bl syscall_exit_prepare #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) /* If the process has its own DBCR0 value, load it up. The internaldiff --git a/arch/powerpc/kernel/syscall.c b/arch/powerpc/kernel/syscall.c index 476909b11051..30f8a397a522 100644 --- a/arch/powerpc/kernel/syscall.c +++ b/arch/powerpc/kernel/syscall.c@@ -86,7 +86,7 @@ notrace long system_call_exception(long r3, long r4, long r5, local_irq_enable(); if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) { - if (unlikely(regs->trap == 0x7ff0)) { + if (IS_ENABLED(CONFIG_PPC64) && unlikely(regs->trap == 0x7ff0)) { /* Unsupported scv vector */ _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); return regs->gpr[3];@@ -109,7 +109,7 @@ notrace long system_call_exception(long r3, long r4, long r5, r8 = regs->gpr[8]; } else if (unlikely(r0 >= NR_syscalls)) { - if (unlikely(regs->trap == 0x7ff0)) { + if (IS_ENABLED(CONFIG_PPC64) && unlikely(regs->trap == 0x7ff0)) {
Perhaps this could be hidden behind a function like trap_is_scv()? trap_is_unsupported_scv() ? Thanks, Nick