提交 6c409cad 编写于 作者: K Karun Eagalapati 提交者: Kalle Valo

rsi: use separate mutex lock for receive thread

Deadlock issue is observed during our stress tests. The root
cause for the issue is same lock is used between tx and rx threads.

This patch adds a separate mutex lock for rx thread to resolve
the problem.
Signed-off-by: NKarun Eagalapati <karun256@gmail.com>
Signed-off-by: NAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: NPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 ebf084ea
...@@ -221,6 +221,7 @@ struct rsi_hw *rsi_91x_init(void) ...@@ -221,6 +221,7 @@ struct rsi_hw *rsi_91x_init(void)
rsi_init_event(&common->tx_thread.event); rsi_init_event(&common->tx_thread.event);
mutex_init(&common->mutex); mutex_init(&common->mutex);
mutex_init(&common->tx_rxlock); mutex_init(&common->tx_rxlock);
mutex_init(&common->rx_lock);
if (rsi_create_kthread(common, if (rsi_create_kthread(common,
&common->tx_thread, &common->tx_thread,
......
...@@ -230,7 +230,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter) ...@@ -230,7 +230,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
dev->rx_info.sdio_int_counter++; dev->rx_info.sdio_int_counter++;
do { do {
mutex_lock(&common->tx_rxlock); mutex_lock(&common->rx_lock);
status = rsi_sdio_read_register(common->priv, status = rsi_sdio_read_register(common->priv,
RSI_FN1_INT_REGISTER, RSI_FN1_INT_REGISTER,
&isr_status); &isr_status);
...@@ -238,7 +238,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter) ...@@ -238,7 +238,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
rsi_dbg(ERR_ZONE, rsi_dbg(ERR_ZONE,
"%s: Failed to Read Intr Status Register\n", "%s: Failed to Read Intr Status Register\n",
__func__); __func__);
mutex_unlock(&common->tx_rxlock); mutex_unlock(&common->rx_lock);
return; return;
} }
adapter->interrupt_status = isr_status; adapter->interrupt_status = isr_status;
...@@ -246,7 +246,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter) ...@@ -246,7 +246,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
if (isr_status == 0) { if (isr_status == 0) {
rsi_set_event(&common->tx_thread.event); rsi_set_event(&common->tx_thread.event);
dev->rx_info.sdio_intr_status_zero++; dev->rx_info.sdio_intr_status_zero++;
mutex_unlock(&common->tx_rxlock); mutex_unlock(&common->rx_lock);
return; return;
} }
...@@ -304,7 +304,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter) ...@@ -304,7 +304,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
rsi_dbg(ERR_ZONE, rsi_dbg(ERR_ZONE,
"%s: Failed to read pkt\n", "%s: Failed to read pkt\n",
__func__); __func__);
mutex_unlock(&common->tx_rxlock); mutex_unlock(&common->rx_lock);
return; return;
} }
break; break;
...@@ -319,7 +319,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter) ...@@ -319,7 +319,7 @@ void rsi_interrupt_handler(struct rsi_hw *adapter)
} }
isr_status ^= BIT(isr_type - 1); isr_status ^= BIT(isr_type - 1);
} while (isr_status); } while (isr_status);
mutex_unlock(&common->tx_rxlock); mutex_unlock(&common->rx_lock);
} while (1); } while (1);
} }
......
...@@ -37,14 +37,14 @@ void rsi_usb_rx_thread(struct rsi_common *common) ...@@ -37,14 +37,14 @@ void rsi_usb_rx_thread(struct rsi_common *common)
if (atomic_read(&dev->rx_thread.thread_done)) if (atomic_read(&dev->rx_thread.thread_done))
goto out; goto out;
mutex_lock(&common->tx_rxlock); mutex_lock(&common->rx_lock);
status = rsi_read_pkt(common, 0); status = rsi_read_pkt(common, 0);
if (status) { if (status) {
rsi_dbg(ERR_ZONE, "%s: Failed To read data", __func__); rsi_dbg(ERR_ZONE, "%s: Failed To read data", __func__);
mutex_unlock(&common->tx_rxlock); mutex_unlock(&common->rx_lock);
return; return;
} }
mutex_unlock(&common->tx_rxlock); mutex_unlock(&common->rx_lock);
rsi_reset_event(&dev->rx_thread.event); rsi_reset_event(&dev->rx_thread.event);
if (adapter->rx_urb_submit(adapter)) { if (adapter->rx_urb_submit(adapter)) {
rsi_dbg(ERR_ZONE, rsi_dbg(ERR_ZONE,
......
...@@ -181,6 +181,8 @@ struct rsi_common { ...@@ -181,6 +181,8 @@ struct rsi_common {
struct mutex mutex; struct mutex mutex;
/* Mutex used between tx/rx threads */ /* Mutex used between tx/rx threads */
struct mutex tx_rxlock; struct mutex tx_rxlock;
/* Mutex used for rx thread */
struct mutex rx_lock;
u8 endpoint; u8 endpoint;
/* Channel/band related */ /* Channel/band related */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册