Re: [PATCH] coresight: tmc-etr: Remove perf_data check.

From: Suzuki K Poulose
Date: Fri Aug 09 2019 - 05:22:11 EST


Hi Yabin,


Thank you for the analysis and the patch.

On 08/08/2019 20:31, Yabin Cui wrote:
When tracing etm data of multiple threads on multiple cpus through
perf interface, each cpu has a unique etr_perf_buffer while sharing
the same etr device. There is no guarantee that the last cpu starts
etm tracing also stops last. So the perf_data check is no longer valid.

Signed-off-by: Yabin Cui <yabinc@xxxxxxxxxx>
---
drivers/hwtracing/coresight/coresight-tmc-etr.c | 9 ---------
drivers/hwtracing/coresight/coresight-tmc.h | 2 --
2 files changed, 11 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index 17006705287a..0418440e0141 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -1484,20 +1484,12 @@ tmc_update_etr_buffer(struct coresight_device *csdev,
goto out;
}
- if (WARN_ON(drvdata->perf_data != etr_perf)) {
- lost = true;
- spin_unlock_irqrestore(&drvdata->spinlock, flags);
- goto out;
- }
-

I think some sort of sanity check is a good idea to make sure we don't loose the
context. Even when different CPUs have different etr_perf buffer, the underlying
etr_buf should be the same. So, we should be able to simply convert the check
to, something like :

struct etr_perf_buffer *perf_buf = drvdata->perf_data;

...

if (WARN_ON(perf_buf->etr_buf != etr_perf->buf)) {
....
}

Does that solve the problem for you ?

Suzuki