提交 8e8cf826 编写于 作者: S Suzuki K Poulose 提交者: Chen Jun

coresight: tmc-etr: Fix barrier packet insertion for perf buffer

stable inclusion
from stable-5.10.3
commit cda539d024c85b80000d0bc037c65eaf034890f0
bugzilla: 46871

--------------------------------

commit 83be0b84 upstream.

When the ETR is used in perf mode with a larger buffer (configured
via sysfs or the default size of 1M) than the perf aux buffer size,
we end up inserting the barrier packet at the wrong offset, while
moving the offset forward. i.e, instead of the "new moved offset",
we insert it at the current hardware buffer offset. These packets
will not be visible as they are never copied and could lead to
corruption in the trace decoding side, as the decoder is not aware
that it needs to reset the decoding.

Fixes: ec13c78d ("coresight: tmc-etr: Add barrier packets when moving offset forward")
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: stable@vger.kernel.org
Reported-by: NAl Grant <al.grant@arm.com>
Tested-by: NMike Leach <mike.leach@arm.com>
Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20201208182651.1597945-2-mathieu.poirier@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
上级 f94e2c94
...@@ -1552,7 +1552,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, ...@@ -1552,7 +1552,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev,
/* Insert barrier packets at the beginning, if there was an overflow */ /* Insert barrier packets at the beginning, if there was an overflow */
if (lost) if (lost)
tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); tmc_etr_buf_insert_barrier_packet(etr_buf, offset);
tmc_etr_sync_perf_buffer(etr_perf, offset, size); tmc_etr_sync_perf_buffer(etr_perf, offset, size);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册