From 4b820e167bf6f410ace479d8df5b15a574000e75 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 2 Jul 2021 22:05:52 -0700 Subject: Revert "ALSA: usb-audio: Reduce latency at playback start" This reverts commit 9ce650a75a3b262c90789b42aedee8fc2ee04d53. This commit causes watchdog lockups on my machine, and while I have no idea what the cause is, it bisected right to this commit, and reverting the change promptly fixes it. At least occasionally one of the watchdog call traces was Call Trace: _raw_spin_lock_irqsave+0x35/0x40 snd_pcm_period_elapsed+0x1b/0xa0 [snd_pcm] snd_usb_endpoint_start+0x1a0/0x3c0 [snd_usb_audio] start_endpoints+0x23/0x90 [snd_usb_audio] snd_usb_substream_playback_trigger+0x7b/0x1a0 [snd_usb_audio] snd_pcm_common_ioctl+0x1c44/0x2360 [snd_pcm] snd_pcm_ioctl+0x2e/0x40 [snd_pcm] __se_sys_ioctl+0x72/0xc0 do_syscall_64+0x4c/0xa0 entry_SYSCALL_64_after_hwframe+0x44/0xae so presumably it's a locking error on that substream spinlock that snd_pcm_period_elapsed() takes. But at this point I just want to have a working system so that I can continue the merge window work tomorrow. Cc: Takashi Iwai Signed-off-by: Linus Torvalds --- sound/usb/pcm.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'sound/usb/pcm.c') diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index c66831ee15f9..e26d37365f02 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -613,6 +613,11 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) subs->last_frame_number = 0; runtime->delay = 0; + /* for playback, submit the URBs now; otherwise, the first hwptr_done + * updates for all URBs would happen at the same time when starting */ + if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) + ret = start_endpoints(subs); + unlock: snd_usb_unlock_shutdown(chip); return ret; @@ -1425,7 +1430,6 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea int cmd) { struct snd_usb_substream *subs = substream->runtime->private_data; - int err; switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -1436,14 +1440,6 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea prepare_playback_urb, retire_playback_urb, subs); - if (cmd == SNDRV_PCM_TRIGGER_START) { - err = start_endpoints(subs); - if (err < 0) { - snd_usb_endpoint_set_callback(subs->data_endpoint, - NULL, NULL, NULL); - return err; - } - } subs->running = 1; dev_dbg(&subs->dev->dev, "%d:%d Start Playback PCM\n", subs->cur_audiofmt->iface, -- cgit v1.2.3