Skip to content

Commit

Permalink
Merge branch 'for-linus'
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwai committed Jul 27, 2018
2 parents 2c5822d + 50e9ffb commit a021b73
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sound/core/seq/seq_virmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a021b73

Please sign in to comment.