From cb7c6b3d6767335d13892451c141cfb717807712 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Wed, 25 Jan 2023 20:21:40 +0100 Subject: Use mfence instead of lfence for memory barrier --- Makefile | 2 +- cachepc/cachepc.c | 4 +++- cachepc/macro.S | 4 ++-- cachepc/uapi.h | 1 + linux | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a223b0a..c54743e 100755 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ load: prep: sudo sh -c "echo 0 > /proc/sys/kernel/watchdog" sudo cpupower frequency-set -d 3.7GHz -u 3.7GHz - sudo sh -c "echo 1 > /proc/irq/127/smp_affinity" + sudo bash -c "for f in /proc/irq/*/smp_affinity; do echo 1 > \$$f 2>/dev/null; done" util/%: util/%.c $(CACHEPC_UAPI) diff --git a/cachepc/cachepc.c b/cachepc/cachepc.c index 9aa2aa5..8a00ef1 100644 --- a/cachepc/cachepc.c +++ b/cachepc/cachepc.c @@ -161,7 +161,9 @@ cachepc_save_msrmts(struct cacheline *head) do { if (cl->first) { BUG_ON(cl->cache_set >= L1_SETS); - WARN_ON(cl->count > L1_ASSOC); + if (cl->count > L1_ASSOC) + CPC_ERR("Read count %llu for set %u line %u", + cl->count, cl->cache_set, cl->cache_line); cachepc_msrmts[cl->cache_set] = cl->count; } else { BUG_ON(cl->count != 0); diff --git a/cachepc/macro.S b/cachepc/macro.S index 0025b0d..45a8121 100644 --- a/cachepc/macro.S +++ b/cachepc/macro.S @@ -2,8 +2,8 @@ # clobbers rax, rbx, rcx, rdx .macro barrier - lfence # memory barrier - rdtsc # compiler barrier + mfence # memory barrier + rdtsc # serializing .endm # clobbers rax, rbx, rcx, rdx, (out) diff --git a/cachepc/uapi.h b/cachepc/uapi.h index 98898b8..04acf25 100644 --- a/cachepc/uapi.h +++ b/cachepc/uapi.h @@ -55,6 +55,7 @@ enum { CPC_TRACK_FAULT_NO_RUN, CPC_TRACK_EXEC, CPC_TRACK_FULL, + CPC_TRACK_AUTO_FULL, }; struct cpc_track_config { diff --git a/linux b/linux index af02fe2..eb72c0f 160000 --- a/linux +++ b/linux @@ -1 +1 @@ -Subproject commit af02fe2bb56116a018cf5d4838690224d3e25898 +Subproject commit eb72c0f78ddce1c340f2407a6f1fbcd511a05bb5 -- cgit v1.2.3-71-gd317