diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-07-29 23:03:05 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-07-30 14:51:51 +0200 |
commit | f7debfe54090d1a1c38e1f070be20d83bb70a8e0 (patch) | |
tree | 6718f64cfde2c98b7a3d596784a49b754beba3f7 /include/sound/seq_virmidi.h | |
parent | 16c796e8fac353d736055322ca6a38ba3c49f5e2 (diff) | |
download | lwn-f7debfe54090d1a1c38e1f070be20d83bb70a8e0.tar.gz lwn-f7debfe54090d1a1c38e1f070be20d83bb70a8e0.zip |
ALSA: seq: virmidi: Offload the output event processing
The virmidi sequencer stuff tries to translate the rawmidi bytes to
sequencer events and deliver the packets at trigger callback. The
amount of the whole process of these translations and deliveries
depends on the incoming rawmidi bytes, and we have no limit for that;
this was the cause of a CPU soft lockup that had been reported and
fixed recently.
Although we've fixed the soft lockup by putting the temporary unlock
and cond_resched(), it's rather a quick band aid. In this patch,
meanwhile, the event parsing and delivery process is offloaded to a
dedicated work, and the trigger callback just kicks it off. It has
three merits, at least:
- The processing is always done in a sleepable context, which can
assure the event delivery with non-atomic flag without hackish
is_atomic() usage.
- Other relevant codes can be simplified, reducing the lines
- It makes me happier
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/seq_virmidi.h')
-rw-r--r-- | include/sound/seq_virmidi.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h index 695257ae64ac..d488dcfa3a4e 100644 --- a/include/sound/seq_virmidi.h +++ b/include/sound/seq_virmidi.h @@ -41,6 +41,7 @@ struct snd_virmidi { struct snd_seq_event event; struct snd_virmidi_dev *rdev; struct snd_rawmidi_substream *substream; + struct work_struct output_work; }; #define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) |