Skip to content

ASoC: SOF: loader: fix kernel oops on firmware boot failure - #1174

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
plbossart:fix/boot_fail_oops
Sep 5, 2019
Merged

ASoC: SOF: loader: fix kernel oops on firmware boot failure#1174
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
plbossart:fix/boot_fail_oops

Conversation

@plbossart

Copy link
Copy Markdown
Member

When we fail to boot the firmware, we encounter a kernel oops in
hda_dsp_get_registers(), which is called conditionally in
hda_dsp_dump() when the sdev_>boot_complete flag is set.

Setting this flag after dumping the data fixes the issue and does
not change the programming flow.

Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com

When we fail to boot the firmware, we encounter a kernel oops in
hda_dsp_get_registers(), which is called conditionally in
hda_dsp_dump() when the sdev_>boot_complete flag is set.

Setting this flag _after_ dumping the data fixes the issue and does
not change the programming flow.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Comment thread sound/soc/sof/loader.c
snd_sof_dsp_dbg_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX |
SOF_DBG_TEXT | SOF_DBG_PCI);
/* after this point FW_READY msg should be ignored */
sdev->boot_complete = true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@plbossart just wondering why do we need to set this to true at all in case of FW boot failure?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@kv2019i Can you chime in, this change was yours initially I believe and IIRC it was intentional. I don't recall the reason...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@plbossart i looked up the commit that added the change a69270d. I think @kv2019i hit this race condition with the QEMU DSP. But nevertheless, this change looks fine to me.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@plbossart @ranj063 Ack on that. Without that you can have the case where we consider FW loading to have failed to a timeout and have freed, or are freeing related resources -- but then we get the late FW_READY and this will make the driver go crazy. Thus the fix.

@keyonjie

keyonjie commented Sep 5, 2019

Copy link
Copy Markdown

The change itself here is harmless. With respect to the commit @kv2019i made, I think it's better to use other solution like this:
change boot_complete to be boot_stage, and it can be enumerated as BOOT_INIT, BOOT_ONGOING, BOOT_FAILED, BOOT_SUCCESS.

And then in the place boot failed here, set boot_complete to BOOT_FAILED, in IPC handling, handle fw_ready message only at BOOT_ONGOING stage.

@kv2019i

kv2019i commented Sep 5, 2019

Copy link
Copy Markdown
Collaborator

@keyonjie wrote:

The change itself here is harmless. With respect to the commit @kv2019i made, I think it's better to use other solution like this:
change boot_complete to be boot_stage, and it can be enumerated as BOOT_INIT, BOOT_ONGOING, BOOT_FAILED, BOOT_SUCCESS.
[...]
And then in the place boot failed here, set boot_complete to BOOT_FAILED, in IPC handling, handle fw_ready message only at BOOT_ONGOING stage.

Hmm, this probably would be cleaner solution (easier to understand for the casual readong.. in failed case, the boot did not really complete, so it's misleading), agreed.

@keyonjie keyonjie left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's fine to fix the issue firstly.
@aiChaoSONG is working on the clean up for boot_complete.

@plbossart

Copy link
Copy Markdown
Member Author

It's fine to fix the issue firstly.
@aiChaoSONG is working on the clean up for boot_complete.

please file an enhancement so that we can track progress, thanks.

@plbossart
plbossart merged commit f7f346d into thesofproject:topic/sof-dev Sep 5, 2019
@keyonjie

keyonjie commented Sep 6, 2019

Copy link
Copy Markdown

It's fine to fix the issue firstly.
@aiChaoSONG is working on the clean up for boot_complete.

please file an enhancement so that we can track progress, thanks.

Sure, here it is: #1179

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.

4 participants