netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for rx queue
@ 2023-01-07 14:41 Lorenzo Bianconi
  2023-01-10  0:50 ` Alexander H Duyck
  0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2023-01-07 14:41 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, lorenzo.bianconi, nbd, john,
	sean.wang, Mark-MC.Lee, sujuan.chen, daniel

mtk_wed_wo_queue_rx_clean and mtk_wed_wo_queue_refill routines can't run
concurrently so get rid of spinlock for rx queues.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/mediatek/mtk_wed_wo.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
index a0a39643caf7..d32b86499896 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
@@ -138,7 +138,6 @@ mtk_wed_wo_queue_refill(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q,
 	enum dma_data_direction dir = rx ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
 	int n_buf = 0;
 
-	spin_lock_bh(&q->lock);
 	while (q->queued < q->n_desc) {
 		struct mtk_wed_wo_queue_entry *entry;
 		dma_addr_t addr;
@@ -172,7 +171,6 @@ mtk_wed_wo_queue_refill(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q,
 		q->queued++;
 		n_buf++;
 	}
-	spin_unlock_bh(&q->lock);
 
 	return n_buf;
 }
@@ -316,7 +314,6 @@ mtk_wed_wo_queue_rx_clean(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q)
 {
 	struct page *page;
 
-	spin_lock_bh(&q->lock);
 	for (;;) {
 		void *buf = mtk_wed_wo_dequeue(wo, q, NULL, true);
 
@@ -325,7 +322,6 @@ mtk_wed_wo_queue_rx_clean(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q)
 
 		skb_free_frag(buf);
 	}
-	spin_unlock_bh(&q->lock);
 
 	if (!q->cache.va)
 		return;
-- 
2.39.0


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

* Re: [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for rx queue
  2023-01-07 14:41 [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for rx queue Lorenzo Bianconi
@ 2023-01-10  0:50 ` Alexander H Duyck
  2023-01-10  3:37   ` Jakub Kicinski
  2023-01-10  9:09   ` Lorenzo Bianconi
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander H Duyck @ 2023-01-10  0:50 UTC (permalink / raw)
  To: Lorenzo Bianconi, netdev
  Cc: davem, edumazet, kuba, pabeni, lorenzo.bianconi, nbd, john,
	sean.wang, Mark-MC.Lee, sujuan.chen, daniel

On Sat, 2023-01-07 at 15:41 +0100, Lorenzo Bianconi wrote:
> mtk_wed_wo_queue_rx_clean and mtk_wed_wo_queue_refill routines can't run
> concurrently so get rid of spinlock for rx queues.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

My understanding is that mtk_wed_wo_queue_refill will only be called
during init and by the tasklet. The mtk_wed_wo_queue_rx_clean function
is only called during deinit and only after the tasklet has been
disabled. That is the reason they cannot run at the same time correct?

It would be nice if you explained why they couldn't run concurrently
rather than just stating it is so in the patch description. It makes it
easier to verify assumptions that way. Otherwise the patch itself looks
good to me.

Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>


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

* Re: [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for rx queue
  2023-01-10  0:50 ` Alexander H Duyck
@ 2023-01-10  3:37   ` Jakub Kicinski
  2023-01-10  9:10     ` Lorenzo Bianconi
  2023-01-10  9:09   ` Lorenzo Bianconi
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2023-01-10  3:37 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Alexander H Duyck, netdev, davem, edumazet, pabeni,
	lorenzo.bianconi, nbd, john, sean.wang, Mark-MC.Lee, sujuan.chen,
	daniel

On Mon, 09 Jan 2023 16:50:55 -0800 Alexander H Duyck wrote:
> On Sat, 2023-01-07 at 15:41 +0100, Lorenzo Bianconi wrote:
> > mtk_wed_wo_queue_rx_clean and mtk_wed_wo_queue_refill routines can't run
> > concurrently so get rid of spinlock for rx queues.

You say "for rx queues" but mtk_wed_wo_queue_refill() is also called
for tx queues.

> My understanding is that mtk_wed_wo_queue_refill will only be called
> during init and by the tasklet. The mtk_wed_wo_queue_rx_clean function
> is only called during deinit and only after the tasklet has been
> disabled. That is the reason they cannot run at the same time correct?
> 
> It would be nice if you explained why they couldn't run concurrently
> rather than just stating it is so in the patch description. It makes it
> easier to verify assumptions that way. Otherwise the patch itself looks
> good to me.

Agreed, please respin with a better commit message.

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

* Re: [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for rx queue
  2023-01-10  0:50 ` Alexander H Duyck
  2023-01-10  3:37   ` Jakub Kicinski
@ 2023-01-10  9:09   ` Lorenzo Bianconi
  1 sibling, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2023-01-10  9:09 UTC (permalink / raw)
  To: Alexander H Duyck
  Cc: Lorenzo Bianconi, netdev, davem, edumazet, kuba, pabeni, nbd,
	john, sean.wang, Mark-MC.Lee, sujuan.chen, daniel

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

> On Sat, 2023-01-07 at 15:41 +0100, Lorenzo Bianconi wrote:
> > mtk_wed_wo_queue_rx_clean and mtk_wed_wo_queue_refill routines can't run
> > concurrently so get rid of spinlock for rx queues.
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> My understanding is that mtk_wed_wo_queue_refill will only be called
> during init and by the tasklet. The mtk_wed_wo_queue_rx_clean function
> is only called during deinit and only after the tasklet has been
> disabled. That is the reason they cannot run at the same time correct?

correct

> 
> It would be nice if you explained why they couldn't run concurrently
> rather than just stating it is so in the patch description. It makes it
> easier to verify assumptions that way. Otherwise the patch itself looks
> good to me.

ack, right. I will update the commit message in v2.

Regards,
Lorenzo

> 
> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for rx queue
  2023-01-10  3:37   ` Jakub Kicinski
@ 2023-01-10  9:10     ` Lorenzo Bianconi
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2023-01-10  9:10 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Lorenzo Bianconi, Alexander H Duyck, netdev, davem, edumazet,
	pabeni, nbd, john, sean.wang, Mark-MC.Lee, sujuan.chen, daniel

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

> On Mon, 09 Jan 2023 16:50:55 -0800 Alexander H Duyck wrote:
> > On Sat, 2023-01-07 at 15:41 +0100, Lorenzo Bianconi wrote:
> > > mtk_wed_wo_queue_rx_clean and mtk_wed_wo_queue_refill routines can't run
> > > concurrently so get rid of spinlock for rx queues.
> 
> You say "for rx queues" but mtk_wed_wo_queue_refill() is also called
> for tx queues.

ack, but for tx queues is run just during initialization.

> 
> > My understanding is that mtk_wed_wo_queue_refill will only be called
> > during init and by the tasklet. The mtk_wed_wo_queue_rx_clean function
> > is only called during deinit and only after the tasklet has been
> > disabled. That is the reason they cannot run at the same time correct?
> > 
> > It would be nice if you explained why they couldn't run concurrently
> > rather than just stating it is so in the patch description. It makes it
> > easier to verify assumptions that way. Otherwise the patch itself looks
> > good to me.
> 
> Agreed, please respin with a better commit message.
> 

ack, I will post v2 with a better commit message.

Regards,
Lorenzo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2023-01-10  9:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 14:41 [PATCH net-next] net: ethernet: mtk_wed: get rid of queue lock for rx queue Lorenzo Bianconi
2023-01-10  0:50 ` Alexander H Duyck
2023-01-10  3:37   ` Jakub Kicinski
2023-01-10  9:10     ` Lorenzo Bianconi
2023-01-10  9:09   ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).