Skip to content

Commit 31fb1bb

Browse files
Harish Bandiholtmann
authored andcommitted
Bluetooth: hci_qca: disable irqs when spinlock is acquired
Looks like Deadlock is observed in hci_qca while performing stress and stability tests. Since same lock is getting acquired from qca_wq_awake_rx and hci_ibs_tx_idle_timeout seeing spinlock recursion, irqs should be disable while acquiring the spinlock always. Signed-off-by: Harish Bandi <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 6d0762b commit 31fb1bb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/bluetooth/hci_qca.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,14 @@ static void qca_wq_awake_device(struct work_struct *work)
309309
ws_awake_device);
310310
struct hci_uart *hu = qca->hu;
311311
unsigned long retrans_delay;
312+
unsigned long flags;
312313

313314
BT_DBG("hu %p wq awake device", hu);
314315

315316
/* Vote for serial clock */
316317
serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_ON, hu);
317318

318-
spin_lock(&qca->hci_ibs_lock);
319+
spin_lock_irqsave(&qca->hci_ibs_lock, flags);
319320

320321
/* Send wake indication to device */
321322
if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0)
@@ -327,7 +328,7 @@ static void qca_wq_awake_device(struct work_struct *work)
327328
retrans_delay = msecs_to_jiffies(qca->wake_retrans);
328329
mod_timer(&qca->wake_retrans_timer, jiffies + retrans_delay);
329330

330-
spin_unlock(&qca->hci_ibs_lock);
331+
spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
331332

332333
/* Actually send the packets */
333334
hci_uart_tx_wakeup(hu);
@@ -338,12 +339,13 @@ static void qca_wq_awake_rx(struct work_struct *work)
338339
struct qca_data *qca = container_of(work, struct qca_data,
339340
ws_awake_rx);
340341
struct hci_uart *hu = qca->hu;
342+
unsigned long flags;
341343

342344
BT_DBG("hu %p wq awake rx", hu);
343345

344346
serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_ON, hu);
345347

346-
spin_lock(&qca->hci_ibs_lock);
348+
spin_lock_irqsave(&qca->hci_ibs_lock, flags);
347349
qca->rx_ibs_state = HCI_IBS_RX_AWAKE;
348350

349351
/* Always acknowledge device wake up,
@@ -354,7 +356,7 @@ static void qca_wq_awake_rx(struct work_struct *work)
354356

355357
qca->ibs_sent_wacks++;
356358

357-
spin_unlock(&qca->hci_ibs_lock);
359+
spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
358360

359361
/* Actually send the packets */
360362
hci_uart_tx_wakeup(hu);

0 commit comments

Comments
 (0)