On 2/27/24 11:34, Jens Axboe wrote:
On 2/27/24 8:26 AM, Vincent Fu wrote:
Starting with gcc 11 __sync_synchronize() compiles to
lock or QWORD PTR [rsp], 0
on x86_64 platforms. Previously it compiled to an mfence instruction.
See line 47 of https://godbolt.org/z/xfE18K7b4 for an example.
On Intel platforms this change does not affect the result of fio's CPU
clock test. But on AMD platforms, this change causes fio's CPU clock
test to fail and fio to fall back to clock_gettime() instead of using
the CPU clock for timing.
This patch has fio explicitly use an mfence instruction instead of
__sync_synchornize() in the CPU clock test code on x86_64 platforms in
order to allow the CPU clock test to pass on AMD platforms.
Looks good:
Reviewed-by: Jens Axboe <axboe@xxxxxxxxx>
Applied. Thanks.