]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: SOF: ipc: fix a race, leading to IPC timeouts
authorGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Fri, 24 May 2019 19:09:23 +0000 (14:09 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 28 May 2019 14:48:47 +0000 (15:48 +0100)
commit536f5a9bb54c2c1d99fb07a07b9983a20054701a
treed7c016ba144feacc1c5602e165eb9f0a47c725df
parentc3d680e31d63b5b7db741f269feb4d7f1518f67f
ASoC: SOF: ipc: fix a race, leading to IPC timeouts

Currently on all supported platforms the IPC IRQ thread first signals
the sender when an IPC response is received from the DSP, then unmasks
the IPC interrupt. Those actions are performed without holding any
locks, so the thread can be interrupted between them. IPC timeouts
have been observed in such scenarios: if the sender is woken up and it
proceeds with sending the next message without unmasking the IPC
interrupt, it can miss the next response. This patch takes a spin-lock
to prevent the IRQ thread from being preempted at that point. It also
makes sure, that the next IPC transmission by the host cannot take
place before the IRQ thread has finished updating all the required IPC
registers.

Fixes: 8547fa6b66b ("ASoC: SOF: Add support for IPC IO between DSP and Host")
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/bdw.c
sound/soc/sof/intel/byt.c
sound/soc/sof/intel/cnl.c
sound/soc/sof/intel/hda-ipc.c
sound/soc/sof/ipc.c