You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] error trace debugfs entry (etrace) is always empty #3265
The error trace debugfs entry (/sys/kernel/debug/sof/etrace) is always empty which lead to we can't get any error trace with sof-logger (sof-logger -l *.ldc), this is bad for debugging when DMA trace doesn't work because of FW hanged or crashed.
To Reproduce
Do anything can lead to FW reporting tr_err() or comp_err(), and check the "sof-logger -l *.ldc".
Reproduction Rate
100%
Expected behavior
We should see the error trace logs in sof-logger output.
Impact
This will make it difficult for FW debugging when FW is hang or crashed.
Either this is a regression (I have used it on i.MX8 initially before adding the DMA trace support -- heck, before adding the host DMA in the first place) or something is different between Intel and NXP platforms.
Is there any known working commit a few months ago so you can start bisecting?
We should really have a first message to check that the trace works. An empty trace is not-testable, it can mean the trace is not working or there is no error message. An 'Hello SOF" seems required for CI/daily tests to check the trace functionality, no?
We should really have a first message to check that the trace works. An empty trace is not-testable, it can mean the trace is not working or there is no error message. An 'Hello SOF" seems required for CI/daily tests to check the trace functionality, no?
I hardly remember seeing error trace data in "etrace" ever. Looking through both kernel and firmware sources it seems like the kernel expects two memory window regions - SOF_IPC_REGION_DEBUG for debug and SOF_IPC_REGION_TRACE for errors, in the firmware e.g. on CAVS platforms they are initialised by EXT_MAN_PORT() in src/platform/intel/cavs/platform.c - so far so good. But I don't see the DEBUG region being used. Both _trace_error_with_ids() and _trace_event_with_ids() seem to translate to the same code in the end. I also checked one of daily tests on ICL from yesterday, where there is an "ERROR" entry in debug trace from hda_dma_link_check_xrun() where tr_err() is called, but "etrace" is empty. So, it seems like a global error to me.
We should really have a first message to check that the trace works. An empty trace is not-testable, it can mean the trace is not working or there is no error message. An 'Hello SOF" seems required for CI/daily tests to check the trace functionality, no?
Ack - "Hello SOF". @marc-hb do you fancy making this change, it should be a one liner for each platform in the FW ready function to add a trace_error call with the above string..
@xiulipan@akloniex so how is the error trace supposed to work and when did it work last time? I looked at v1.0 and v1.1 and even there I couldn't so far find that out.
@lyakh To understand how the trace work, we need to know we have 2 kinds of trace:
error trace: a simple shared memory window between DSP and host (same as the IPC mailbox), which means this kind of trace can only be directly access when DSP in D0. To make it work with PM, we have some method to cache this filed into debugfs when enter suspend, but I think it is not prefect at now and will lose data in some case (tplg load fail message will lost becaise of unfinished multiple core support feature)
DMA trace: something like a capture stream. We have set up buffer in debugfs to store data copied by DMA from DSP. As the buffer is limited size, so it can only hold limit size logs in the past. But if you open the sof-logger before the test, it can record all logs.
To understand more about error trace, we need first to know where is the buffer. Following code take APL as example:
We have about 8KB buffer for error log:
@lyakh To understand how the trace work, we need to know we have 2 kinds of trace:
[snip]
I am also look into this issue, it seems we have some error in trace implement.
@xiulipan thanks for the explanation, that's also my impression, that the current implementation isn't right and I don't understand whether and when and how it ever worked in the past.
@lyakh I did some debug and test, root cause to be we never copy anything into mailbox even if the trace is a ERROR. But all the functionality for MBOX trace is still OK. Have a simple fix: #3265
@plbossart@lgirdwood Now all trace is refined to link with comp ctx and uuid, I found it is not that easy to just add one line Hello SOF directly into our code.
Any idea here? Which comp we can used here to let the hello message linked to?
@plbossart@lgirdwood Now all trace is refined to link with comp ctx and uuid, I found it is not that easy to just add one line Hello SOF directly into our code.
Any idea here? Which comp we can used here to let the hello message linked to?
I typically use IPC for such messages in my internal tests that don't have an obvious component. But any component that is obvious and already included/visible in the current context is good.
@lyakh I did some debug and test, root cause to be we never copy anything into mailbox even if the trace is a ERROR. But all the functionality for MBOX trace is still OK. Have a simple fix: #3278
@xiulipan nice, just as I said - we never actually copy the data to the mailbox, no idea how it has been tested with the slim driver... Wondering whether it ever worked and since when it broke down.
@lyakh I tried to figure out why and when the trace is broken, but no luck because of the refinement @dbaluta Yes, I think we may missed this in sof-docs. Would you like to review my comments above and add them into doc?
Activity
paulstelian97 commentedon Jul 31, 2020
Either this is a regression (I have used it on i.MX8 initially before adding the DMA trace support -- heck, before adding the host DMA in the first place) or something is different between Intel and NXP platforms.
Is there any known working commit a few months ago so you can start bisecting?
plbossart commentedon Jul 31, 2020
We should really have a first message to check that the trace works. An empty trace is not-testable, it can mean the trace is not working or there is no error message. An 'Hello SOF" seems required for CI/daily tests to check the trace functionality, no?
@mmaka1 @lgirdwood @xiulipan @marc-hb FYI
marc-hb commentedon Jul 31, 2020
@keyonjie does revert #3245 help?
thesofproject/sof-test#297 thesofproject/sof-test#298
slawblauciak commentedon Aug 4, 2020
Issue not apparent when testing with the slim driver, maybe a kernel regression?
dbaluta commentedon Aug 4, 2020
Cc: @IulianOlaru249 @crazoes
I also noticed this last week but I thought it's just me being unable to use sof-logger properly.
lyakh commentedon Aug 4, 2020
I hardly remember seeing error trace data in "etrace" ever. Looking through both kernel and firmware sources it seems like the kernel expects two memory window regions - SOF_IPC_REGION_DEBUG for debug and SOF_IPC_REGION_TRACE for errors, in the firmware e.g. on CAVS platforms they are initialised by
EXT_MAN_PORT()in src/platform/intel/cavs/platform.c - so far so good. But I don't see the DEBUG region being used. Both_trace_error_with_ids()and_trace_event_with_ids()seem to translate to the same code in the end. I also checked one of daily tests on ICL from yesterday, where there is an "ERROR" entry in debug trace fromhda_dma_link_check_xrun()wheretr_err()is called, but "etrace" is empty. So, it seems like a global error to me.lgirdwood commentedon Aug 4, 2020
Ack - "Hello SOF". @marc-hb do you fancy making this change, it should be a one liner for each platform in the FW ready function to add a trace_error call with the above string..
xiulipan commentedon Aug 5, 2020
@lgirdwood I am OK with this!
@marc-hb And I think you can also make patches to sof-test scripts to make a valid test for error logger now.
lyakh commentedon Aug 5, 2020
@xiulipan @akloniex so how is the error trace supposed to work and when did it work last time? I looked at v1.0 and v1.1 and even there I couldn't so far find that out.
xiulipan commentedon Aug 6, 2020
@lyakh To understand how the trace work, we need to know we have 2 kinds of trace:
To understand more about error trace, we need first to know where is the buffer. Following code take APL as example:
We have about 8KB buffer for error log:
sof/src/platform/apollolake/include/platform/lib/memory.h
Lines 175 to 181 in cf74566
sof/src/platform/intel/cavs/include/cavs/lib/mailbox.h
Lines 38 to 40 in cf74566
Function for trace written to mailbox:
sof/src/trace/trace.c
Lines 68 to 97 in cf74566
I am also look into this issue, it seems we have some error in trace implement.
lyakh commentedon Aug 6, 2020
@xiulipan thanks for the explanation, that's also my impression, that the current implementation isn't right and I don't understand whether and when and how it ever worked in the past.
xiulipan commentedon Aug 6, 2020
@lyakh I did some debug and test, root cause to be we never copy anything into mailbox even if the trace is a ERROR. But all the functionality for MBOX trace is still OK. Have a simple fix: #3265
xiulipan commentedon Aug 6, 2020
@plbossart @lgirdwood Now all trace is refined to link with comp ctx and uuid, I found it is not that easy to just add one line Hello SOF directly into our code.
Any idea here? Which comp we can used here to let the hello message linked to?
paulstelian97 commentedon Aug 6, 2020
I typically use IPC for such messages in my internal tests that don't have an obvious component. But any component that is obvious and already included/visible in the current context is good.
dbaluta commentedon Aug 6, 2020
@xiulipan thanks a lot for your information about traces. This is the kind of information we need to write it in sof-docs.
lyakh commentedon Aug 6, 2020
@xiulipan nice, just as I said - we never actually copy the data to the mailbox, no idea how it has been tested with the slim driver... Wondering whether it ever worked and since when it broke down.
xiulipan commentedon Aug 7, 2020
@lyakh I tried to figure out why and when the trace is broken, but no luck because of the refinement
@dbaluta Yes, I think we may missed this in sof-docs. Would you like to review my comments above and add them into doc?