Skip to content

Commit c7e6d79

Browse files
committed
ARC: entry.S: move some code around for cache locality in return path
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 6d1a20b commit c7e6d79

2 files changed

Lines changed: 52 additions & 48 deletions

File tree

‎arch/arc/kernel/entry-compact.S‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,5 @@ not_level1_interrupt:
391391
EXCEPTION_EPILOGUE
392392
debug_marker_syscall:
393393
rtie
394+
395+
END(ret_from_exception)

‎arch/arc/kernel/entry.S‎

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,55 @@
2424
*------------------------------------------------------------------
2525
*/
2626

27+
;################### Special Sys Call Wrappers ##########################
28+
29+
ENTRY(sys_clone_wrapper)
30+
SAVE_CALLEE_SAVED_USER
31+
bl @sys_clone
32+
DISCARD_CALLEE_SAVED_USER
33+
34+
GET_CURR_THR_INFO_FLAGS r10
35+
btst r10, TIF_SYSCALL_TRACE
36+
bnz tracesys_exit
37+
38+
b ret_from_system_call
39+
END(sys_clone_wrapper)
40+
41+
ENTRY(ret_from_fork)
42+
; when the forked child comes here from the __switch_to function
43+
; r0 has the last task pointer.
44+
; put last task in scheduler queue
45+
bl @schedule_tail
46+
47+
ld r9, [sp, PT_status32]
48+
brne r9, 0, 1f
49+
50+
jl.d [r14] ; kernel thread entry point
51+
mov r0, r13 ; (see PF_KTHREAD block in copy_thread)
52+
53+
1:
54+
; Return to user space
55+
; 1. Any forked task (Reach here via BRne above)
56+
; 2. First ever init task (Reach here via return from JL above)
57+
; This is the historic "kernel_execve" use-case, to return to init
58+
; user mode, in a round about way since that is always done from
59+
; a kernel thread which is executed via JL above but always returns
60+
; out whenever kernel_execve (now inline do_fork()) is involved
61+
b ret_from_exception
62+
END(ret_from_fork)
63+
64+
#ifdef CONFIG_ARC_DW2_UNWIND
65+
; Workaround for bug 94179 (STAR ):
66+
; Despite -fasynchronous-unwind-tables, linker is not making dwarf2 unwinder
67+
; section (.debug_frame) as loadable. So we force it here.
68+
; This also fixes STAR 9000487933 where the prev-workaround (objcopy --setflag)
69+
; would not work after a clean build due to kernel build system dependencies.
70+
.section .debug_frame, "wa",@progbits
71+
72+
; Reset to .text as this file is included in entry-<isa>.S
73+
.section .text, "ax",@progbits
74+
#endif
75+
2776
;################### Non TLB Exception Handling #############################
2877

2978
; ---------------------------------------------
@@ -338,53 +387,6 @@ resume_kernel_mode:
338387
#endif
339388

340389
b .Lrestore_regs
341-
END(ret_from_exception)
342-
343-
ENTRY(ret_from_fork)
344-
; when the forked child comes here from the __switch_to function
345-
; r0 has the last task pointer.
346-
; put last task in scheduler queue
347-
bl @schedule_tail
348-
349-
ld r9, [sp, PT_status32]
350-
brne r9, 0, 1f
351-
352-
jl.d [r14] ; kernel thread entry point
353-
mov r0, r13 ; (see PF_KTHREAD block in copy_thread)
354-
355-
1:
356-
; Return to user space
357-
; 1. Any forked task (Reach here via BRne above)
358-
; 2. First ever init task (Reach here via return from JL above)
359-
; This is the historic "kernel_execve" use-case, to return to init
360-
; user mode, in a round about way since that is always done from
361-
; a kernel thread which is executed via JL above but always returns
362-
; out whenever kernel_execve (now inline do_fork()) is involved
363-
b ret_from_exception
364-
END(ret_from_fork)
365390

366-
;################### Special Sys Call Wrappers ##########################
367-
368-
ENTRY(sys_clone_wrapper)
369-
SAVE_CALLEE_SAVED_USER
370-
bl @sys_clone
371-
DISCARD_CALLEE_SAVED_USER
372-
373-
GET_CURR_THR_INFO_FLAGS r10
374-
btst r10, TIF_SYSCALL_TRACE
375-
bnz tracesys_exit
376-
377-
b ret_from_system_call
378-
END(sys_clone_wrapper)
379-
380-
#ifdef CONFIG_ARC_DW2_UNWIND
381-
; Workaround for bug 94179 (STAR ):
382-
; Despite -fasynchronous-unwind-tables, linker is not making dwarf2 unwinder
383-
; section (.debug_frame) as loadable. So we force it here.
384-
; This also fixes STAR 9000487933 where the prev-workaround (objcopy --setflag)
385-
; would not work after a clean build due to kernel build system dependencies.
386-
.section .debug_frame, "wa",@progbits
391+
##### DONT ADD CODE HERE - .Lrestore_regs actually follows in entry-<isa>.S
387392

388-
; Reset to .text as this file is included in entry-<isa>.S
389-
.section .text, "ax",@progbits
390-
#endif

0 commit comments

Comments
 (0)