Repository navigation
ASoC: SOF: Intel: hda-dsp: Make sure that no irq handler is pending b… - #4617
Conversation
|
|
||
| /* make sure that no irq handler is pending before shutdown */ | ||
| synchronize_irq(sdev->ipc_irq); | ||
|
|
There was a problem hiding this comment.
nit-picks on commit message
- no mention of a crash
- double negative "nevertheless without"
- Need "Closes" tag
suggested edit:
In the existing IPC support, the reply to each IPC message is handled in an IRQ thread. The assumption is that the IRQ thread is scheduled without significant delays.
On an experimental (iow, buggy) kernel, the IRQ thread dealing with the reply to the last IPC message before powering-down the DSP can be delayed by several seconds. The IRQ thread will proceed with register accesses after the DSP is powered-down which results in a kernel crash.
While the bug which causes the delay is not in the audio stack, we must
handle such cases with defensive programming to avoid such crashes.
Call synchronize_irq() before proceeding to power down the DSP to make
sure that no irq thread is pending execution.
Closes: #4608 (check this is the relevant issue).
…efore suspend In the existing IPC support, the reply to each IPC message is handled in an IRQ thread. The assumption is that the IRQ thread is scheduled without significant delays. On an experimental (iow, buggy) kernel, the IRQ thread dealing with the reply to the last IPC message before powering-down the DSP can be delayed by several seconds. The IRQ thread will proceed with register accesses after the DSP is powered-down which results in a kernel crash. While the bug which causes the delay is not in the audio stack, we must handle such cases with defensive programming to avoid such crashes. Call synchronize_irq() before proceeding to power down the DSP to make sure that no irq thread is pending execution. Closes: thesofproject#4608 Signed-off-by: Peter Ujfalusi <[email protected]>
b786eb2 to
e375efc
Compare
|
Changes since v1:
|
|
need to verify if https://sof-ci.01.org/linuxpr/PR4617/build6896/devicetest/index.html?model=GLK_BOB_DA7219&testcase=check-kmod-load-unload is reproducible, this looks suspicious. |
|
the patch has ran overnight test. I don't see "ipc timed out" in logs. It could be no irq pending or synchronize_irq clean up correctly. @ujfalusi, could you check the device. I chould stop it for your remote access. |
This patch is not affecting the module removal, the |
@macchian, no show of "IPC timeout" is a sign that the very thing this workaround is fixing is not happening, the irq thread is called in time and thus we don't have timeout, this when we enter hda_suspend() there is no pending interrupts to wait for. Thank you for testing! |
I'm curious whether EDIT: also, is it easy to locally delay a specific IRQ for testing? |
No, it is lot logging 'extraordinary delays' but we are going to see the IPC timeout printed in the kernel log.
Yes and I did lot of testing like that to test out different timing and execution orders. |
"Extensive" changes, no. I was hoping an ERROR message would already be there or not require much change.
Yes of course but it'll never be fixed if it's never caught.
As long as this is at the ERROR level then it will be caught and reported and everything is fine. |
…efore suspend
It has been observed on an experimental (iow, buggy) kernel that the irq thread got delayed by several seconds after the primary handler returned with IRQ_WAKE_THREAD when sending the last IPC message before powering down the DSP.
While the bug which causes the delay is not in the audio stack, we must handle such cases nevertheless without a risk of crashing the kernel due to access to registers of a powered down IP.
Call synchronize_irq() before proceeding to power down the DSP to make sure that no irq thread is pending execution.