tracing: swap: bug fix and enhancement for ARC

* Move switched_in into the arch context switch assembly code,
   which will correctly record the switched_in information.

* Add switched_in/switched_out for context switch in irq exit.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
This commit is contained in:
Watson Zeng 2020-09-23 15:03:03 +08:00 committed by Anas Nashif
parent 4da6a5bceb
commit d9dad9859d
4 changed files with 49 additions and 1 deletions

View File

@ -306,6 +306,16 @@ _firq_return_from_coop:
or.nz r0, r0, _ARC_V2_STATUS32_IE
sr r0, [_ARC_V2_STATUS32_P0]
#ifdef CONFIG_TRACING
push_s blink
push_s r2
bl sys_trace_thread_switched_in
pop_s r2
pop_s blink
#endif
ld r0, [r2, _thread_offset_to_return_value]
rtie
@ -319,6 +329,13 @@ _firq_return_from_firq:
sr ilink, [_ARC_V2_STATUS32_P0]
ld ilink, [sp, -8] /* pc into ilink */
#ifdef CONFIG_TRACING
push_s blink
bl sys_trace_thread_switched_in
pop_s blink
#endif
/* LP registers are already restored, just switch back to bank 0 */
rtie

View File

@ -255,6 +255,13 @@ _rirq_return_from_coop:
.balign 4
_rirq_return_from_firq:
_rirq_return_from_rirq:
#ifdef CONFIG_TRACING
push_s blink
bl sys_trace_thread_switched_in
pop_s blink
#endif
_rirq_no_reschedule:
rtie

View File

@ -176,6 +176,16 @@ return_loc:
pop_s r3 /* status32 into r3 */
kflag r3 /* write status32 */
#ifdef CONFIG_TRACING
push_s blink
push_s r1
bl sys_trace_thread_switched_in
pop_s r1
pop_s blink
#endif
j_s.d [blink] /* always execute delay slot */
seti r1 /* delay slot */
@ -206,6 +216,13 @@ _swap_return_from_firq:
sr r3, [_ARC_V2_AUX_IRQ_ACT]
_swap_already_in_irq:
#ifdef CONFIG_TRACING
push_s blink
bl sys_trace_thread_switched_in
pop_s blink
#endif
rtie
.balign 4
@ -226,6 +243,13 @@ _return_from_exc:
sr ilink, [_ARC_V2_ERSTATUS]
add_s sp, sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET + 4
#ifdef CONFIG_TRACING
push_s blink
bl sys_trace_thread_switched_in
pop_s blink
#endif
rtie

View File

@ -126,7 +126,7 @@ static inline int z_swap_irqlock(unsigned int key)
#endif
#endif
ret = __swap(key);
#ifndef CONFIG_ARM
#if !defined(CONFIG_ARM) && !defined(CONFIG_ARC)
#ifdef CONFIG_TRACING
sys_trace_thread_switched_in();
#endif