Skip to content

[BUG] kernel reporting bug when using same major ABI with different minor ABIs  #822

Closed

Description

@Jiangxinx

Summary
Error: Incompatible ABI version on all platforms,and failed to load DSP topology.

To Reproduce
1.aplay -l

Screenshots or console output
aplay: device_list:270: no soundcards found...

Environment
sof master: 6a9b90b
kernel sof-dev: 46c2b85
tplg: sof-apl-pcm512x.tplg & sof-apl-nocodec.tplg & sof-byt-rt5651.tplg

Dmesg

[    4.209685] wm8804 i2c-1AEC8804:00: Failed to read device ID: -121
[    4.209739] wm8804: probe of i2c-1AEC8804:00 failed with error -121
[    4.224702] sof-audio-pci 0000:00:0e.0: PCI DSP detected
[    4.225262] sof-audio-pci 0000:00:0e.0: DSP detected with PCI class/subclass/prog-if 0x040100
[    4.225362] sof-audio-pci 0000:00:0e.0: checking for capabilities at offset 0xc00
[    4.225365] sof-audio-pci 0000:00:0e.0: found ML capability at 0xc00
[    4.225367] sof-audio-pci 0000:00:0e.0: checking for capabilities at offset 0x800
[    4.225368] sof-audio-pci 0000:00:0e.0: found DSP capability at 0x800
[    4.225371] sof-audio-pci 0000:00:0e.0: checking for capabilities at offset 0x500
[    4.225373] sof-audio-pci 0000:00:0e.0: found GTS capability at 0x500
[    4.225376] sof-audio-pci 0000:00:0e.0: checking for capabilities at offset 0x1f00
[    4.225377] sof-audio-pci 0000:00:0e.0: found DRSM capability at 0x1f00
[    4.225380] sof-audio-pci 0000:00:0e.0: checking for capabilities at offset 0x700
[    4.225382] sof-audio-pci 0000:00:0e.0: found SPIB capability at 0x700
[    4.225395] sof-audio-pci 0000:00:0e.0: DMA mask is 64 bit
[    4.225398] sof-audio-pci 0000:00:0e.0: hda global caps = 0x1006701
[    4.225401] sof-audio-pci 0000:00:0e.0: detected 6 playback and 7 capture streams
[    4.225493] sof-audio-pci 0000:00:0e.0: use msi interrupt mode
[    4.225495] sof-audio-pci 0000:00:0e.0: using HDA IRQ 125
[    4.227714] sof-audio-pci 0000:00:0e.0: using IPC IRQ 125
[    4.230528] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at  00000044
[    4.230533] sof-audio-pci 0000:00:0e.0: PP capability, will probe DSP later.
[    4.230566] sof-audio-pci 0000:00:0e.0: Linked as a consumer to 0000:00:02.0
[    4.230577] sof-audio-pci 0000:00:0e.0: bound 0000:00:02.0 (ops 0xffffffff868ad860)
[    4.230579] sof-audio-pci 0000:00:0e.0: Turning i915 HDAC power on
[    4.236903] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000040 at  00000048
[    4.236908] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000000 at  00000048
[    4.241429] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at  00000048
[    4.241435] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000040 at  00000048
[    4.241437] sof-audio-pci 0000:00:0e.0: hda codecs found, mask 4
[    4.241484] sof-audio-pci 0000:00:0e.0: HDA codec #2 probed OK: response: 8086280a
[    4.241908] sof-audio-pci 0000:00:0e.0: Turning i915 HDAC power off
[    4.243279] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000040 at  00000048
[    4.243308] sof-audio-pci 0000:00:0e.0: loading firmware
[    4.338230] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000002 at  00000048
[    4.338236] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000000 at  00000048
[    4.338240] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at  00000044
[    4.338243] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000004 at  00000044
[    4.338245] sof-audio-pci 0000:00:0e.0: booting DSP firmware
[    4.338329] sof-audio-pci 0000:00:0e.0: period_bytes:0x0
[    4.338331] sof-audio-pci 0000:00:0e.0: periods:1
[    4.338372] sof-audio-pci 0000:00:0e.0: FW Poll Status: reg=0x3030303 successful
[    4.338377] sof-audio-pci 0000:00:0e.0: FW Poll Status: reg=0x3030302 successful
[    4.338380] sof-audio-pci 0000:00:0e.0: unstall/run core: core_mask = 1
[    4.338384] sof-audio-pci 0000:00:0e.0: DSP core(s) enabled? 1 : core_mask 1
[    4.338905] sof-audio-pci 0000:00:0e.0: FW Poll Status: reg=0x40000000 successful
[    4.338910] sof-audio-pci 0000:00:0e.0: FW Poll Status: reg=0x3010202 successful
[    4.355580] sof-audio-pci 0000:00:0e.0: FW Poll Status: reg=0x5000001 successful
[    4.369562] sof-audio-pci 0000:00:0e.0: FW Poll Status: reg=0x5 successful
[    4.369569] sof-audio-pci 0000:00:0e.0: Firmware download successful, booting...
[    4.371744] sof-audio-pci 0000:00:0e.0: ipc rx: 0x70000000: FW_READY
[    4.371749] sof-audio-pci 0000:00:0e.0: ipc: DSP is ready 0x70000000 offset 0x81000
[    4.371766] sof-audio-pci 0000:00:0e.0: Firmware info: version 1:1:0-6a9b9
[    4.371768] sof-audio-pci 0000:00:0e.0: Firmware: ABI 3:5:0 Kernel ABI 3:4:0
[    4.371770] sof-audio-pci 0000:00:0e.0: Firmware debug build 1 on Apr 12 2019-02:17:55 - options:
                GDB: disabled
                lock debug: disabled
                lock vdebug: disabled
