arch: arc: Added benchmark related hooks.
The benchmark application timing_info needs certain hooks to be present in the kernel to get the accurate measurements. This patch adds these hook at all the required locations. Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
parent
667ad04086
commit
db0c5ca08b
4 changed files with 145 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <sw_isr_table.h>
|
||||
#include <kernel_structs.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <swap_macros.h>
|
||||
|
||||
GTEXT(_isr_wrapper)
|
||||
GTEXT(_isr_demux)
|
||||
|
@ -229,6 +230,43 @@ From RIRQ:
|
|||
*/
|
||||
|
||||
SECTION_FUNC(TEXT, _isr_wrapper)
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
push_s r0
|
||||
push_s blink
|
||||
push_s r13
|
||||
push_s r12
|
||||
push r11
|
||||
push r10
|
||||
push r9
|
||||
push r8
|
||||
push r7
|
||||
push r6
|
||||
push r5
|
||||
push r4
|
||||
push_s r3
|
||||
push_s r2
|
||||
push_s r1
|
||||
|
||||
bl read_timer_start_of_isr
|
||||
|
||||
pop_s r1
|
||||
pop_s r2
|
||||
pop_s r3
|
||||
pop r4
|
||||
pop r5
|
||||
pop r6
|
||||
pop r7
|
||||
pop r8
|
||||
pop r9
|
||||
pop r10
|
||||
pop r11
|
||||
pop_s r12
|
||||
pop_s r13
|
||||
pop_s blink
|
||||
pop_s r0
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_ARC_FIRQ
|
||||
#if CONFIG_RGF_NUM_BANKS == 1
|
||||
st r0,[saved_r0]
|
||||
|
@ -288,6 +326,7 @@ rirq_path:
|
|||
j_s [r2]
|
||||
#endif
|
||||
#else
|
||||
|
||||
mov r3, _rirq_exit
|
||||
mov r2, _rirq_enter
|
||||
j_s [r2]
|
||||
|
@ -371,6 +410,42 @@ irq_hint_handled:
|
|||
add3 r0, r1, r0 /* table entries are 8-bytes wide */
|
||||
|
||||
ld_s r1, [r0, 4] /* ISR into r1 */
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
push_s r0
|
||||
push_s blink
|
||||
push_s r13
|
||||
push_s r12
|
||||
push r11
|
||||
push r10
|
||||
push r9
|
||||
push r8
|
||||
push r7
|
||||
push r6
|
||||
push r5
|
||||
push r4
|
||||
push_s r3
|
||||
push_s r2
|
||||
push_s r1
|
||||
|
||||
bl read_timer_end_of_isr
|
||||
|
||||
pop_s r1
|
||||
pop_s r2
|
||||
pop_s r3
|
||||
pop r4
|
||||
pop r5
|
||||
pop r6
|
||||
pop r7
|
||||
pop r8
|
||||
pop r9
|
||||
pop r10
|
||||
pop r11
|
||||
pop_s r12
|
||||
pop_s r13
|
||||
pop_s blink
|
||||
pop_s r0
|
||||
|
||||
#endif
|
||||
jl_s.d [r1]
|
||||
ld_s r0, [r0] /* delay slot: ISR parameter into r0 */
|
||||
|
||||
|
|
|
@ -61,6 +61,21 @@ GDATA(_kernel)
|
|||
|
||||
SECTION_FUNC(TEXT, __swap)
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_save_callee_saved_regs
|
||||
push_s r31
|
||||
|
||||
bl read_timer_start_of_swap
|
||||
|
||||
pop_s r31
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_load_callee_saved_regs
|
||||
st sp, [r2, _thread_offset_to_sp]
|
||||
#endif
|
||||
|
||||
/* interrupts are locked, interrupt key is in r0 */
|
||||
|
||||
mov r1, _kernel
|
||||
|
@ -144,6 +159,11 @@ _swap_return_from_coop:
|
|||
/* sflag instruction is not supported in current ARC GNU */
|
||||
.long 0x00ff302f
|
||||
#endif
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
b _capture_value_for_benchmarking
|
||||
#endif
|
||||
return_loc:
|
||||
|
||||
pop_s r3 /* status32 into r3 */
|
||||
kflag r3 /* write status32 */
|
||||
|
||||
|
@ -196,4 +216,24 @@ _return_from_exc:
|
|||
ld ilink, [sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET]
|
||||
sr ilink, [_ARC_V2_ERSTATUS]
|
||||
add_s sp, sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET + 4
|
||||
|
||||
rtie
|
||||
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
.balign 4
|
||||
_capture_value_for_benchmarking:
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_save_callee_saved_regs
|
||||
push_s blink
|
||||
|
||||
bl read_timer_end_of_swap
|
||||
|
||||
pop_s blink
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_load_callee_saved_regs
|
||||
st sp, [r2, _thread_offset_to_sp]
|
||||
b return_loc
|
||||
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
||||
|
|
|
@ -163,6 +163,11 @@ _arc_go_to_user_space:
|
|||
mov r30, 0
|
||||
mov blink, 0
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
b _capture_value_for_benchmarking_userspace
|
||||
return_loc_userspace_enter:
|
||||
#endif /* CONFIG_EXECUTION_BENCHMARKING */
|
||||
|
||||
rtie
|
||||
|
||||
/**
|
||||
|
@ -265,3 +270,20 @@ inc_len:
|
|||
/* increment length measurement, loop again */
|
||||
add_s r0, r0, 1
|
||||
b_s strlen_loop
|
||||
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
.balign 4
|
||||
_capture_value_for_benchmarking_userspace:
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_save_callee_saved_regs
|
||||
push_s blink
|
||||
|
||||
bl read_timer_end_of_userspace_enter
|
||||
|
||||
pop_s blink
|
||||
mov r1, _kernel
|
||||
ld_s r2, [r1, _kernel_offset_to_current]
|
||||
_load_callee_saved_regs
|
||||
b return_loc_userspace_enter
|
||||
#endif
|
||||
|
|
|
@ -185,6 +185,10 @@ static inline void program_max_cycles(void)
|
|||
*/
|
||||
void _timer_int_handler(void *unused)
|
||||
{
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
extern void read_timer_start_of_tick_handler(void);
|
||||
read_timer_start_of_tick_handler();
|
||||
#endif
|
||||
ARG_UNUSED(unused);
|
||||
/* clear the interrupt by writing 0 to IP bit of the control register */
|
||||
timer0_control_register_set(_ARC_V2_TMR_CTRL_NH | _ARC_V2_TMR_CTRL_IE);
|
||||
|
@ -230,6 +234,10 @@ void _timer_int_handler(void *unused)
|
|||
|
||||
update_accumulated_count();
|
||||
#endif
|
||||
#ifdef CONFIG_EXECUTION_BENCHMARKING
|
||||
extern void read_timer_end_of_tick_handler(void);
|
||||
read_timer_end_of_tick_handler();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TICKLESS_KERNEL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue