From 35af02fe3d8932fb52fbdf222a25879ee493fcff Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Thu, 28 Oct 2021 12:58:02 -0700 Subject: [PATCH] arch/arm64: Add hook for CONFIG_SCHED_THREAD_USAGE accounting in ISRs Call into z_thread_usage_stop() before ISR entry to avoid including interrupt handling totals in thread usage stats. This is pretty much exactly where we want it, just after the context saving steps (which we can't elide since the hook is in C) and immediately before the tracing hook for ISR entry. And as I'm reading the code, this is purely for Zephyr-registered interrupts, meaning that software exceptions will be accounted for (correctly) as part of the excepting thread. Signed-off-by: Andy Ross --- arch/arm64/core/isr_wrapper.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/core/isr_wrapper.S b/arch/arm64/core/isr_wrapper.S index d823ff03416..867f5156b28 100644 --- a/arch/arm64/core/isr_wrapper.S +++ b/arch/arm64/core/isr_wrapper.S @@ -35,6 +35,10 @@ SECTION_FUNC(TEXT, _isr_wrapper) /* ++(_kernel->nested) to be checked by arch_is_in_isr() */ inc_nest_counter x0, x1 +#ifdef CONFIG_SCHED_THREAD_USAGE + bl z_sched_usage_stop +#endif + #ifdef CONFIG_TRACING bl sys_trace_isr_enter #endif