Skip to content

Conversation

@marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Jun 10, 2021

Various fixes and some comments. Main changes:

dma-trace.c: remove misunderstood trace_flush() after FW ABI banner
trace: initialize DMA trace _after_ mailbox

marc-hb added 9 commits June 10, 2021 03:41
... when there are too many % characters in format string. Spotted by
routine valgrind run.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
It's not long and more consistent.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Connect the DMA initialization dots.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Fixes commit 6c14e76 ("trace: Log FW ABI and hash numbers").

In June 2020, PR thesofproject#3195 added a tr_info() "banner" immediately after to
make sure tracing works.

That commit included a likely misunderstood trace_flush() call
immediately after the tr_info(). The very poorly named trace_flush()
function sounds like earlier scheduling of something that would the same
later anyway but that's absolutely not what it does. Instead it copies
pending DMA traces to the shared mailbox.

This was most likely why the FW ABI banner is randomly duplicated in the
etrace from time to time, see for instance:
https://sof-ci.01.org/linuxpr/PR2954/build5823/devicetest/?model=BYT_MB_NOCODEC&testcase=test-speaker
https://sof-ci.01.org/softestpr/PR666/build721/devicetest/?model=TGLH_RVP_HDA&testcase=check-sof-logger

Note this test failure is unrelated. For now this CI does not read
etrace unless there's a failure.

In August 2020, commit 67a0a69 ("trace: Trace initial message as
error logs") upgraded this banner from tr_info() to tr_err(). That made
sure it gets to both the mailbox and the DMA trace but it didn't remove
the trace_flush(). Remove it now.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Pure rename, zero functional change.

The very poorly named trace_flush() function sounds like earlier
scheduling of something that would the same later anyway but that's
absolutely not what it does. Instead it copies pending DMA traces to the
shared mailbox.

As an example, in June 2020, PR thesofproject#3195 commit 6c14e76 ("trace: Log
FW ABI and hash numbers") added a tr_info() "banner" immediately after
to make sure tracing works. That included a likely misunderstood
trace_flush() call immediately after the tr_info().

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Avoids duplication and potential divergence.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The DMA trace is optional, the mailbox is not. This lets use the mailbox
when initializing the DMA trace.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Avoids crashes when trying to use put_header() early. Learned the hard
way because put_header() has also a timestamp argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Before:
 WARN task add 0xbe05ba30 <bad uid ptr 0>

After:
 WARN task add 0xbe05ba30 <bad uid ptr 0x00000000>

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb
Copy link
Collaborator Author

marc-hb commented Jun 10, 2021

Two platforms were unavailable in https://sof-ci.01.org/sofpr/PR4327/build9313/devicetest/ otherwise everything is green.

The 2 checkpatch warnings in https://github.com/thesofproject/sof/pull/4327/checks?check_run_id=2789960845 are wrong:

  • URL is too long
  • 'ba' may be misspelled - perhaps 'by'? in 0xbe05ba30

@marc-hb marc-hb marked this pull request as ready for review June 10, 2021 05:08
lvl, \
comp_class, \
params, \
n_params, \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it makes the macro readable, it does not belong to this commit as per the subject and message

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ujfalusi for the very thorough review! Technically you're right: this is not just a comment change. In practice this macro parameter name is used only once in the macro definition, must be a compile-time constant and the macro itself is used in only one place in the entire code base right now. So the risk of conflict and possible consequences are either zero or extremely close to it and that's why I chose to save one extra commit for these 4 characters. As you've noticed the rest of the PR is carefully divided in 9 different commits with hopefully good commit messages.

Now if you insist... :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine - CI has already run. Lets merge.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marc-hb, @lrgirdwo, I did not wanted to insist either.

This is a really nice cleanup series!

@lgirdwood lgirdwood merged commit 73df644 into thesofproject:main Jun 10, 2021
@marc-hb marc-hb mentioned this pull request Jun 11, 2021
@marc-hb marc-hb deleted the tracing-fixes branch June 11, 2021 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants