From 0574e8c3b2b47e1e2564c2f50ea0b6f2629f2e48 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 22 Sep 2022 10:03:51 -0600 Subject: [PATCH] arm64: ensure CPU clock retrieval issues isb() This prevents counter value speculation, which will otherwise cause issues with the CPU clock. Link: https://github.com/axboe/fio/issues/1472 Signed-off-by: Jens Axboe --- arch/arch-aarch64.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arch-aarch64.h b/arch/arch-aarch64.h index 951d1718..919e5796 100644 --- a/arch/arch-aarch64.h +++ b/arch/arch-aarch64.h @@ -27,10 +27,13 @@ static inline int arch_ffz(unsigned long bitmask) #define ARCH_HAVE_FFZ +#define isb() asm volatile("isb" : : : "memory") + static inline unsigned long long get_cpu_clock(void) { unsigned long val; + isb(); asm volatile("mrs %0, cntvct_el0" : "=r" (val)); return val; } -- 2.25.1