Skip to content

Commit 58ce6e6

Browse files
ujfalusilgirdwood
authored andcommitted
dma-trace: Preserve logs while dtrace is disabled
When the dma-trace is enabled (or re-enabled) the DMA channel is re-initialized, configured. The DMA will start reading data from the local buffer from the start (!!) it can not be configured to start reading from the point it is left off. Because of this, if the dtrace is disabled and re-enabled, the DMA will copy old log entries starting from the beginning of the local buffer. To be able to preserve the logs while the dtrace is disable we need to reset both read and write pointers on the local buffer and when the dtrace is again enabled we can transfer the logs from this point, without misaligned or missed logs. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 98ff79e commit 58ce6e6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/trace/dma-trace.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ int dma_trace_enable(struct dma_trace_data *d)
491491

492492
void dma_trace_disable(struct dma_trace_data *d)
493493
{
494+
struct dma_trace_buf *buffer = &d->dmatb;
495+
494496
/* cancel trace work */
495497
schedule_task_cancel(&d->dmat_work);
496498

@@ -507,6 +509,14 @@ void dma_trace_disable(struct dma_trace_data *d)
507509
d->host_size = 0;
508510
}
509511
#endif
512+
513+
/*
514+
* Reset the local read and write pointers to preserve the captured logs
515+
* while the dtrace is disabed
516+
*/
517+
buffer->w_ptr = buffer->addr;
518+
buffer->r_ptr = buffer->addr;
519+
buffer->avail = 0;
510520
}
511521

512522
/** Sends all pending DMA messages to mailbox (for emergencies) */

0 commit comments

Comments
 (0)