Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: Intel: Skylake: Fix IPC rx_list corruption
@ 2017-05-15 14:14 Subhransu S. Prusty
  2017-05-15 14:14 ` [PATCH 2/3] ASoC: Intel: Skylake: Fix to parse consecutive string tkns in manifest Subhransu S. Prusty
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Subhransu S. Prusty @ 2017-05-15 14:14 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, Pardha Saradhi K, lgirdwood, patches.audio, broonie,
	Subhransu S. Prusty

From: Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>

In SKL+ platforms, all IPC commands are serialised, i.e. the driver sends
a new IPC to DSP, only after receiving a reply from the firmware for the
current IPC.

Hence it seems apparent that there is only a single modifier of the IPC RX
List. However, during an IPC timeout case in a multithreaded environment,
there is a possibility of the list element being deleted two times if not
properly protected.

So, use spin lock save/restore to prevent rx_list corruption.

Signed-off-by: Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
---
 sound/soc/intel/skylake/skl-sst-ipc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 58c525096a7c..498b15345b1a 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -413,8 +413,11 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
 	u32 reply = header.primary & IPC_GLB_REPLY_STATUS_MASK;
 	u64 *ipc_header = (u64 *)(&header);
 	struct skl_sst *skl = container_of(ipc, struct skl_sst, ipc);
+	unsigned long flags;
 
+	spin_lock_irqsave(&ipc->dsp->spinlock, flags);
 	msg = skl_ipc_reply_get_msg(ipc, *ipc_header);
+	spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);
 	if (msg == NULL) {
 		dev_dbg(ipc->dev, "ipc: rx list is empty\n");
 		return;
@@ -456,8 +459,10 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
 		}
 	}
 
+	spin_lock_irqsave(&ipc->dsp->spinlock, flags);
 	list_del(&msg->list);
 	sst_ipc_tx_msg_reply_complete(ipc, msg);
+	spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);
 }
 
 irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-05-24 17:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-15 14:14 [PATCH 1/3] ASoC: Intel: Skylake: Fix IPC rx_list corruption Subhransu S. Prusty
2017-05-15 14:14 ` [PATCH 2/3] ASoC: Intel: Skylake: Fix to parse consecutive string tkns in manifest Subhransu S. Prusty
2017-05-24 17:41   ` Applied "ASoC: Intel: Skylake: Fix to parse consecutive string tkns in manifest" to the asoc tree Mark Brown
2017-05-15 14:14 ` [PATCH 3/3] ASoC: Intel: Skylake: Support for multiple data blocks Subhransu S. Prusty
2017-05-24 17:41   ` Applied "ASoC: Intel: Skylake: Support for multiple data blocks" to the asoc tree Mark Brown
2017-05-16  6:11 ` [PATCH 1/3] ASoC: Intel: Skylake: Fix IPC rx_list corruption Vinod Koul
2017-05-24 17:41 ` Applied "ASoC: Intel: Skylake: Fix IPC rx_list corruption" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox