aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Leach <mike.leach@linaro.org>2022-02-09 12:34:32 +0000
committerMike Leach <mike.leach@linaro.org>2022-02-09 12:34:32 +0000
commit3fecfb03fbbf91d6e1aa0337400ea6a3bf6a7b42 (patch)
treeeb5f0981c4d0abeaa206aae87694598f75989c47
parentdb97bbcc2015b8b4a9a0194961ca4223097d8958 (diff)
downloadOpenCSD-3fecfb03fbbf91d6e1aa0337400ea6a3bf6a7b42.tar.gz
opencsd: etm4x: Update etm4x / ete decoder to flush context to client immediately.
Handling for speculative trace added caching of trace elements to be committed cancelled. This results in elements being output in blocks on commit. This introduced an issue where a context element could change a context, but not be output to the client, before subsequent atoms were processed, and memory accesses to the client could occur without the new context being seen. This could result in the incorrect memory being served from the client to the decoder, resulting in decode issues.
-rw-r--r--decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
index 015a2f5..87f7f43 100644
--- a/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
+++ b/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp
@@ -664,14 +664,18 @@ ocsd_datapath_resp_t TrcPktDecodeEtmV4I::resolveElements()
if (m_elem_res.P0_commit)
err = commitElements();
- if (!err && m_elem_res.P0_cancel)
- err = cancelElements();
+ // allow for early flush on context element
+ if (!m_elem_res.P0_commit) {
- if (!err && m_elem_res.mispredict)
- err = mispredictAtom();
-
- if (!err && m_elem_res.discard)
- err = discardElements();
+ if (!err && m_elem_res.P0_cancel)
+ err = cancelElements();
+
+ if (!err && m_elem_res.mispredict)
+ err = mispredictAtom();
+
+ if (!err && m_elem_res.discard)
+ err = discardElements();
+ }
if (err != OCSD_OK)
resp = OCSD_RESP_FATAL_INVALID_DATA;
@@ -706,10 +710,11 @@ ocsd_err_t TrcPktDecodeEtmV4I::commitElements()
int num_commit_req = m_elem_res.P0_commit;
ocsd_trc_index_t err_idx = 0;
TrcStackElem *pElem = 0; // stacked element pointer
+ bool contextFlush = false;
err = m_out_elem.resetElemStack();
- while(m_elem_res.P0_commit && !err)
+ while(m_elem_res.P0_commit && !err && !contextFlush)
{
if (m_P0_stack.size() > 0)
{
@@ -751,8 +756,17 @@ ocsd_err_t TrcPktDecodeEtmV4I::commitElements()
if(ctxt.updated)
{
err = m_out_elem.addElem(pElem->getRootIndex());
- if (!err)
+ if (!err) {
updateContext(pCtxtElem, outElem());
+
+ // updated context - need to force this to be output to the client so correct memory
+ // context can be used.
+ contextFlush = true;
+
+ // invalidate memory accessor cacheing - force next memory access out to client to
+ // ensure that the correct memory context is in play when decoding subsequent atoms.
+ invalidateMemAccCache();
+ }
}
}
}