Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1467887
| From | Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v4 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop |
| Date | 2016-08-22 20:30 +0200 |
| Message-ID | <s928V-1nN-9@gated-at.bofh.it> (permalink) |
| References | <s91Zf-1iX-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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(), it can cause WARN_ONCE when ctrl
is stopping while not all packets were handled with NAPIs:
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.
Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 0/5] net: ethernet: ti: cpsw: add cpdma multi-queue support Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-22 20:20 +0200
[PATCH v4 3/5] net: ethernet: ti: cpsw: add multi queue support Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-22 20:20 +0200
Re: [PATCH v4 3/5] net: ethernet: ti: cpsw: add multi queue support Mugunthan V N <mugunthanvnm@ti.com> - 2016-08-23 07:50 +0200
[PATCH v4 5/5] net: ethernet: ti: cpsw: add ethtool channels support Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-22 20:20 +0200
[PATCH v4 4/5] net: ethernet: ti: davinci_cpdma: move cpdma channel struct macroses to internals Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-22 20:20 +0200
[PATCH v4 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-22 20:30 +0200
[PATCH v4 1/5] net: ethernet: ti: davinci_cpdma: split descs num between all channels Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> - 2016-08-22 20:30 +0200
Re: [PATCH v4 1/5] net: ethernet: ti: davinci_cpdma: split descs num between all channels Mugunthan V N <mugunthanvnm@ti.com> - 2016-08-23 07:50 +0200
Re: [PATCH v4 0/5] net: ethernet: ti: cpsw: add cpdma multi-queue support David Miller <davem@davemloft.net> - 2016-08-23 09:50 +0200
csiph-web