From 41e97c6393f078c8919b13a5b0fc05c05d9aa7dd Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 22 Jul 2021 13:22:12 -0700 Subject: [PATCH] x86: pin timer related get functions Both arch_k_cycle_get_32() and z_tsc_read() are marked inline. However, compiler may decide not to inline them which would put them in the generic text section. Pin them in physical memory as they are frequently used functions to avoid page fault costs. Signed-off-by: Daniel Leung --- include/arch/x86/arch.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/arch/x86/arch.h b/include/arch/x86/arch.h index b395c56d158..95d956dae1d 100644 --- a/include/arch/x86/arch.h +++ b/include/arch/x86/arch.h @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -248,6 +249,7 @@ extern void arch_irq_disable(unsigned int irq); extern uint32_t sys_clock_cycle_get_32(void); +__pinned_func static inline uint32_t arch_k_cycle_get_32(void) { return sys_clock_cycle_get_32(); @@ -275,6 +277,7 @@ static ALWAYS_INLINE uint32_t z_do_read_cpu_timestamp32(void) * @brief read timestamp register ensuring serialization */ +__pinned_func static inline uint64_t z_tsc_read(void) { union {