Re: [PATCH v4 20/23] powerpc/syscall: Do not check unsupported scv vector on PPC32
Le 26/01/2021 à 11:16, Nicholas Piggin a écrit : Excerpts from Christophe Leroy's message of January 26, 2021 12:48 am: 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 --- 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: addir4,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 internal diff --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() ? Ok, I did that in v5 Thanks Christophe
Re: [PATCH v4 20/23] powerpc/syscall: Do not check unsupported scv vector on PPC32
Excerpts from Christophe Leroy's message of January 26, 2021 12:48 am: > 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 > --- > 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: > addir4,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 internal > diff --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
[PATCH v4 20/23] powerpc/syscall: Do not check unsupported scv vector on PPC32
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 --- 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: addir4,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 internal diff --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)) { /* Unsupported scv vector */ _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); return regs->gpr[3]; @@ -187,6 +187,9 @@ notrace unsigned long syscall_exit_prepare(unsigned long r3, unsigned long ti_flags; unsigned long ret = 0; + if (IS_ENABLED(CONFIG_PPC32)) + scv = 0; + CT_WARN_ON(ct_state() == CONTEXT_USER); kuap_check(); -- 2.25.0