Skip to content

[BUG]Topology load failure with recent redirection #5113

Closed

Description

@ranj063

Describe the bug
Topology fails to load with error:


[ 5.849946] sof-audio-pci-intel-cnl 0000:00:1f.3: loading topology:intel/sof-tplg/sof-hda-generic-4ch.tplg
[ 5.853535] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: invalid header size for type 808464432 at offset 0x0 size 0xe76a.
[ 5.853566] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: topology: invalid header: -22
[ 5.853700] sof-audio-pci-intel-cnl 0000:00:1f.3: error: tplg component load failed -22
[ 5.853730] sof-audio-pci-intel-cnl 0000:00:1f.3: error: failed to load DSP topology -22
[ 5.853754] sof-audio-pci-intel-cnl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22
[ 5.853997] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: failed to instantiate card -22

To Reproduce
Build topology with SOF main and boot the device

Reproduction Rate
100%
Expected behavior
Topology should load successfully.

Impact
showstopper

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
  2. Name of the topology file
    • Topology: sof-hda-generic-4ch.tplg
  3. Name of the platform(s) on which the bug is observed.
    • Platform: HDA CNL
  4. Upstream alsa-utils and alsa-lib

Reverting the patch eb34437 fixes the issue.

Activity

  1. added
    bugSomething isn't working as expected
    on Dec 20, 2021
  2. ranj063 commented on Dec 20, 2021

    @ranj063
    CollaboratorAuthor
  3. marc-hb commented on Dec 20, 2021

    @marc-hb
    Collaborator

    I really don't see how eb34437 could make any content difference. If it did this would be exposing a very severe bug in alsatplg, much more serious than a simple permission issue. I just reverted it locally and permissions aside all the .tplg files are byte for byte identical. I tested alsatplg version 1.2.2

  4. lgirdwood commented on Dec 20, 2021

    @lgirdwood
    Member

    Could we have a race in the build ? Do we need to force clean topology bimaries ? Do we have stale intermediate topology build files anywhere ?

  5. marc-hb commented on Dec 20, 2021

    @marc-hb
    Collaborator

    As a coincidence, I tested this commit with very different number of threads because I was fixing an unrelated and proven CMake race condition with development/ topologies (#5067). While testing #5067 I never noticed any other race. I tested again with -j1 and -j400 and the number of threads makes zero difference to anything.

    For the record here's the expected file right now:

    md5sum tools/build_tools/topology/sof-hda-generic-4ch.tplg 
    76ae10de56aec534bf21584eb0b8c2da  tools/build_tools/topology/sof-hda-generic-4ch.tplg
    
    ls -l tools/build_tools/topology/sof-hda-generic-4ch.tplg 
    -rw-rw-r--  49855 Dec 20 23:33 tools/build_tools/topology/sof-hda-generic-4ch.tplg
    

    @ranj063 told me she got:

    d86fc7901c51120b95c1d8b06953d2cb /home/ranjani/temp/sof-hda-generic-4ch.tplg.broken # 62195 bytes
    

    She also said running the alsatplg command manually with the redirection works fine.

    @ranj063 can you please:

    • run a few times and check whether the (broken) size and checksum stay the same?
    • check whether these two files are the same?
    tools/build_tools/topology/sof-hda-generic-4ch.tplg
    tools/build_tools/topology/topology1/production/sof-hda-generic-4ch.tplg
    
  6. ranj063 commented on Dec 21, 2021

    @ranj063
    CollaboratorAuthor

    A few more details about my environment:

    Ubuntu 20.04
    shell type: bash
    alsatplg version 1.2.6
    libasound version 1.2.6.1
    libatopology version 1.2.6.1

    corrupt-tplg.tar.gz

    And manual redirection with the alsatplg command works fine but redirection with the build-tools.sh script results in a corrupt tplg file. Here's the broken tplg file:

  7. marc-hb commented on Dec 21, 2021

    @marc-hb
    Collaborator

    I believe your CMake version was 3.16.3

    @ranj063 can you please:

    • run a few times and check whether the (broken) size and checksum stay the same?
    • check whether these two files are the same?

    Also: is it affecting just this .tplg file or others or most or all? diff -qr build_tools.before/ build_tools.after/

  8. aiChaoSONG commented on Dec 22, 2021

    @aiChaoSONG
    Collaborator

    There are debug logs from alsatplg in the corrupt topology. The debug option is on with ranjani's alsatplg. The tplg_log output debug log to stdout, too. So the debug log and topology content are mixed in the broken topology file with eb34437

    image

  9. marc-hb commented on Dec 22, 2021

    @marc-hb
    Collaborator

    Awesome find @aiChaoSONG , you rock! (why didn't I open the attached file mysefl? Maybe it was too late after a long day...)

    @ranj063 please use fprintf(stderr, ...) for your debug logs, this should avoid the issue.

    Closing.

  10. ranj063 commented on Dec 24, 2021

    @ranj063
    CollaboratorAuthor

    I'm sorry @marc-hb , I cannot use stderr for debug logs. That's not the right fix. If debug logs will get redirected too, this patch needs to be reverted. Anyway isn't the original problem for which u submitted this change already been fixed upstream?

  11. marc-hb commented on Dec 24, 2021

    @marc-hb
    Collaborator

    I cannot use stderr for debug logs.

    Why not?

    Considering alsatplg -o - is supported, how come debug logs go to stdout at the same time? Can you explain how to reproduce this?

    Anyway isn't the original problem for which u submitted this change already been fixed upstream?

    Yes it just got fixed days ago. Not everyone is using the latest alsatplg.

  12. marc-hb commented on Dec 24, 2021

    @marc-hb
    Collaborator

    Can you explain how to reproduce this?

    OK that was easy. See commit message of revert #5132

  13. added a commit that references this issue on Dec 25, 2021
    8f3f2d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions