From: Jens Axboe Date: Thu, 22 Sep 2022 16:03:51 +0000 (-0600) Subject: arm64: ensure CPU clock retrieval issues isb() X-Git-Tag: fio-3.33~36 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=0574e8c3b2b47e1e2564c2f50ea0b6f2629f2e48 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 --- 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; }