Skip to content

bug fix: "DSP panic" when ALSA XRUN recovery - #88

Closed
ghost wants to merge 3 commits into
masterfrom
unknown repository
Closed

ghost wants to merge 3 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jul 12, 2018 •

Copy link
Copy Markdown

I did not test it with latest version, because of the some known issues or regression issues on the latest version.

Wu Zhigang added 3 commits July 12, 2018 16:46
when stop command comes, the pipeline has to be prepared.
This case has to be taken into account:
when ALSA has XRUN, it will send stop/start commands to FW
and try to recover the pipepine. If we did not prepare
the pipeline before start, the recover process will fail.

Signed-off-by: Wu Zhigang <zhigang.wu@linux.intel.com>
the host state must be PREPARE when stopped,
if not, it will block our prepare process.

Signed-off-by: Wu Zhigang <zhigang.wu@linux.intel.com>
when xrun comes, component may be in prepare state.

Signed-off-by: Wu Zhigang <zhigang.wu@linux.intel.com>
@ghost ghost changed the title fix the bug: "DSP panic" when ALSA XRUN recovery bug fix: "DSP panic" when ALSA XRUN recovery Jul 12, 2018
@ghost
ghost requested a review from lgirdwood July 12, 2018 09:15

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this works or even has merits, you can't just change the state machines without more thinking of the implications on all components.

Comment thread src/ipc/handler.c
* the pipeline before start, the recover process will fail.
*/
if (cmd == COMP_TRIGGER_STOP) {
ret = pipeline_prepare(pcm_dev->cd->pipeline, pcm_dev->cd);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that looks quite questionable. it's rather when you start that you should make sure things are prepared, no?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It takes effect similar like the pipeline XRUN recover process.
you can refer to the pipeline_xrun_recover() to understand the logic.
without prepare, the firmware will hit XRUN again when start command comes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I make a stupid typo error, the Line459 should be:
ret = pipeline_prepare(pcm_dev->pipeline, pcm_dev->pipeline->source_comp);
I will update it after back office.

Comment thread src/audio/host.c
host_elements_reset(dev);

dev->state = COMP_STATE_PAUSED;
dev->state = COMP_STATE_PREPARE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is really odd. You will end-up with different states in different components, see e.g. the SSP dai code where the component are set to PAUSED.
Does this even work?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think when the component is truly paused, it should be paused state.
but if the command is stop. we have to set it prepare state to ready for the next start comes.
that makes sense.

Comment thread src/audio/component.c
case COMP_TRIGGER_XRUN:
if (dev->state == COMP_STATE_ACTIVE) {
if (dev->state == COMP_STATE_ACTIVE ||
dev->state == COMP_STATE_PREPARE) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WTH?
If you are in PREPARE state you set the component to PREPARE? I call this a no-op...

@ghost ghost Jul 13, 2018 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

conform with the previous RFC changed in src/audio/host.c

@ghost

ghost commented Jul 13, 2018

Copy link
Copy Markdown
Author

This RFCs idea comes from the pipeline_xrun_recover() process.
I checked the commands sent from host. it sends the different commands between
normal start and ALSA xrun's recover start.
that is the reason I did it like this.
I did this test on BYT, GP, UP^2. No negative effects found.
If you think it is incorrect in some logic, please point it out. I will be glad to change it.
This DSP panic exists about more than four months.
I think this RFCs can give us the correct direction to fix this kind of issue.

@ghost
ghost requested review from keyonjie and tlauda July 13, 2018 13:32
@plbossart

Copy link
Copy Markdown
Member

@zhigang-wu: The flow in open source is that you have to convince people that your solution is correct, not expect maintainers to tell you what is wrong in the logic. The code you provided does not convince me, so the ball is in your court. We've had so many issues with those state machines, you'd need a much higher level explanations on the intent and effect of changing the state from PAUSED to PREPARED in some components. My main issue with your code is that the DAIs aren't touched and therefore it looks like a point solution, not a generic fix.

@ghost ghost mentioned this pull request Jul 16, 2018
@ghost

ghost commented Jul 16, 2018

Copy link
Copy Markdown
Author

I will refine it. and analysis more code to make this patch more clearly and generic.

@ghost

ghost commented Jul 18, 2018

Copy link
Copy Markdown
Author

seems @tlauda refine this solution. I will close it now.

This pull request was closed.
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.

1 participant