]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.30/alsa-hda-fix-cpu-lockup-when-stopping-the-cmd-dmas.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.9.30 / alsa-hda-fix-cpu-lockup-when-stopping-the-cmd-dmas.patch
CommitLineData
78ae8c80
GKH
1From 960013762df0a214b57f2fce655422fb52bdfd2c Mon Sep 17 00:00:00 2001
2From: Jeeja KP <jeeja.kp@intel.com>
3Date: Wed, 10 May 2017 11:51:58 +0530
4Subject: ALSA: hda: Fix cpu lockup when stopping the cmd dmas
5
6From: Jeeja KP <jeeja.kp@intel.com>
7
8commit 960013762df0a214b57f2fce655422fb52bdfd2c upstream.
9
10Using jiffies in hdac_wait_for_cmd_dmas() to determine when to time out
11when interrupts are off (snd_hdac_bus_stop_cmd_io()/spin_lock_irq())
12causes hard lockup so unlock while waiting using jiffies.
13
14---<-snip->---
15<0>[ 1211.603046] NMI watchdog: Watchdog detected hard LOCKUP on cpu 3
16<4>[ 1211.603047] Modules linked in: snd_hda_intel i915 vgem
17<4>[ 1211.603053] irq event stamp: 13366
18<4>[ 1211.603053] hardirqs last enabled at (13365):
19...
20<4>[ 1211.603059] Call Trace:
21<4>[ 1211.603059] ? delay_tsc+0x3d/0xc0
22<4>[ 1211.603059] __delay+0xa/0x10
23<4>[ 1211.603060] __const_udelay+0x31/0x40
24<4>[ 1211.603060] snd_hdac_bus_stop_cmd_io+0x96/0xe0 [snd_hda_core]
25<4>[ 1211.603060] ? azx_dev_disconnect+0x20/0x20 [snd_hda_intel]
26<4>[ 1211.603061] snd_hdac_bus_stop_chip+0xb1/0x100 [snd_hda_core]
27<4>[ 1211.603061] azx_stop_chip+0x9/0x10 [snd_hda_codec]
28<4>[ 1211.603061] azx_suspend+0x72/0x220 [snd_hda_intel]
29<4>[ 1211.603061] pci_pm_suspend+0x71/0x140
30<4>[ 1211.603062] dpm_run_callback+0x6f/0x330
31<4>[ 1211.603062] ? pci_pm_freeze+0xe0/0xe0
32<4>[ 1211.603062] __device_suspend+0xf9/0x370
33<4>[ 1211.603062] ? dpm_watchdog_set+0x60/0x60
34<4>[ 1211.603063] async_suspend+0x1a/0x90
35<4>[ 1211.603063] async_run_entry_fn+0x34/0x160
36<4>[ 1211.603063] process_one_work+0x1f4/0x6d0
37<4>[ 1211.603063] ? process_one_work+0x16e/0x6d0
38<4>[ 1211.603064] worker_thread+0x49/0x4a0
39<4>[ 1211.603064] kthread+0x107/0x140
40<4>[ 1211.603064] ? process_one_work+0x6d0/0x6d0
41<4>[ 1211.603065] ? kthread_create_on_node+0x40/0x40
42<4>[ 1211.603065] ret_from_fork+0x2e/0x40
43
44Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100419
45Fixes: 38b19ed7f81ec ("ALSA: hda: fix to wait for RIRB & CORB DMA to set")
46Reported-by: Marta Lofstedt <marta.lofstedt@intel.com>
47Suggested-by: Takashi Iwai <tiwai@suse.de>
48Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
49Acked-by: Vinod Koul <vinod.koul@intel.com>
50Signed-off-by: Takashi Iwai <tiwai@suse.de>
51Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
52
53---
54 sound/hda/hdac_controller.c | 4 ++++
55 1 file changed, 4 insertions(+)
56
57--- a/sound/hda/hdac_controller.c
58+++ b/sound/hda/hdac_controller.c
59@@ -106,7 +106,11 @@ void snd_hdac_bus_stop_cmd_io(struct hda
60 /* disable ringbuffer DMAs */
61 snd_hdac_chip_writeb(bus, RIRBCTL, 0);
62 snd_hdac_chip_writeb(bus, CORBCTL, 0);
63+ spin_unlock_irq(&bus->reg_lock);
64+
65 hdac_wait_for_cmd_dmas(bus);
66+
67+ spin_lock_irq(&bus->reg_lock);
68 /* disable unsolicited responses */
69 snd_hdac_chip_updatel(bus, GCTL, AZX_GCTL_UNSOL, 0);
70 spin_unlock_irq(&bus->reg_lock);