Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

logger - invalid filename length #111

Closed

Description

@lgirdwood

Logger should be more robust when parsing data to cope with corruption and unexpected values.

root@up2:~# sof-logger -t -l sof-apl.ldc 
 CORE  LEVEL  COMP_ID        TIMESTAMP            DELTA                FILE_NAME	CONTENT
Error: Invalid filename length. 

hexdump -C /sys/kernel/debug/sof/trace

00000000  00 00 00 00 eb bc 18 00  00 00 00 00 74 67 00 20  |............tg. |
00000010  00 00 00 00 bb c3 18 00  00 00 00 00 80 66 00 20  |.............f. |
00000020  00 00 00 00 97 c5 18 00  00 00 00 00 4c 67 00 20  |............Lg. |
00000030  00 00 00 00 64 d8 19 00  00 00 00 00 08 15 00 20  |....d.......... |
00000040  00 00 00 00 aa d8 19 00  00 00 00 00 d8 12 00 20  |............... |
00000050  00 00 00 00 fd d8 19 00  00 00 00 00 bc 45 00 20  |.............E. |
00000060  00 00 00 00 4b da 19 00  00 00 00 00 dc 15 00 20  |....K.......... |
00000070  08 dc 02 be 02 00 00 00  00 00 00 00 dc e3 19 00  |................|
00000080  00 00 00 00 08 15 00 20  00 00 00 00 22 e4 19 00  |....... ...."...|
00000090  00 00 00 00 d8 12 00 20  00 00 00 00 6b e4 19 00  |....... ....k...|
000000a0  00 00 00 00 8c 37 00 20  00 00 00 00 b0 eb 19 00  |.....7. ........|