[    4.371800] sof-audio-pci 0000:00:0e.0: found ext header type 1 size 0xb8
[    4.371852] sof-audio-pci 0000:00:0e.0:  mailbox upstream 0x81000 - size 0x1000
[    4.371853] sof-audio-pci 0000:00:0e.0:  mailbox downstream 0xa0000 - size 0x2000
[    4.371855] sof-audio-pci 0000:00:0e.0:  stream region 0xc1000 - size 0x1000
[    4.371859] sof-audio-pci 0000:00:0e.0: ipc rx done: 0x70000000: FW_READY
[    4.371868] sof-audio-pci 0000:00:0e.0: firmware boot complete
[    4.371878] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000000 at  00000048
[    4.371882] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000002 at  00000048
[    4.371887] sof-audio-pci 0000:00:0e.0: Debug PCIR: 00000004 at  00000044
[    4.371890] sof-audio-pci 0000:00:0e.0: Debug PCIW: 00000000 at  00000044
[    4.371935] sof-audio-pci 0000:00:0e.0: generating page table for 0000000067f0a1f9 size 0x10000 pages 16
[    4.371937] sof-audio-pci 0000:00:0e.0: dma_trace_pages: 16
[    4.371965] sof-audio-pci 0000:00:0e.0: period_bytes:0x0
[    4.371966] sof-audio-pci 0000:00:0e.0: periods:1
[    4.371973] sof-audio-pci 0000:00:0e.0: stream_tag: 1
[    4.371978] sof-audio-pci 0000:00:0e.0: ipc tx: 0x90010000: GLB_TRACE_MSG
[    4.372477] sof-audio-pci 0000:00:0e.0: ipc tx succeeded: 0x90010000: GLB_TRACE_MSG
[    4.372570] sof-audio-pci 0000:00:0e.0: created machine bxt-pcm512x
[    4.372571] sof-audio-pci 0000:00:0e.0: Completing SOF PCI probe
[    4.377256] HDMI HDA Codec ehdaudio0D2: Max dais supported: 3
[    4.384353] bxt-pcm512x bxt-pcm512x: info: override FE DAI link SSP5-Codec
[    4.384357] bxt-pcm512x bxt-pcm512x: info: override FE DAI link iDisp1
[    4.384358] bxt-pcm512x bxt-pcm512x: info: override FE DAI link iDisp2
[    4.384359] bxt-pcm512x bxt-pcm512x: info: override FE DAI link iDisp3
[    4.384425] sof-audio-pci 0000:00:0e.0: loading topology:intel/sof-tplg/sof-apl-pcm512x.tplg
[    4.392905] sof-audio-pci 0000:00:0e.0: Topology: ABI 3:5:0 Kernel ABI 3:4:0
[    4.392911] sof-audio-pci 0000:00:0e.0: error: Incompatible ABI version 3:5:0
[    4.392923] sof-audio-pci 0000:00:0e.0: error: tplg component load failed -22
[    4.392936] sof-audio-pci 0000:00:0e.0: error: failed to load DSP topology -22
[    4.392941] sof-audio-pci 0000:00:0e.0: ASoC: failed to probe component -22
[    4.392966] bxt-pcm512x bxt-pcm512x: ASoC: failed to instantiate card -22
[    4.393001] bxt-pcm512x bxt-pcm512x: snd_soc_register_card failed -22
[    4.393017] bxt-pcm512x: probe of bxt-pcm512x failed with error -22
[    4.918264] random: crng init done
[    4.918269] random: 7 urandom warning(s) missed due to ratelimiting
[    5.372466] sof-audio-pci 0000:00:0e.0: ipc rx: 0x90020000: GLB_TRACE_MSG
[    5.372481] sof-audio-pci 0000:00:0e.0: ipc rx done: 0x90020000: GLB_TRACE_MSG
[    5.599230] systemd-udevd (1484) used greatest stack depth: 11400 bytes left
[    6.132243] Generic PHY r8169-200:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=r8169-200:00, irq=IGNORE)
[    6.245007] r8169 0000:02:00.0 enp2s0: Link is Down
[    6.252815] Generic PHY r8169-300:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=r8169-300:00, irq=IGNORE)
[    6.366819] r8169 0000:03:00.0 enp3s0: Link is Down
[    8.350099] r8169 0000:02:00.0 enp2s0: Link is Up - 100Mbps/Full - flow control rx/tx
[    8.350123] IPv6: ADDRCONF(NETDEV_CHANGE): enp2s0: link becomes ready

