summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2023-03-25 13:29:02 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2023-04-11 15:13:33 +0200
commitb504b6aade0403eaffa9ce51b8207d710705beaf (patch)
tree37f8f021c4feda6cb362d01a1ae2a7b5244f15a0 /arch/powerpc/kernel/process.c
parentpowerpc: copy_thread differentiate kthreads and user mode threads (diff)
downloadlinux-b504b6aade0403eaffa9ce51b8207d710705beaf.tar.xz
linux-b504b6aade0403eaffa9ce51b8207d710705beaf.zip
powerpc: differentiate kthread from user kernel thread start
Kernel created user threads start similarly to kernel threads in that they call a kernel function after first returning from _switch, so they share ret_from_kernel_thread for this. Kernel threads never return from that function though, whereas user threads often do (although some don't, e.g., IO threads). Split these startup functions in two, and catch kernel threads that improperly return from their function. This is intended to make the complicated code a little bit easier to understand. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230325122904.2375060-7-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 88898ca7ab0b..14fe4702a098 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1741,7 +1741,8 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
struct pt_regs *kregs; /* Switch frame regs */
extern void ret_from_fork(void);
extern void ret_from_fork_scv(void);
- extern void ret_from_kernel_thread(void);
+ extern void ret_from_kernel_user_thread(void);
+ extern void start_kernel_thread(void);
void (*f)(void);
unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
struct thread_info *ti = task_thread_info(p);
@@ -1758,7 +1759,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
sp -= STACK_FRAME_MIN_SIZE;
((unsigned long *)sp)[0] = 0;
- f = ret_from_kernel_thread;
+ f = start_kernel_thread;
p->thread.regs = NULL; /* no user register state */
clear_tsk_compat_task(p);
} else {
@@ -1784,7 +1785,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
childregs->softe = IRQS_ENABLED;
#endif
ti->flags |= _TIF_RESTOREALL;
- f = ret_from_kernel_thread;
+ f = ret_from_kernel_user_thread;
} else {
struct pt_regs *regs = current_pt_regs();
unsigned long clone_flags = args->flags;