Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1463271 > unrolled thread

[PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop

Started byIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
First post2016-08-16 01:30 +0200
Last post2016-08-17 07:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-16 01:30 +0200
    Re: [PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking  while ctrl_stop Mugunthan V N <mugunthanvnm@ti.com> - 2016-08-17 07:50 +0200

#1463271 — [PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop

FromIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date2016-08-16 01:30 +0200
Subject[PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop
Message-ID<s6zup-3Hz-3@gated-at.bofh.it>
The interrupts shouldn't be disabled while receiving skb, but while
ctrl_stop, the channels are stopped and all remaining packets are
handled with netif_receive_skb():

lock_irq_save
    cpdma_ctlr_stop
       cpdma_chan_top
           __cpdma_chan_free
               cpsw_rx_handler
                   netif_receive_skb

So, split locking while ctrl stop thus interrupts are still
enabled while skbs handling. It can cause WARN_ONCE in rare
cases when ctrl is stopping while not all packets were handled
with NAPIs.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 drivers/net/ethernet/ti/davinci_cpdma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 167fd65..ffb32af 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -334,12 +334,14 @@ int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr)
 	}
 
 	ctlr->state = CPDMA_STATE_TEARDOWN;
+	spin_unlock_irqrestore(&ctlr->lock, flags);
 
 	for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) {
 		if (ctlr->channels[i])
 			cpdma_chan_stop(ctlr->channels[i]);
 	}
 
+	spin_lock_irqsave(&ctlr->lock, flags);
 	dma_reg_write(ctlr, CPDMA_RXINTMASKCLEAR, 0xffffffff);
 	dma_reg_write(ctlr, CPDMA_TXINTMASKCLEAR, 0xffffffff);
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1464330 — Re: [PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop

FromMugunthan V N <mugunthanvnm@ti.com>
Date2016-08-17 07:50 +0200
SubjectRe: [PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop
Message-ID<s71TI-5aR-5@gated-at.bofh.it>
In reply to#1463271
On Tuesday 16 August 2016 04:55 AM, Ivan Khoronzhuk wrote:
> The interrupts shouldn't be disabled while receiving skb, but while
> ctrl_stop, the channels are stopped and all remaining packets are
> handled with netif_receive_skb():
> 
> lock_irq_save
>     cpdma_ctlr_stop
>        cpdma_chan_top
>            __cpdma_chan_free
>                cpsw_rx_handler
>                    netif_receive_skb
> 
> So, split locking while ctrl stop thus interrupts are still
> enabled while skbs handling. It can cause WARN_ONCE in rare
> cases when ctrl is stopping while not all packets were handled
> with NAPIs.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web