OSDN Git Service

perf/x86: Add compiler barrier after updating BTS
authorLeo Yan <leo.yan@linaro.org>
Mon, 9 Aug 2021 11:14:02 +0000 (19:14 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 17 Sep 2021 13:08:38 +0000 (15:08 +0200)
Since BTS is coherent, simply add a compiler barrier to separate the BTS
update and aux_head store.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210809111407.596077-5-leo.yan@linaro.org
arch/x86/events/intel/bts.c

index 6320d2c..974e917 100644 (file)
@@ -209,6 +209,12 @@ static void bts_update(struct bts_ctx *bts)
        } else {
                local_set(&buf->data_size, head);
        }
+
+       /*
+        * Since BTS is coherent, just add compiler barrier to ensure
+        * BTS updating is ordered against bts::handle::event.
+        */
+       barrier();
 }
 
 static int