mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
UPSTREAM: coresight: perf: Don't set the truncated flag in snapshot mode
(Upstream commit 5aafd9bf7a).
This patch avoids setting the truncated flag when operating in snapshot
mode since the trace buffer is expected to be truncated and discontinuous
from one snapshot to another. Moreover when the truncated flag is set
the perf core stops enabling the event, waiting for user space to consume
the data. In snapshot mode this is clearly not what we want since it
results in stale data.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 140266694
Change-Id: I3b92c2c023e0af47f1e0d3743e8feb23e5cff212
Signed-off-by: Yabin Cui <yabinc@google.com>
This commit is contained in:
committed by
Yabin Cui
parent
c419f1d2c8
commit
a656047aed
@@ -489,7 +489,13 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev,
|
||||
lost = true;
|
||||
}
|
||||
|
||||
if (lost)
|
||||
/*
|
||||
* Don't set the TRUNCATED flag in snapshot mode because 1) the
|
||||
* captured buffer is expected to be truncated and 2) a full buffer
|
||||
* prevents the event from being re-enabled by the perf core,
|
||||
* resulting in stale data being send to user space.
|
||||
*/
|
||||
if (!buf->snapshot && lost)
|
||||
perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
|
||||
|
||||
/* finally tell HW where we want to start reading from */
|
||||
|
||||
@@ -492,7 +492,13 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev,
|
||||
lost = true;
|
||||
}
|
||||
|
||||
if (lost)
|
||||
/*
|
||||
* Don't set the TRUNCATED flag in snapshot mode because 1) the
|
||||
* captured buffer is expected to be truncated and 2) a full buffer
|
||||
* prevents the event from being re-enabled by the perf core,
|
||||
* resulting in stale data being send to user space.
|
||||
*/
|
||||
if (!buf->snapshot && lost)
|
||||
perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
|
||||
|
||||
cur = buf->cur;
|
||||
|
||||
@@ -1511,7 +1511,13 @@ tmc_update_etr_buffer(struct coresight_device *csdev,
|
||||
|
||||
lost |= etr_buf->full;
|
||||
out:
|
||||
if (lost)
|
||||
/*
|
||||
* Don't set the TRUNCATED flag in snapshot mode because 1) the
|
||||
* captured buffer is expected to be truncated and 2) a full buffer
|
||||
* prevents the event from being re-enabled by the perf core,
|
||||
* resulting in stale data being send to user space.
|
||||
*/
|
||||
if (!etr_perf->snapshot && lost)
|
||||
perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED);
|
||||
return size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user