提交 64259ab4 编写于 作者: Z Zou Cao 提交者: Shile Zhang

alinux: arm64: use __kernel_text_address to replace kthread_return_to_user

We don't need to use kthread_return_to_user to tell unwind it is kernel
thread, we can use __kernel_text_address, it is a normal way in other
arch like x86/ppc.
Signed-off-by: NZou Cao <zoucao@linux.alibaba.com>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 46ad7da7
...@@ -1064,17 +1064,15 @@ ENTRY(cpu_switch_to) ...@@ -1064,17 +1064,15 @@ ENTRY(cpu_switch_to)
ENDPROC(cpu_switch_to) ENDPROC(cpu_switch_to)
NOKPROBE(cpu_switch_to) NOKPROBE(cpu_switch_to)
.global kthread_return_to_user
/* /*
* This is how we return from a fork. * This is how we return from a fork.
*/ */
ENTRY(ret_from_fork) ENTRY(ret_from_fork)
bl schedule_tail bl schedule_tail
cbz x19, kthread_return_to_user // not a kernel thread cbz x19, 1f // not a kernel thread
mov x0, x20 mov x0, x20
blr x19 blr x19
kthread_return_to_user: 1: get_thread_info tsk
get_thread_info tsk
b ret_to_user b ret_to_user
ENDPROC(ret_from_fork) ENDPROC(ret_from_fork)
NOKPROBE(ret_from_fork) NOKPROBE(ret_from_fork)
......
...@@ -42,9 +42,6 @@ ...@@ -42,9 +42,6 @@
* add sp, sp, #0x10 * add sp, sp, #0x10
*/ */
/* The bottom of kernel thread stacks points there */
extern void *kthread_return_to_user;
/* /*
* unwind_frame -- unwind a single stack frame. * unwind_frame -- unwind a single stack frame.
* Returns 0 when there are more frames to go. * Returns 0 when there are more frames to go.
...@@ -85,20 +82,14 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) ...@@ -85,20 +82,14 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
} }
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
/*
* kthreads created via copy_thread() (called from kthread_create())
* will have a zero BP and a return value into ret_from_fork.
*/
if (!frame->fp && frame->pc == (unsigned long)&kthread_return_to_user)
return 1;
/* /*
* Frames created upon entry from EL0 have NULL FP and PC values, so * Frames created upon entry from EL0 have NULL FP and PC values, so
* don't bother reporting these. Frames created by __noreturn functions * don't bother reporting these. Frames created by __noreturn functions
* might have a valid FP even if PC is bogus, so only terminate where * might have a valid FP even if PC is bogus, so terminate where
* both are NULL. * both are NULL, check the kthread stack, it also has a zero BP
*/ */
if (!frame->fp && !frame->pc) if (!frame->fp && (!frame->pc ||
__kernel_text_address(frame->pc)))
return 1; return 1;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册