arm64: entry: add END/ENDPROC markers to *.S files
PATCH 1/1 arm64: entry: add END/ENDPROC markers to *.S files
From: Eugene Loh <[email protected]>
Add END/ENDPROC markers to *.S files so that assembly instructions can be mapped to symbols.
Orabug: 28143715
--- arch/arm64/kernel/entry.S | 6 +++++- arch/arm64/kvm/hyp/hyp-entry.S | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
arch/arm64/kernel/entry.S +5 -1
@@ -456,6 +456,7 @@ __bad_stack: /* Time to die */ bl handle_bad_stack ASM_BUG() +END(__bad_stack) #endif /* CONFIG_VMAP_STACK */ /*
@@ -622,6 +623,7 @@ el1_preempt: ldr x0, [tsk, #TSK_TI_FLAGS] // get new tasks TI_FLAGS tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling? ret x24 +END(el1_preempt) #endif /*
@@ -886,6 +888,7 @@ ret_fast_syscall: ret_fast_syscall_trace: enable_irq // enable interrupts b __sys_trace_return_skipped // we already saved x0 +END(ret_fast_syscall) /* * Ok, we need to do extra processing, enter the slow path.
@@ -898,6 +901,7 @@ work_pending: #endif ldr x1, [tsk, #TSK_TI_FLAGS] // re-check for single-step b finish_ret_to_user +END(work_pending) /* * "slow" syscall return path. */
@@ -958,7 +962,6 @@ ni_sys: mov x0, sp bl do_ni_syscall b ret_fast_syscall -ENDPROC(el0_svc) /* * This is the really slow path. We're going to be doing context
@@ -995,6 +998,7 @@ __ni_sys_trace: mov x0, sp bl do_ni_syscall b __sys_trace_return +ENDPROC(el0_svc) .popsection // .entry.text
arch/arm64/kvm/hyp/hyp-entry.S +6 -0
@@ -101,6 +101,7 @@ alternative_endif do_el2_call eret +ENDPROC(el1_sync) el1_hvc_guest: /*
@@ -115,6 +116,7 @@ el1_hvc_guest: mov x0, x1 add sp, sp, #16 eret +ENDPROC(el1_hvc_guest) el1_trap: /*
@@ -135,18 +137,21 @@ alternative_else_nop_endif mov x0, #ARM_EXCEPTION_TRAP b __guest_exit +ENDPROC(el1_trap) el1_irq: stp x0, x1, [sp, #-16]! ldr x1, [sp, #16 + 8] mov x0, #ARM_EXCEPTION_IRQ b __guest_exit +ENDPROC(el1_irq) el1_error: stp x0, x1, [sp, #-16]! ldr x1, [sp, #16 + 8] mov x0, #ARM_EXCEPTION_EL1_SERROR b __guest_exit +ENDPROC(el1_error) el2_error: /*
@@ -169,6 +174,7 @@ el2_error: b.ne __hyp_panic mov x0, #(1 << ARM_EXIT_WITH_SERROR_BIT) eret +ENDPROC(el2_error) ENTRY(__hyp_do_panic) mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\
Signature · 1 line
1.8.3.1
Mark Rutland
reviewerPATCH 1/1 arm64: entry: add END/ENDPROC markers to *.S files
Hi,
Quoted 4 lines · eugene.loh at oracle.com
From: Eugene Loh <[email protected]>
Add END/ENDPROC markers to *.S files so that assembly instructions can be mapped to symbols.
Is this just for external debug, or does anything in-kernel rely on this?
Quoted 22 lines
Signed-off-by Eugene Loh <[email protected]>Reviewed-by Rob Gardner <[email protected]>Orabug: 28143715
--- arch/arm64/kernel/entry.S | 6 +++++- arch/arm64/kvm/hyp/hyp-entry.S | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-)arch/arm64/kernel/entry.S +1
-0@@ -456,6 +456,7 @@ __bad_stack: /* Time to die */ bl handle_bad_stack ASM_BUG() +END(__bad_stack) #endif /* CONFIG_VMAP_STACK */ /*
arch/arm64/kernel/entry.S el1_preempt: · line 626
Quoted 4 lines
arch/arm64/kernel/entry.S +1
-0@@ -622,6 +623,7 @@ el1_preempt: ldr x0, [tsk, #TSK_TI_FLAGS] // get new tasks TI_FLAGS tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling? ret x24 +END(el1_preempt)
We treat el1_preempt like a subroutine (it gets called and returns), so END_PROC() would seem more sensible.
Quoted 28 lines
arch/arm64/kernel/entry.S +2
-1#endif /*@@ -886,6 +888,7 @@ ret_fast_syscall: ret_fast_syscall_trace: enable_irq // enable interrupts b __sys_trace_return_skipped // we already saved x0 +END(ret_fast_syscall) /* * Ok, we need to do extra processing, enter the slow path.@@ -898,6 +901,7 @@ work_pending: #endif ldr x1, [tsk, #TSK_TI_FLAGS] // re-check for single-step b finish_ret_to_user +END(work_pending) /* * "slow" syscall return path. */@@ -958,7 +962,6 @@ ni_sys: mov x0, sp bl do_ni_syscall b ret_fast_syscall -ENDPROC(el0_svc) /* * This is the really slow path. We're going to be doing context
arch/arm64/kernel/entry.S __ni_sys_trace: · line 1001
Quoted 4 lines
arch/arm64/kernel/entry.S +1
-0@@ -995,6 +998,7 @@ __ni_sys_trace: mov x0, sp bl do_ni_syscall b __sys_trace_return +ENDPROC(el0_svc)
I'm converting the syscall paths to C [1], which should address all of the above, except for work_pending.
I do hope to convert that in future along with the rest of the entry triage logic [2].
Thanks,
Mark.
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-June/582238.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/entry-deasm
PATCH 1/1 arm64: entry: add END/ENDPROC markers to *.S files
Thanks to Mark and Will for pointing me to Mark's work, which makes this patch unneeded.
A few more comments below in case anyone is interested.
Quoted 4 lines · Mark Rutland
Quoted 2 lines · eugene.loh at oracle.com
Add END/ENDPROC markers to *.S files so that assembly instructions can be mapped to symbols.
Is this just for external debug, or does anything in-kernel rely on this?
It was motivated by DTrace, which got symbolic information from "nm -S vmlinux".
Quoted 2 lines
I'm converting the syscall paths to C [1], which should address all of the above...
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-June/582238.html
Bingo. Thanks.
PATCH 1/1 arm64: entry: add END/ENDPROC markers to *.S files
In reply to eugene.loh at oracle.comHi Eugene,
Quoted 4 lines · eugene.loh at oracle.com
From: Eugene Loh <[email protected]>
Add END/ENDPROC markers to *.S files so that assembly instructions can be mapped to symbols.
Could you expand on the commid message please? Who's mapping what and how?
Quoted 4 lines
Signed-off-by Eugene Loh <[email protected]>Reviewed-by Rob Gardner <[email protected]>Orabug: 28143715
Please remove this line.
Quoted 2 lines
--- arch/arm64/kernel/entry.S | 6 +++++-
Please be aware that work is underway to rewrite much of entry.S in C, so it's not clear how relevant this patch will be. Take a look at:
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-June/582238.html
arch/arm64/kernel/entry.S __bad_stack: · line 459
Quoted 12 lines
arch/arm64/kvm/hyp/hyp-entry.S | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-)arch/arm64/kernel/entry.S +1
-0@@ -456,6 +456,7 @@ __bad_stack: /* Time to die */ bl handle_bad_stack ASM_BUG() +END(__bad_stack)
We should have a matching ENTRY for all END macros, I think.
Quoted 20 lines
arch/arm64/kernel/entry.S +2
-0#endif /* CONFIG_VMAP_STACK */ /*@@ -622,6 +623,7 @@ el1_preempt: ldr x0, [tsk, #TSK_TI_FLAGS] // get new tasks TI_FLAGS tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling? ret x24 +END(el1_preempt) #endif /*@@ -886,6 +888,7 @@ ret_fast_syscall: ret_fast_syscall_trace: enable_irq // enable interrupts b __sys_trace_return_skipped // we already saved x0 +END(ret_fast_syscall) /* * Ok, we need to do extra processing, enter the slow path.
arch/arm64/kernel/entry.S work_pending: · line 904
Quoted 4 lines
arch/arm64/kernel/entry.S +1
-0@@ -898,6 +901,7 @@ work_pending: #endif ldr x1, [tsk, #TSK_TI_FLAGS] // re-check for single-step b finish_ret_to_user +END(work_pending)
Hmm, I tend to thing of this exit code as a state machine with a bunch of labels, rather than as a set of functions. What exactly are you doing with the END annotations?
Will