arch/x86_64: 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 has to go into the assembly immediately before the callback-based
dispatch.  Note that the dispatch code was putting the vector number
in RCX, which was unfortunate as that's a caller-saved register.
Would be nice to clean this up in the future so it lives in a
preserved register but it's mildly complicated to make work with the
way we do the stack layout right now.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2021-10-28 12:58:02 -07:00 committed by Anas Nashif
commit 1238410914

View file

@ -778,6 +778,11 @@ irq_enter_unnested: /* Not nested: dump state to thread struct for __resume */
#endif
irq_dispatch:
#ifdef CONFIG_SCHED_THREAD_USAGE
pushq %rcx
call z_sched_usage_stop
popq %rcx
#endif
movq x86_irq_funcs(,%rcx,8), %rax
movq x86_irq_args(,%rcx,8), %rdi
call *%rax