From: Yan Wang yan.wang@linux.intel.com
The timeout of work_reschedule_default() cannot be too short to finish work queue rescheduling. Otherwise, the work will be rescheduled wrong into the next timer loop. Also change macro name of DMA trace time interval for reading easily.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- src/lib/dma-trace.c | 9 +++++---- src/platform/baytrail/include/platform/platform.h | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 2a5b1a6..a147219 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -54,7 +54,7 @@ static uint64_t trace_work(void *data, uint64_t delay)
/* any data to copy ? */ if (avail == 0) - return DMA_TRACE_US; + return DMA_TRACE_PERIOD;
/* DMA trace copying is working */ d->copy_in_progress = 1; @@ -112,7 +112,7 @@ out: spin_unlock_irq(&d->lock, flags);
/* reschedule the trace copying work */ - return DMA_TRACE_US; + return DMA_TRACE_PERIOD; }
int dma_trace_init(struct dma_trace_data *d) @@ -182,7 +182,7 @@ int dma_trace_enable(struct dma_trace_data *d) }
d->enabled = 1; - work_schedule_default(&d->dmat_work, DMA_TRACE_US); + work_schedule_default(&d->dmat_work, DMA_TRACE_PERIOD); return 0; }
@@ -247,7 +247,8 @@ void dtrace_event(const char *e, uint32_t length)
/* schedule copy now if buffer > 50% full */ if (trace_data->enabled && buffer->avail >= (DMA_TRACE_LOCAL_SIZE / 2)) - work_reschedule_default(&trace_data->dmat_work, 100); + work_reschedule_default(&trace_data->dmat_work, + DMA_TRACE_RESCHEDULE_TIME); }
void dtrace_event_atomic(const char *e, uint32_t length) diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index 4d63f7b..72174f3 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -80,7 +80,13 @@ struct reef; #define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE
/* the interval of DMA trace copying */ -#define DMA_TRACE_US 500000 +#define DMA_TRACE_PERIOD 500000 + +/* + * the interval of reschedule DMA trace copying in special case like half + * fullness of local DMA trace buffer + */ +#define DMA_TRACE_RESCHEDULE_TIME 5000
/* DMAC used for trace DMA */ #define PLATFORM_TRACE_DMAC DMA_ID_DMAC0