From aa5d45d7cc8373c3d5d123163fb5ae55e288c15a Mon Sep 17 00:00:00 2001 From: Wentong Wu Date: Tue, 28 Jan 2020 16:44:59 +0800 Subject: [PATCH] tracing: add TRACING_ISR Kconfig Add TRACING_ISR Kconfig to help high latency backend working well. Currently the ISR tracing hook function is put at the begining and ending of ISR wrapper, when there is ISR needed in the tracing path (especially tracing backend), it will cause tracing buffer easily be exhausted if async tracing method enabled. Also it will increase system latency if all the ISRs are traced. So add TRACING_ISR to enable/disable ISR tracing here. Later a filter out mechanism based on irq number will be added. Signed-off-by: Wentong Wu --- arch/arm/core/aarch32/isr_wrapper.S | 4 ++-- arch/nios2/core/irq_manage.c | 4 ++++ arch/riscv/core/isr.S | 2 +- arch/x86/core/ia32/intstub.S | 2 +- subsys/debug/Kconfig | 6 ++++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/aarch32/isr_wrapper.S b/arch/arm/core/aarch32/isr_wrapper.S index 3491fcfc31d..4aa3049c725 100644 --- a/arch/arm/core/aarch32/isr_wrapper.S +++ b/arch/arm/core/aarch32/isr_wrapper.S @@ -64,7 +64,7 @@ SECTION_FUNC(TEXT, _isr_wrapper) bl read_timer_start_of_isr #endif -#ifdef CONFIG_TRACING +#ifdef CONFIG_TRACING_ISR bl sys_trace_isr_enter #endif @@ -162,7 +162,7 @@ _idle_state_cleared: #endif /* CONFIG_EXECUTION_BENCHMARKING */ blx r3 /* call ISR */ -#ifdef CONFIG_TRACING +#ifdef CONFIG_TRACING_ISR bl sys_trace_isr_exit #endif diff --git a/arch/nios2/core/irq_manage.c b/arch/nios2/core/irq_manage.c index cfffba82d39..cd0ee540e8d 100644 --- a/arch/nios2/core/irq_manage.c +++ b/arch/nios2/core/irq_manage.c @@ -87,7 +87,9 @@ void _enter_irq(u32_t ipending) while (ipending) { struct _isr_table_entry *ite; +#ifdef CONFIG_TRACING_ISR sys_trace_isr_enter(); +#endif index = find_lsb_set(ipending) - 1; ipending &= ~BIT(index); @@ -99,7 +101,9 @@ void _enter_irq(u32_t ipending) read_timer_end_of_isr(); #endif ite->isr(ite->arg); +#ifdef CONFIG_TRACING_ISR sys_trace_isr_exit(); +#endif } _kernel.nested--; diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index e8b7ef4e04b..b0a61ef3669 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -228,7 +228,7 @@ on_irq_stack: call_irq: #endif /* CONFIG_IRQ_OFFLOAD */ -#ifdef CONFIG_TRACING +#ifdef CONFIG_TRACING_ISR call sys_trace_isr_enter #endif diff --git a/arch/x86/core/ia32/intstub.S b/arch/x86/core/ia32/intstub.S index 3272bfb3c68..2cb4bf72e0b 100644 --- a/arch/x86/core/ia32/intstub.S +++ b/arch/x86/core/ia32/intstub.S @@ -130,7 +130,7 @@ SECTION_FUNC(TEXT, _interrupt_enter) pushl %edi -#if defined(CONFIG_TRACING) +#if defined(CONFIG_TRACING_ISR) /* Save these as we are using to keep track of isr and isr_param */ pushl %eax diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index 6b5b66e7b8f..1b0460ff9a6 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -158,6 +158,12 @@ config TRACING_CMD_BUFFER_SIZE help Size of tracing command buffer. +config TRACING_ISR + bool "Enabling Tracing ISR" + help + Enable tracing ISR. This requires the backend to be + very low-latency. + endif config ASAN