Log file
dmesg.log

Activity

  1. added
    bugSomething isn't working
    BYTApplies to Baytrail platform
    APLApplies to ApolloLake platform
    WHLApplies to WhiskeyLake platform
    on Apr 12, 2019
  2. lgirdwood commented on Apr 15, 2019

    @lgirdwood
    Member

    @Jiangxinx this is incorrectly being reported as a bug by the kernel. I've updated the title.
    @plbossart fyi.

  3. changed the title [-][BUG] Error: Incompatible ABI version on all platforms.[/-] [+][BUG] kernel reporting bug when using same major ABI with different minor ABIs [/+] on Apr 15, 2019
  4. lgirdwood commented on Apr 15, 2019

    @lgirdwood
    Member

    @bardliao only major ABI updates are incompatible. Minor ABI version changes are backwards compatible. Can you fix this error handling in the kernel.

  5. ranj063 commented on Apr 15, 2019

    @ranj063
    Collaborator

    @lgirdwood the check for minor ABI was intentional in the kernel as even minor ABI updates could require new tokens in the tplg that may not have previously existed.

  6. lgirdwood commented on Apr 16, 2019

    @lgirdwood
    Member

    @ranj063 new or unknown tokens should just be ignored by kernel. The point is that the new feature will work as long as both minor versions are compatible but existing features will work regardless (as long as major ABI is compatible).

  7. lgirdwood commented on Apr 16, 2019

    @lgirdwood
    Member

    @xiulipan to fix this you need

    1. Dont fail on minor ABI differences.
    2. Dont fail on unknown DAI types
    3. Dont fail on unknown component types (not below)
    4. Delete any pipeline that fails to complete

    1,2 and 4 are below. Need a separate patch for each. Build tested only.

    diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
    index 2b9de1b97447..31454cf57050 100644
    --- a/sound/soc/sof/topology.c
    +++ b/sound/soc/sof/topology.c
    @@ -2790,8 +2790,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index,
                                            &config);
                    break;
            default:
    -               dev_err(sdev->dev, "error: invalid DAI type %d\n", config.type);
    -               ret = -EINVAL;
    +               dev_warn(sdev->dev, "warn: unknowm DAI type %d\n", config.type);
                    break;
            }
            if (ret < 0)
    @@ -3005,6 +3004,7 @@ int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
     {
            struct sof_ipc_pipe_ready ready;
            struct sof_ipc_reply reply;
    +       struct sof_ipc_pipe_free free;
            int ret;
     
            dev_dbg(sdev->dev, "tplg: complete pipeline %s id %d\n",
    @@ -3018,8 +3018,27 @@ int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
            ret = sof_ipc_tx_message(sdev->ipc,
                                     ready.hdr.cmd, &ready, sizeof(ready), &reply,
                                     sizeof(reply));
    -       if (ret < 0)
    -               return ret;
    +
    +       /* pipeline completion may fail for a number of reasons */
    +       if (ret < 0) {
    +
    +               /* delete pipeline from DAPM */
    +               snd_soc_tplg_widget_remove_all(swidget->widget->dapm,
    +                                              swidget->comp_id);
    +
    +               /* dismantle this pipeline to free up DSP resources */
    +               memset(&free, 0, sizeof(free));
    +               free.hdr.size = sizeof(free);
    +               free.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_FREE;
    +               free.comp_id = swidget->comp_id;
    +
    +               ret = sof_ipc_tx_message(sdev->ipc,
    +                                ready.hdr.cmd, &ready, sizeof(ready), &reply,
    +                                sizeof(reply));
    +               if (ret < 0)
    +                       return ret;
    +       }
    +
            return 1;
     }
     
    @@ -3066,8 +3085,7 @@ static int sof_manifest(struct snd_soc_component *scomp, int index,
                             man->priv.data[0], man->priv.data[1],
                             man->priv.data[2], SOF_ABI_MAJOR, SOF_ABI_MINOR,
                             SOF_ABI_PATCH);
    -               if (SOF_ABI_VER(man->priv.data[0], man->priv.data[1],
    -                               man->priv.data[2]) <= SOF_ABI_VERSION)
    +               if (man->priv.data[0] == SOF_ABI_MAJOR)
                            return 0;
            }
            dev_err(sdev->dev,
    
  8. bardliao commented on Apr 16, 2019

    @bardliao
    Collaborator

    @ranj063 @plbossart I tried to add new dai token in topology and kernel. Firstly, I checked the value of comp_dai.reserve to make sure my patch works. Secondly, reverted the patch on kernel side and confirmed the topology will ignore it without error. So I think it's fine if we only check ABI major version in topology. And it's FW's duty to make sure it's backward compatible if ABI major version is not changed.
    On the other hand, we will get ipc error if FW or tplg is not compatible with this kernel. Is there any significant difference when we load topology failed with ipc error or ABI checking error?

  9. plbossart commented on Apr 16, 2019

    @plbossart
    Member
  10. xiulipan commented on Apr 16, 2019

    @xiulipan

    @plbossart @lgirdwood
    My suggestion here it to revert the ABI changes on SOF first. And have some discussion about how should we deal with the ABI changes. And then make some written-down rules or guides for ABI and make somebody( I will be volunteer if nobody want. I do not want to see chaos like this anymore caused by ABI) to have manual test to make sure every ABI change is fully reviewed and can be backwards compatible. Also need to keep a time alignment for linux PR and sof PR merging.

    I do not like to keep some un-decided changes that blocks everything now. I do see some PR that is merged without basically test. We can indeed to apply some workaround to have manual test but now we are shorthanded and can not make sure to cover every PR.

  11. lgirdwood commented on Apr 17, 2019

    @lgirdwood
    Member
    1. Dont fail on minor ABI differences.
    2. Dont fail on unknown DAI types
    3. Dont fail on unknown component types (not below)
    4. Delete any pipeline that fails to complete

    Sorry mate, I don't agree here. You are essentially removing all error checks on the grounds that a 'minor' ABI needs to be tolerated, without a discussion on what 'Minor' means. If you pass a topology that contains stuff that the kernel cannot functionally handle, there is no point in continuing the parsing.

    Yes there is, I agree the pipeline that contains the new feature will not exist, but other pipelines/components should still be created without failing big. The implications for failing big are no audio whilst there may be audio if we can continue (depending on topology).

    The solution will be broken anyhow, the user will not get what is specified in the topology.

    Yes this will happen, there will be error/warnings in the log showing the ABI delta and missing components. The end result is the same as failing big in that the user needs to update his kernel to get the new feature working, but at least he may have working audio until that happens if we continue.

    Better fail early and fail big than try to continue without e.g. registering a DAI that will be connected later on to other components. I am fine with tolerating fields that build on top of existing components and DAIs. New component types and new DAIs are NOT a minor addition, sorry.

    If we make new DAIs or new components a MAJOR ABI change then we make a rod for our own back.
    Every MAJOR updates would mean.

    1. All SOF releases from all vendors will need to be updated on firmware git otherwise we fail big.
    2. All topologies need to be updated and merged by all distros. Also include Chrome/Android here too.
    3. Kernel ABI update need upstreamed and justified why we are changing MAJOR ABI continually.

    Now lets try and keep 1,2 and 3 above in sync to avoid the angry email from Linus when his laptop audio breaks. i.e. it was working yesterday but no longer works now after updating kernel, FW, topology.

    To further make things harder, we will have different SOF vendors adding new DAIs and components, meaning managing 1,2 and 3 on an ad-hoc and potentially frequent basis.

    New components and DAIs should be MINOR, just like the relationship versioning between kernel, glibc and userspace. New kernel, glibc API features are added via MINOR updates and never break existing userspace. See the man pages, there are lots of references for "only available in kernel x.y onward" or "only in glibc x.y onward". glibc MAJOR has not changed in about 20 years AFAICT.

  12. plbossart commented on Apr 17, 2019

    @plbossart
    Member

    @lgirdwood So you are essentially saying that we never use the MAJOR version and never check for MINOR versions either. Why do we have an ABI check then? Nothing is ever incompatible in your description.

  13. plbossart commented on Apr 17, 2019

    @plbossart
    Member

    I will also argue that someone using a firmware+topology more recent than the kernel does not fall in the category of 'we don't break userspace'. The only compatibility we care about is people updating the kernel and working with older firmware+topology. The case of using a firmware+topology more recent than the kernel is maybe valid for developers, certainly not for distros.

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

Metadata

Metadata

Assignees

Labels

APLApplies to ApolloLake platformBYTApplies to Baytrail platformWHLApplies to WhiskeyLake platformbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions