All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v3] net: wwan: t7xx: fix GFP_KERNEL usage in spin_lock context
@ 2022-05-19  7:43 Ziyang Xuan
  2022-05-19  7:29 ` Loic Poulain
  0 siblings, 1 reply; 5+ messages in thread
From: Ziyang Xuan @ 2022-05-19  7:43 UTC (permalink / raw)
  To: chandrashekar.devegowda, linuxwwan, chiranjeevi.rapolu,
	haijun.liu, m.chetan.kumar, ricardo.martinez, loic.poulain,
	ryazanov.s.a, johannes, davem, edumazet, kuba, pabeni, netdev

t7xx_cldma_clear_rxq() call t7xx_cldma_alloc_and_map_skb() in spin_lock
context, But __dev_alloc_skb() in t7xx_cldma_alloc_and_map_skb() uses
GFP_KERNEL, that will introduce scheduling factor in spin_lock context.

Because t7xx_cldma_clear_rxq() is called after stopping CLDMA, so we can
remove the spin_lock from t7xx_cldma_clear_rxq().

Fixes: 39d439047f1d ("net: wwan: t7xx: Add control DMA interface")
Suggested-by: Ricardo Martinez <ricardo.martinez@linux.intel.com>
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
 drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
v3:
  - Add Suggested-by and simplify comments
v2:
  - Remove spin_lock instead of using GFP_ATOMIC

diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
index 46066dcd2607..3a46a5bea24f 100644
--- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
+++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
@@ -782,10 +782,11 @@ static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
 	struct cldma_queue *rxq = &md_ctrl->rxq[qnum];
 	struct cldma_request *req;
 	struct cldma_gpd *gpd;
-	unsigned long flags;
 	int ret = 0;
 
-	spin_lock_irqsave(&rxq->ring_lock, flags);
+	/* CLDMA has been stopped. There is not any CLDMA IRQ, holding
+	 * ring_lock is not needed.
+	 */
 	t7xx_cldma_q_reset(rxq);
 	list_for_each_entry(req, &rxq->tr_ring->gpd_ring, entry) {
 		gpd = req->gpd;
@@ -808,7 +809,6 @@ static int t7xx_cldma_clear_rxq(struct cldma_ctrl *md_ctrl, int qnum)
 
 		t7xx_cldma_gpd_set_data_ptr(req->gpd, req->mapped_buff);
 	}
-	spin_unlock_irqrestore(&rxq->ring_lock, flags);
 
 	return ret;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-21 17:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19  7:43 [PATCH net-next v3] net: wwan: t7xx: fix GFP_KERNEL usage in spin_lock context Ziyang Xuan
2022-05-19  7:29 ` Loic Poulain
2022-05-21  0:25   ` Jakub Kicinski
2022-05-21  1:01     ` Jakub Kicinski
2022-05-21 17:26       ` Loic Poulain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.