-
Notifications
You must be signed in to change notification settings - Fork 349
dma-trace: Print banners in case of dtrace re-initialization atempt #5416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dma-trace: Print banners in case of dtrace re-initialization atempt #5416
Conversation
The dtrace internal buffer is permanent from the point it is allocated. If a SOF_IPC_TRACE_DMA_FREE IPC received the DMA channel is released and the read/write pointer in the local dtrace buffer is reset to 0. However, if the DSP is not powered down before the dtrace is re-enabled then the banner is not going to be printed and since the write pointer is reset (since the new DMA channel will start the copy from the start of the buffer), further prints will overwrite the data which might include the banner from the first boot when the buffer was allocated. Print the banners in response to a dtrace enable call all the time. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
|
@marc-hb, to be honest I don't understand this at all. diff --git a/rimage b/rimage
index ee5c3e1deb14..0f64a20183a8 160000
--- a/rimage
+++ b/rimage
@@ -1 +1 @@
-Subproject commit ee5c3e1deb1436a6e52b653bb523b594511cf330
+Subproject commit 0f64a20183a8db9bc39a4044679a51c1cc334f8f
diff --git a/src/trace/dma-trace.c b/src/trace/dma-trace.c
index bb03b96593fc..39662c01f319 100644
--- a/src/trace/dma-trace.c
+++ b/src/trace/dma-trace.c
@@ -87,6 +87,7 @@ static enum task_state trace_work(void *data)
d->copy_in_progress = 1;
/* copy this section to host */
+ mtrace_printf(LOG_LEVEL_INFO, "copy to host_offset: %#x w_ptr: %#x, r_ptr: %#x", d->posn.host_offset, buffer->w_ptr, buffer->r_ptr);
size = dma_copy_to_host(&d->dc, config, d->posn.host_offset,
buffer->r_ptr, size);
if (size < 0) {
@@ -324,18 +325,21 @@ print_banners:
*/
#define SOF_BANNER_COMMON \
"FW ABI 0x%x DBG ABI 0x%x tags SOF:" SOF_GIT_TAG ZEPHYR_VER_OPT \
- " src hash 0x%08x (ldc hash " META_QUOTE(SOF_SRC_HASH) ")"
+ " src hash 0x%08x (ldc hash " META_QUOTE(SOF_SRC_HASH) ") (Peter)"
/* It should be the very first sent log for easy identification. */
+ mtrace_printf(LOG_LEVEL_INFO, "00. addr: %#x w_ptr: %#x, r_ptr: %#x", buffer->addr, buffer->w_ptr, buffer->r_ptr);
mtrace_printf(LOG_LEVEL_INFO,
"SHM: " SOF_BANNER_COMMON,
SOF_ABI_VERSION, SOF_ABI_DBG_VERSION, SOF_SRC_HASH);
+ mtrace_printf(LOG_LEVEL_INFO, "01. addr: %#x w_ptr: %#x, r_ptr: %#x", buffer->addr, buffer->w_ptr, buffer->r_ptr);
/* Use a different, DMA: prefix to ease identification of log files */
tr_info(&dt_tr,
"DMA: " SOF_BANNER_COMMON,
SOF_ABI_VERSION, SOF_ABI_DBG_VERSION, SOF_SRC_HASH);
+ mtrace_printf(LOG_LEVEL_INFO, "02. addr: %#x w_ptr: %#x, r_ptr: %#x", buffer->addr, buffer->w_ptr, buffer->r_ptr);
return 0;
}
@@ -508,6 +512,7 @@ void dma_trace_disable(struct dma_trace_data *d)
* Reset the local read and write pointers to preserve the captured logs
* while the dtrace is disabed
*/
+ mtrace_printf(LOG_LEVEL_INFO, "RESET w_ptr: %#x, r_ptr: %#x", buffer->w_ptr, buffer->r_ptr);
buffer->w_ptr = buffer->addr;
buffer->r_ptr = buffer->addr;
buffer->avail = 0;
@@ -661,6 +666,7 @@ static void dtrace_add_event(const char *e, uint32_t length)
ret = memcpy_s(buffer->w_ptr, length, e, length);
assert(!ret);
dcache_writeback_region(buffer->w_ptr, length);
+ mtrace_printf(LOG_LEVEL_INFO, "Event added atw_ptr: %#x, length: %u (no-wrap)", buffer->w_ptr, length);
buffer->w_ptr = (char *)buffer->w_ptr + length;
} else {
/* data is bigger than remaining margin so we wrap */
@@ -668,6 +674,7 @@ static void dtrace_add_event(const char *e, uint32_t length)
ret = memcpy_s(buffer->w_ptr, margin, e, margin);
assert(!ret);
dcache_writeback_region(buffer->w_ptr, margin);
+ mtrace_printf(LOG_LEVEL_INFO, "Event added atw_ptr: %#x, length: %u (wrap)", buffer->w_ptr, length);
buffer->w_ptr = buffer->addr;
dcache_invalidate_region(buffer->w_ptr,Some run of FAIL case: What I have in etrace is identical, the read and write pointer in local buffer got reset in both case, but way after the initial trace has been copied to host buffer. |
|
@marc-hb, I did also a check and the path this patch opens for re-printing the banner never happened. Every time (regardless of PASS or FAIL) the firmware boot was always started from a power off state. |
|
Since the "dma-trace: Preserve logs while dtrace is disabled" is reverted now, this PR is not needed. We will deliver random trace info to the host if the dtrace is reconfigured, so it does not matter if we print a banner or not, the information is worthless, which is going to come out anyways. I'll close this. |
The dtrace internal buffer is permanent from the point it is allocated.
If a SOF_IPC_TRACE_DMA_FREE IPC received the DMA channel is released and
the read/write pointer in the local dtrace buffer is reset to 0.
However, if the DSP is not powered down before the dtrace is re-enabled
then the banner is not going to be printed and since the write pointer
is reset (since the new DMA channel will start the copy from the start of
the buffer), further prints will overwrite the data which might include
the banner from the first boot when the buffer was allocated.
Print the banners in response to a dtrace enable call all the time.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com