Skip to contentSkip to conversation

ALSA: pcm: fix lost wakeup event scenarios in snd_pcm_drain

PATCH Applied Adam Miartus 2 participants 2 messages Jul 29, 2019 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: pcm: fix lost wakeup event scenarios in snd_pcm_drain

From: Yuki Tsunashima <[email protected]>

lost wakeup can occur after enabling irq, therefore put task into interruptible before enabling interrupts,

without this change, task can be put to sleep and snd_pcm_drain will delay

---
 sound/core/pcm_native.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/pcm_native.c +2 -1
index 860543a..fe333c8 100644
@@ -1874,6 +1874,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
 		if (!to_check)
 			break; /* all drained */
 		init_waitqueue_entry(&wait, current);
+		set_current_state(TASK_INTERRUPTIBLE);
 		add_wait_queue(&to_check->sleep, &wait);
 		snd_pcm_stream_unlock_irq(substream);
 		if (runtime->no_period_wakeup)
@@ -1886,7 +1887,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
 			}
 			tout = msecs_to_jiffies(tout * 1000);
 		}
-		tout = schedule_timeout_interruptible(tout);
+		tout = schedule_timeout(tout);
 
 		snd_pcm_stream_lock_irq(substream);
 		group = snd_pcm_stream_group_ref(substream);
Signature · 1 line
2.7.4
Applied
#1 lore raw
Quoted 6 lines · Adam Miartus

From: Yuki Tsunashima <[email protected]>

lost wakeup can occur after enabling irq, therefore put task into interruptible before enabling interrupts,

Quoted 7 lines

without this change, task can be put to sleep and snd_pcm_drain will delay

Thanks, applied now.

Takashi