The following changes since commit 9af4af7ab40c4e505033d0e077cc42ac84996b09: ci: fix macOS sphinx install issues (2024-02-22 20:01:27 -0500) are available in the Git repository at: git://git.kernel.dk/fio.git master for you to fetch changes up to 5ae4f4220a48dddddc84c8b839ef9d8a1ed4edb1: gettime: fix cpuclock-test on AMD platforms (2024-02-27 12:36:45 -0500) ---------------------------------------------------------------- Vincent Fu (2): howto: fix job_start_clock_id formatting gettime: fix cpuclock-test on AMD platforms HOWTO.rst | 5 +++-- arch/arch-x86_64.h | 5 +++++ arch/arch.h | 7 +++++++ gettime.c | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) --- Diff of recent changes: diff --git a/HOWTO.rst b/HOWTO.rst index 4b02100c..169cdc2a 100644 --- a/HOWTO.rst +++ b/HOWTO.rst @@ -756,8 +756,9 @@ Time related parameters CPU mask of other jobs. .. option:: job_start_clock_id=int - The clock_id passed to the call to `clock_gettime` used to record job_start - in the `json` output format. Default is 0, or CLOCK_REALTIME. + + The clock_id passed to the call to `clock_gettime` used to record + job_start in the `json` output format. Default is 0, or CLOCK_REALTIME. Target file/device diff --git a/arch/arch-x86_64.h b/arch/arch-x86_64.h index 86ce1b7e..b402dc6d 100644 --- a/arch/arch-x86_64.h +++ b/arch/arch-x86_64.h @@ -26,6 +26,11 @@ static inline unsigned long arch_ffz(unsigned long bitmask) return bitmask; } +static inline void tsc_barrier(void) +{ + __asm__ __volatile__("mfence":::"memory"); +} + static inline unsigned long long get_cpu_clock(void) { unsigned int lo, hi; diff --git a/arch/arch.h b/arch/arch.h index 3ee9b053..7e294ddf 100644 --- a/arch/arch.h +++ b/arch/arch.h @@ -108,6 +108,13 @@ extern unsigned long arch_flags; #include "arch-generic.h" #endif +#if !defined(__x86_64__) && defined(CONFIG_SYNC_SYNC) +static inline void tsc_barrier(void) +{ + __sync_synchronize(); +} +#endif + #include "../lib/ffz.h" /* IWYU pragma: end_exports */ diff --git a/gettime.c b/gettime.c index bc66a3ac..5ca31206 100644 --- a/gettime.c +++ b/gettime.c @@ -623,7 +623,7 @@ static void *clock_thread_fn(void *data) seq = *t->seq; if (seq == UINT_MAX) break; - __sync_synchronize(); + tsc_barrier(); tsc = get_cpu_clock(); } while (seq != atomic32_compare_and_swap(t->seq, seq, seq + 1));