2019-08-23 14:53:44

by Mathieu Poirier

[permalink] [raw]
Subject: [PATCH 0/2] coresight: Add barrier packet when moving offset forward

Hi Yabin,

When doing more tests on your patch that adjust the offset to fit the
available space in the perf ring buffer[1], I noticed the decoder wasn't
able to decode the traces that had been collected. The issue was observed
in CPU wide scenarios but I also suspect they would have showed up in
per-thread mode given the right conditions.

I traced the problem to the moving forward of the offset in the trace
buffer. Doing so skips over the barrier packets originally inserted in
function tmc_sync_etr_buf(), which in turn prevents the decoder from
properly synchronising with the trace packets.

I fixed the condition by inserting barrier packets once the offset has been
moved forward, making sure that alignment rules are respected.

I'd be grateful if you could review and test my changes to make sure things
still work on your side.

Applies cleanly on the coresight next branch.

Best regards,
Mathieu

[1]. https://lkml.org/lkml/2019/8/14/1336


Mathieu Poirier (2):
coresight: tmc: Make memory width mask computation into a function
coresight: tmc-etr: Add barrier packet when moving offset forward

.../hwtracing/coresight/coresight-tmc-etf.c | 23 +---------
.../hwtracing/coresight/coresight-tmc-etr.c | 43 ++++++++++++++-----
drivers/hwtracing/coresight/coresight-tmc.c | 28 ++++++++++++
drivers/hwtracing/coresight/coresight-tmc.h | 1 +
4 files changed, 64 insertions(+), 31 deletions(-)

--
2.17.1


2019-08-24 00:31:20

by Yabin Cui

[permalink] [raw]
Subject: Re: [PATCH 0/2] coresight: Add barrier packet when moving offset forward

Thanks for fixing this problem. I didn't realize it because I usually use a
buffer size >= the default ETR buffer size, which is harder to reproduce the
problem.
The patches LGTM, maybe you also want to fix the problem commented by Leo Yan.
I tested the patches by recording etm data with a buffer size smaller than the
default ETR buffer size. Then I saw barrier packets when decoding with OpenCSD.
And I could decode successfully without error message.

2019-08-26 15:40:41

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH 0/2] coresight: Add barrier packet when moving offset forward

Hi Yabin,

On Fri, 23 Aug 2019 at 18:30, Yabin Cui <[email protected]> wrote:
>
> Thanks for fixing this problem. I didn't realize it because I usually use a
> buffer size >= the default ETR buffer size, which is harder to reproduce the
> problem.
> The patches LGTM, maybe you also want to fix the problem commented by Leo Yan.

I will look into the issue reported by Leo later today.

> I tested the patches by recording etm data with a buffer size smaller than the
> default ETR buffer size. Then I saw barrier packets when decoding with OpenCSD.
> And I could decode successfully without error message.

Can I add your Tested-by ?

2019-08-26 19:12:01

by Yabin Cui

[permalink] [raw]
Subject: Re: [PATCH 0/2] coresight: Add barrier packet when moving offset forward

> Can I add your Tested-by ?

Yes. I just sent a tested-by reply, but not sure if it works. I am not very familar
with linux kernel review system.