Re: [PATCH 03/10] kernel: entry: Wire up syscall_work in common entry code

From: Thomas Gleixner
Date: Sun Nov 15 2020 - 13:39:07 EST


On Fri, Nov 13 2020 at 22:29, Gabriel Krisman Bertazi wrote:

"kernel: entry:" is not the right subsystem prefix.

git log kernel/entry/ might give you a hint.

> Prepares the common entry code to use the SYSCALL_WORK flags. They
> will

s/Prepares/Prepare/

> be defined in subsequent patches for each type of syscall
> work. SYSCALL_WORK_ENTRY/EXIT are defined for the transition, as they
> will replace the TIF_ equivalent defines.
>
> Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx>
> ---
> include/linux/entry-common.h | 3 +++
> kernel/entry/common.c | 15 +++++++++------
> 2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
> index 1a128baf3628..cbc5c702ee4d 100644
> --- a/include/linux/entry-common.h
> +++ b/include/linux/entry-common.h
> @@ -64,6 +64,9 @@
> (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
> _TIF_SYSCALL_TRACEPOINT | ARCH_SYSCALL_EXIT_WORK)
>
> +#define SYSCALL_WORK_ENTER (0)
> +#define SYSCALL_WORK_EXIT (0)
> +
> /*
> * TIF flags handled in exit_to_user_mode_loop()
> */
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index bc75c114c1b3..5a4bb72ff28e 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
> @@ -42,7 +42,7 @@ static inline void syscall_enter_audit(struct pt_regs *regs, long syscall)
> }
>
> static long syscall_trace_enter(struct pt_regs *regs, long syscall,
> - unsigned long ti_work)
> + unsigned long ti_work, unsigned long work)
> {
> long ret = 0;
>
> @@ -75,10 +75,11 @@ static __always_inline long
> __syscall_enter_from_user_work(struct pt_regs *regs, long syscall)
> {
> unsigned long ti_work;
> + unsigned long work = READ_ONCE(current_thread_info()->syscall_work);

Even if this is temporary this code uses reverse fir tree ordering of
variable declarations:

unsigned long work = READ_ONCE(current_thread_info()->syscall_work);
unsigned long ti_work;

Thanks,

tglx