Re: [PATCH 7/7] powerpc: add support for PREEMPT_LAZY

From: Sebastian Andrzej Siewior
Date: Thu Oct 10 2024 - 04:18:18 EST


On 2024-10-09 09:54:11 [-0700], Ankur Arora wrote:
> From: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
>
> Add PowerPC arch support for PREEMPT_LAZY by defining LAZY bits.
>
> Since PowerPC doesn't use generic exit to functions, check for
> NEED_RESCHED_LAZY when exiting to user or to the kernel from
> interrupt routines.
>
> Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
> [ Changed TIF_NEED_RESCHED_LAZY to now be defined unconditionally. ]
> Signed-off-by: Ankur Arora <ankur.a.arora@xxxxxxxxxx>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/thread_info.h | 5 ++++-
> arch/powerpc/kernel/interrupt.c | 5 +++--
> 3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 8094a01974cc..593a1d60d443 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -270,6 +270,7 @@ config PPC
> select HAVE_PERF_REGS
> select HAVE_PERF_USER_STACK_DUMP
> select HAVE_RETHOOK if KPROBES
> + select ARCH_HAS_PREEMPT_LAZY
> select HAVE_REGS_AND_STACK_ACCESS_API
> select HAVE_RELIABLE_STACKTRACE
> select HAVE_RSEQ

I would move this up to the ARCH_HAS_ block.

> diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
> index 6ebca2996f18..ae7793dae763 100644
> --- a/arch/powerpc/include/asm/thread_info.h
> +++ b/arch/powerpc/include/asm/thread_info.h
> @@ -117,11 +117,14 @@ void arch_setup_new_exec(void);
> #endif
> #define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */
> #define TIF_32BIT 20 /* 32 bit binary */
> +#define TIF_NEED_RESCHED_LAZY 21 /* Lazy rescheduling */

I don't see any of the bits being used in assembly anymore.
If you group the _TIF_USER_WORK_MASK bits it a single 16 bit block then
the compiler could issue a single andi.

Sebastian