Activity

  1. added
    bug
    on Oct 18, 2018
  2. added
    P2
    on Oct 19, 2018
  3. akloniex commented on Oct 19, 2018

    @akloniex
    Member

    @lgirdwood
    I'm quite certain that it's a human error, meaning that You've tried parsing with incompatible .ldc file, relative to firmware running on the machine, not an actual tool malfunction.
    I agree that it should be more robust and provide more sensible information, to help user take correct actions in order to overcome the issue he's facing.

    I'm changing this to an enhancement as I don't think that tool malfunctioned. We'll cooperate with driver team to dump fw_ready message to debugfs so that sof-logger could read it, along with info that we'll put in .ldc file during FW build, for comparison and verification.

  4. added
    enhancement
    and removed
    bug
    on Oct 19, 2018
  5. xiulipan commented on Oct 19, 2018

    @xiulipan
    Contributor

    @akloniex
    I have go through the logger code and here is my understanding:

    The string is actually stored in *.ldc files, and dma_trace only send the entry pointer to the structure store the char * string.
    Which means the *.ldc and the *.ri you are running must be build from the same EFI file.
    Any mismatch will make the entry pointer have bias and cause errors.

    dump fw_ready message to debugfs

    This is actually done when the ready message is send from the FW, but this info is not kept as the FW running . We can have a another debugfs to store the ready info when we get it and let sof-logger to read it. This will have a early notification if there is a mismatch.

    BUT NOTE:

    sof-audio sof-audio: Firmware info: version 1.1-b9717 build 32 on Oct 18 2018:13:54:44

    The version will not be change if we have some dirty build (only diff, no commit)
    So we must check version and build or even build time.

  6. xiulipan commented on Oct 19, 2018

    @xiulipan
    Contributor

    @lgirdwood

    sof-audio sof-audio: Firmware info: version 1.1-b9717 build 32 on Oct 18 2018:13:54:44

    BTW, we may need some tag on master branch. The latest tag on master branch is still v1.1

    $git describe --abbrev=4
    v1.1-840-gb971
  7. lgirdwood commented on Oct 21, 2018

    @lgirdwood
    MemberAuthor

    The error being printed by logger also needs improved if it really more about using the wrong ldc file than file name length.

  8. akloniex commented on Oct 23, 2018

    @akloniex
    Member

    @xiulipan That is correct, .ldc and .ri have to come from the same build. I agree, that checking by commit SHA wouldn't be enough, and we would like to compare whole sof_ipc_fw_ready.version struct byte by byte, so if kernel team could dump it to separate debugfs, for sof-logger to check up on, that would be best. We will extract version with rimage and put at top of .ldc file from FW side and implement checking mechanism in sof-logger.

  9. xiulipan commented on Oct 23, 2018

    @xiulipan
    Contributor

    @akloniex
    So let make some alignment here.

    1. rimge need patch for version structure into .ldc file
    2. logger need to check the version in .ldc and debugfs from firmware ready info:
    • May also need some check about if the debugfs is there.
    • can override by some flag? default value inside the code.
    1. Kernel part: what file name would you like to store the file.

    And we may have some per merge test about this patch sets

  10. akloniex commented on Oct 23, 2018

    @akloniex
    Member

    @xiulipan
    0. FW needs patch allowing separation of fw_ready.version from .text section and linker script to fit pieces together, linking version to loadable section for runtime use and non-loadable, for extraction by rimage into .ldc file

    1. rimage needs patch to fit new section into both .ri and .ldc
    2. logger will check default location (tbd), overrided by parameter to allow custom path, or completely disabled verification with different parameter
    3. for the kernel part, I believe that /sys/kernel/debug/sof/fw_version is fair enough name

    All of these should not break current behaviour, so these can be implemented independently. We could stage logger part in 2 steps:

    1. verification disabled by default, enabled to default path with parameter
    2. verification enabled with default path as default behaviour, disabled with parameter.
      This way user experience would not be impacted throughout the process, and all steps could be carried out in parallel.
  11. xiulipan commented on Oct 23, 2018

    @xiulipan
    Contributor

    @akloniex
    I think this should be enough.
    Would you like to track this tasks with github issues? We can label them with enhancement.

  12. akloniex commented on Oct 23, 2018

    @akloniex
    Member

    @xiulipan
    I believe that we could keep track of it in this thread, but if you wish you could create issue for kernel repository and link it here.

  13. 4 remaining items

  14. xiulipan commented on Oct 29, 2018

    @xiulipan
    Contributor

    @akloniex
    I will send the PR ASAP.
    with /sys/kernel/debug/sof/fw_version

  15. xiulipan commented on Oct 29, 2018

    @xiulipan
    Contributor

    @akloniex @bkokoszx
    The kernel part is done. thesofproject/linux#222
    debugfs fw_version stores the whole structure of struct sof_ipc_fw_version

    /sys/kernel/debug/sof$ cat fw_version
    "Oct 29 201817:40:16e1012

  16. bkokoszx commented on Oct 29, 2018

    @bkokoszx
    Contributor

    @xiulipan
    Thanks. Is there a chance to apply your changes to topic/cros-sof-v4.14-rebase so that we can test it on yorp?

  17. bkokoszx commented on Oct 29, 2018

    @bkokoszx
    Contributor

    Here is logger part: #118
    Now it is tested only with our diagnostic driver.

  18. xiulipan commented on Oct 30, 2018

    @xiulipan
    Contributor

    @bkokoszx I will test three PRs with linux.

    For topic/cros-sof-v4.14-rebase, I will try to rebase my patch on top of it and send another PR.

  19. akloniex commented on Nov 2, 2018

    @akloniex
    Member

    @xiulipan When can we realistically expect these changes to be ported to topic/cros-sof-v4.14-rebase?

  20. xiulipan commented on Nov 4, 2018

    @xiulipan
    Contributor

    @akloniex
    Sorry, busy with CI issues let me test with all three changes together. And rebase patches into topic/cros-sof-v4.14-rebase. It will be done on Monday.

  21. xiulipan commented on Nov 4, 2018

    @xiulipan
    Contributor

    @akloniex @bkokoszx
    Test with #118

    sudo ./sof-logger -l sof-apl.ldc -e -t
    Error: fw version in sof-apl.ldc file does not coincide with fw version in /sys/kernel/debug/sof/fw_version file.

    Do you think this looks fine?

  22. xiulipan commented on Nov 4, 2018

    @xiulipan
    Contributor
  23. xiulipan commented on Nov 5, 2018

    @xiulipan
    Contributor

    @akloniex
    topic/cros-sof-v4.14-rebase will be maintained by @ranj063

  24. bkokoszx commented on Nov 5, 2018

    @bkokoszx
    Contributor

    @xiulipan
    Could you send sof-apl.ldc and /sys/kernel/debug/sof/fw_version files you used?
    @ranj063
    Is there a way to cherry-pick this PR thesofproject/linux#222
    to debug/cros-v4.14-rebase branch?

  25. xiulipan commented on Nov 5, 2018

    @xiulipan
    Contributor

    @bkokoszx
    That some fail test. Which means the fw_version check method is working now.
    The corresponding files work fine.

  26. bkokoszx commented on Nov 5, 2018

    @bkokoszx
    Contributor

    @xiulipan thanks, that's perfect

  27. bkokoszx commented on Nov 13, 2018

    @bkokoszx
    Contributor

    @lgirdwood @akloniex @xiulipan
    I think since checking fw version is on sof and soft master branch, we could close this issue/enhancement.

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

Metadata

Metadata

Labels

P2enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions