UPSTREAM: coresight: tmc-etr: Add barrier after updating AUX ring buffer

Since a memory barrier is required between AUX trace data store and
aux_head store, and the AUX trace data is filled with memcpy(), it's
sufficient to use smp_wmb() so can ensure the trace data is visible
prior to updating aux_head.

Bug: 213931796
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20210809111407.596077-3-leo.yan@linaro.org
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
(cherry picked from commit 26701ceb4c2c6bfa5f8c8984fa1a1ea08fa0f02c)
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Change-Id: I99ae5605d18d6c9c1a908f79611a464b3c17fc2f
This commit is contained in:
Leo Yan
2021-08-09 19:14:00 +08:00
committed by Todd Kjos
parent a0009ade38
commit aee6af7046

View File

@@ -1563,6 +1563,14 @@ tmc_update_etr_buffer(struct coresight_device *csdev,
*/
if (etr_perf->snapshot)
handle->head += size;
/*
* Ensure that the AUX trace data is visible before the aux_head
* is updated via perf_aux_output_end(), as expected by the
* perf ring buffer.
*/
smp_wmb();
out:
/*
* Don't set the TRUNCATED flag in snapshot mode because 1) the