Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart what happens if you use pm_runtime_put_noidle() instead of pm_runtime_put_autosuspend() here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 that would drop the refcount but not undo the resume. put_noidle is usually called in error scenarios, this wouldn't be a symmetrical call.
This doesn't change anything in my local tests, I think it's the resume part that's problematic.
That's my life right there, a seemingly logical and innocuous change that breaks the whole stack. Gah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart I tested pm_runtime_get_sync() instead of pm_runtime_resume_and_get() and I no longer have the xrun:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to explain this though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the sequence pm_runtime_get_noresume/put_noidle works. So logically it's the resume part that's problematic.
It's possible though that the card creation happens BEFORE the pci device is full probed and initialized. There's a race condition of some sort here.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But how is that possible though? The machine driver is registered towards the end of the pci device probe isnt it? The difference between get_sync() and resume_and_get() is quite a mystery. In theory they do the same thing
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh I think I know the problem @plbossart. There's a small but important difference between runtime_get_sync() and runtime_resume_and_get(). If runtime_resume_and_get() returns a -EACCES, we do a runtime_put_noidle() before returning 0 whereas with runtime_get_sync(), we will not do the put in case of -EACCES
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this now makes me question if the switch to use of runtime_resume_and_get() in the SOF driver was wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I resume the SOF component only, things work fine. It's the codec driver component that's problematic, which means we have to resume during component probe only if needed, on a component by component basis. This cannot be an ASoC-level change, too invasive and maybe not efficient to resume if not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That code is wrong @ranj063, if there is an error different from -EACCES the reference count is not decreased.