summaryrefslogtreecommitdiff
path: root/sound/core/seq/seq_virmidi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-07-29 22:38:54 +0200
committerTakashi Iwai <tiwai@suse.de>2018-07-29 22:39:29 +0200
commit16c796e8fac353d736055322ca6a38ba3c49f5e2 (patch)
treea8557b6c660d067834ece2421a1d6ffe990b60af /sound/core/seq/seq_virmidi.c
parentf69548ffafcc4942022f16f2f192b24143de1dba (diff)
parentf59cf9a0551dd954ad8b752461cf19d9789f4b1d (diff)
Merge branch 'for-linus' into topic/virmidi
Pull the latest ALSA sequencer fixes for the further development of virmidi. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/seq_virmidi.c')
-rw-r--r--sound/core/seq/seq_virmidi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 289ae6bb81d9..8ebbca554e99 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -163,6 +163,7 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,
int count, res;
unsigned char buf[32], *pbuf;
unsigned long flags;
+ bool check_resched = !in_atomic();
if (up) {
vmidi->trigger = 1;
@@ -200,6 +201,15 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,
vmidi->event.type = SNDRV_SEQ_EVENT_NONE;
}
}
+ if (!check_resched)
+ continue;
+ /* do temporary unlock & cond_resched() for avoiding
+ * CPU soft lockup, which may happen via a write from
+ * a huge rawmidi buffer
+ */
+ spin_unlock_irqrestore(&substream->runtime->lock, flags);
+ cond_resched();
+ spin_lock_irqsave(&substream->runtime->lock, flags);
}
out:
spin_unlock_irqrestore(&substream->runtime->lock, flags);