Skip to content

Possible missed trace logs at the beginning #3448

Closed

Description

@dbaluta

Looking at the code in snd_sof_init_trace_ipc we have:

int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev)
{
/* .. */
       /* send IPC to the DSP */
       ret = sof_ipc_tx_message(sdev->ipc,
                                params.hdr.cmd, &params, sizeof(params),
                               &ipc_reply, sizeof(ipc_reply));

<<<HERE>>
       ret = snd_sof_dma_trace_trigger(sdev, SNDRV_PCM_TRIGGER_START);
       sdev->dtrace_is_enabled = true;
}

Then at snd_sof_trace_update_pos we have:

int snd_sof_trace_update_pos(struct snd_sof_dev *sdev,
»       »       »            struct sof_ipc_dma_trace_posn *posn)
{

        if (sdev->dtrace_is_enabled && sdev->host_offset != posn->host_offset) {                                                                                                                                   
               sdev->host_offset = posn->host_offset;
              wake_up(&sdev->trace_sleep);
        }

It is possible that the reply for SOF_IPC_TRACE_DMA_PARAMS_EXT to arrive at the marker <<<HERE>> so, snd_sof_trace_update_pos will miss the DMA trace position update because dtrace_is_enabled is set too late.

This happens all the time on i.MX with the result that we cannot see the DMA trace boot logs until later when some other log messages are generated.

Is this a known issue on other platforms?

Cc: @marc-hb

Activity

  1. ujfalusi commented on Feb 21, 2022

    @ujfalusi
    Collaborator

    On Intel platforms the copy to host buffer can only work after the snd_sof_dma_trace_trigger(sdev, SNDRV_PCM_TRIGGER_START) call as before that the DMA is not working.

    Now the dtrace in firmware uses sync dma copy, so this should be fine.

    But on architectures where the DMA is not split like it is with HDA, this could cause ignored updates.

    @dbaluta, in sof-dev we now have three states for the dtrace:

    enum sof_dtrace_state {
    	SOF_DTRACE_DISABLED,
    	SOF_DTRACE_STOPPED,
    	SOF_DTRACE_ENABLED,
    };

    I think we could try to change the logic that we switch from DISABLED to STOPPED before sending the PARAMS_EXT and we only ignore the position update notification if the state is DISABLED.
    This way we would record the new position and in theory you should be able to get the log right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions