From 23fc2cd7f185fdb2eb17fe73ff41c4a0141336a7 Mon Sep 17 00:00:00 2001 From: James Yang <46021128+jty2@users.noreply.github.com> Date: Tue, 19 Oct 2021 03:42:43 +0000 Subject: [PATCH] lockhammer/prefetch64: do not dereference lock pointer On aarch64, prefetch64() takes a pointer to the lock, but dereferences the pointer as the address to prefetch. Don't do that; it causes memory acceses to a random memory location. Instead, just pass the value of the pointer into the PRFM instruction. --- benchmarks/lockhammer/include/atomics.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/lockhammer/include/atomics.h b/benchmarks/lockhammer/include/atomics.h index c1ae409..8d3db7c 100644 --- a/benchmarks/lockhammer/include/atomics.h +++ b/benchmarks/lockhammer/include/atomics.h @@ -95,7 +95,7 @@ static inline void prefetch64 (unsigned long *ptr) { #if defined(__aarch64__) asm volatile(" prfm pstl1keep, %[ptr]\n" : - : [ptr] "Q" (*(unsigned long *)ptr)); + : [ptr] "Q" (ptr)); #endif }