* [PATCH net v2] net: stmmac: remove unneeded stmmac_poll_controller
@ 2023-09-06 9:13 Remi Pommarel
2023-09-07 9:23 ` Paolo Abeni
0 siblings, 1 reply; 5+ messages in thread
From: Remi Pommarel @ 2023-09-06 9:13 UTC (permalink / raw)
To: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin
Cc: netdev, linux-kernel, Remi Pommarel, stable
Using netconsole netpoll_poll_dev could be called from interrupt
context, thus using disable_irq() would cause the following kernel
warning with CONFIG_DEBUG_ATOMIC_SLEEP enabled:
BUG: sleeping function called from invalid context at kernel/irq/manage.c:137
in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 10, name: ksoftirqd/0
CPU: 0 PID: 10 Comm: ksoftirqd/0 Tainted: G W 5.15.42-00075-g816b502b2298-dirty #117
Hardware name: aml (r1) (DT)
Call trace:
dump_backtrace+0x0/0x270
show_stack+0x14/0x20
dump_stack_lvl+0x8c/0xac
dump_stack+0x18/0x30
___might_sleep+0x150/0x194
__might_sleep+0x64/0xbc
synchronize_irq+0x8c/0x150
disable_irq+0x2c/0x40
stmmac_poll_controller+0x140/0x1a0
netpoll_poll_dev+0x6c/0x220
netpoll_send_skb+0x308/0x390
netpoll_send_udp+0x418/0x760
write_msg+0x118/0x140 [netconsole]
console_unlock+0x404/0x500
vprintk_emit+0x118/0x250
dev_vprintk_emit+0x19c/0x1cc
dev_printk_emit+0x90/0xa8
__dev_printk+0x78/0x9c
_dev_warn+0xa4/0xbc
ath10k_warn+0xe8/0xf0 [ath10k_core]
ath10k_htt_txrx_compl_task+0x790/0x7fc [ath10k_core]
ath10k_pci_napi_poll+0x98/0x1f4 [ath10k_pci]
__napi_poll+0x58/0x1f4
net_rx_action+0x504/0x590
_stext+0x1b8/0x418
run_ksoftirqd+0x74/0xa4
smpboot_thread_fn+0x210/0x3c0
kthread+0x1fc/0x210
ret_from_fork+0x10/0x20
Since [0] .ndo_poll_controller is only needed if driver doesn't or
partially use NAPI. Because stmmac does so, stmmac_poll_controller
can be removed fixing the above warning.
[0] commit ac3d9dd034e5 ("netpoll: make ndo_poll_controller() optional")
Cc: <stable@vger.kernel.org> # 5.15.x
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 30 -------------------
1 file changed, 30 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9a3182b9e767..8d76334fff49 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5991,33 +5991,6 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data)
return IRQ_HANDLED;
}
-#ifdef CONFIG_NET_POLL_CONTROLLER
-/* Polling receive - used by NETCONSOLE and other diagnostic tools
- * to allow network I/O with interrupts disabled.
- */
-static void stmmac_poll_controller(struct net_device *dev)
-{
- struct stmmac_priv *priv = netdev_priv(dev);
- int i;
-
- /* If adapter is down, do nothing */
- if (test_bit(STMMAC_DOWN, &priv->state))
- return;
-
- if (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN) {
- for (i = 0; i < priv->plat->rx_queues_to_use; i++)
- stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]);
-
- for (i = 0; i < priv->plat->tx_queues_to_use; i++)
- stmmac_msi_intr_tx(0, &priv->dma_conf.tx_queue[i]);
- } else {
- disable_irq(dev->irq);
- stmmac_interrupt(dev->irq, dev);
- enable_irq(dev->irq);
- }
-}
-#endif
-
/**
* stmmac_ioctl - Entry point for the Ioctl
* @dev: Device pointer.
@@ -6978,9 +6951,6 @@ static const struct net_device_ops stmmac_netdev_ops = {
.ndo_get_stats64 = stmmac_get_stats64,
.ndo_setup_tc = stmmac_setup_tc,
.ndo_select_queue = stmmac_select_queue,
-#ifdef CONFIG_NET_POLL_CONTROLLER
- .ndo_poll_controller = stmmac_poll_controller,
-#endif
.ndo_set_mac_address = stmmac_set_mac_address,
.ndo_vlan_rx_add_vid = stmmac_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = stmmac_vlan_rx_kill_vid,
--
2.40.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net v2] net: stmmac: remove unneeded stmmac_poll_controller
2023-09-06 9:13 [PATCH net v2] net: stmmac: remove unneeded stmmac_poll_controller Remi Pommarel
@ 2023-09-07 9:23 ` Paolo Abeni
2023-09-26 9:47 ` Remi Pommarel
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Abeni @ 2023-09-07 9:23 UTC (permalink / raw)
To: Remi Pommarel, Alexandre Torgue, Jose Abreu, David S. Miller,
Eric Dumazet, Jakub Kicinski, Maxime Coquelin
Cc: netdev, linux-kernel, stable
On Wed, 2023-09-06 at 11:13 +0200, Remi Pommarel wrote:
> Using netconsole netpoll_poll_dev could be called from interrupt
> context, thus using disable_irq() would cause the following kernel
> warning with CONFIG_DEBUG_ATOMIC_SLEEP enabled:
>
> BUG: sleeping function called from invalid context at kernel/irq/manage.c:137
> in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 10, name: ksoftirqd/0
> CPU: 0 PID: 10 Comm: ksoftirqd/0 Tainted: G W 5.15.42-00075-g816b502b2298-dirty #117
> Hardware name: aml (r1) (DT)
> Call trace:
> dump_backtrace+0x0/0x270
> show_stack+0x14/0x20
> dump_stack_lvl+0x8c/0xac
> dump_stack+0x18/0x30
> ___might_sleep+0x150/0x194
> __might_sleep+0x64/0xbc
> synchronize_irq+0x8c/0x150
> disable_irq+0x2c/0x40
> stmmac_poll_controller+0x140/0x1a0
> netpoll_poll_dev+0x6c/0x220
> netpoll_send_skb+0x308/0x390
> netpoll_send_udp+0x418/0x760
> write_msg+0x118/0x140 [netconsole]
> console_unlock+0x404/0x500
> vprintk_emit+0x118/0x250
> dev_vprintk_emit+0x19c/0x1cc
> dev_printk_emit+0x90/0xa8
> __dev_printk+0x78/0x9c
> _dev_warn+0xa4/0xbc
> ath10k_warn+0xe8/0xf0 [ath10k_core]
> ath10k_htt_txrx_compl_task+0x790/0x7fc [ath10k_core]
> ath10k_pci_napi_poll+0x98/0x1f4 [ath10k_pci]
> __napi_poll+0x58/0x1f4
> net_rx_action+0x504/0x590
> _stext+0x1b8/0x418
> run_ksoftirqd+0x74/0xa4
> smpboot_thread_fn+0x210/0x3c0
> kthread+0x1fc/0x210
> ret_from_fork+0x10/0x20
>
> Since [0] .ndo_poll_controller is only needed if driver doesn't or
> partially use NAPI. Because stmmac does so, stmmac_poll_controller
> can be removed fixing the above warning.
>
> [0] commit ac3d9dd034e5 ("netpoll: make ndo_poll_controller() optional")
>
> Cc: <stable@vger.kernel.org> # 5.15.x
> Signed-off-by: Remi Pommarel <repk@triplefau.lt>
I'm sorry for the incremental feedback, but we also need a suitable
Fixes tag, thanks!
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net v2] net: stmmac: remove unneeded stmmac_poll_controller
2023-09-07 9:23 ` Paolo Abeni
@ 2023-09-26 9:47 ` Remi Pommarel
2023-10-02 20:37 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Remi Pommarel @ 2023-09-26 9:47 UTC (permalink / raw)
To: Paolo Abeni
Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Maxime Coquelin, netdev, linux-kernel, stable
On Thu, Sep 07, 2023 at 11:23:16AM +0200, Paolo Abeni wrote:
> On Wed, 2023-09-06 at 11:13 +0200, Remi Pommarel wrote:
> > Using netconsole netpoll_poll_dev could be called from interrupt
> > context, thus using disable_irq() would cause the following kernel
> > warning with CONFIG_DEBUG_ATOMIC_SLEEP enabled:
> >
> > BUG: sleeping function called from invalid context at kernel/irq/manage.c:137
> > in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 10, name: ksoftirqd/0
> > CPU: 0 PID: 10 Comm: ksoftirqd/0 Tainted: G W 5.15.42-00075-g816b502b2298-dirty #117
> > Hardware name: aml (r1) (DT)
> > Call trace:
> > dump_backtrace+0x0/0x270
> > show_stack+0x14/0x20
> > dump_stack_lvl+0x8c/0xac
> > dump_stack+0x18/0x30
> > ___might_sleep+0x150/0x194
> > __might_sleep+0x64/0xbc
> > synchronize_irq+0x8c/0x150
> > disable_irq+0x2c/0x40
> > stmmac_poll_controller+0x140/0x1a0
> > netpoll_poll_dev+0x6c/0x220
> > netpoll_send_skb+0x308/0x390
> > netpoll_send_udp+0x418/0x760
> > write_msg+0x118/0x140 [netconsole]
> > console_unlock+0x404/0x500
> > vprintk_emit+0x118/0x250
> > dev_vprintk_emit+0x19c/0x1cc
> > dev_printk_emit+0x90/0xa8
> > __dev_printk+0x78/0x9c
> > _dev_warn+0xa4/0xbc
> > ath10k_warn+0xe8/0xf0 [ath10k_core]
> > ath10k_htt_txrx_compl_task+0x790/0x7fc [ath10k_core]
> > ath10k_pci_napi_poll+0x98/0x1f4 [ath10k_pci]
> > __napi_poll+0x58/0x1f4
> > net_rx_action+0x504/0x590
> > _stext+0x1b8/0x418
> > run_ksoftirqd+0x74/0xa4
> > smpboot_thread_fn+0x210/0x3c0
> > kthread+0x1fc/0x210
> > ret_from_fork+0x10/0x20
> >
> > Since [0] .ndo_poll_controller is only needed if driver doesn't or
> > partially use NAPI. Because stmmac does so, stmmac_poll_controller
> > can be removed fixing the above warning.
> >
> > [0] commit ac3d9dd034e5 ("netpoll: make ndo_poll_controller() optional")
> >
> > Cc: <stable@vger.kernel.org> # 5.15.x
> > Signed-off-by: Remi Pommarel <repk@triplefau.lt>
>
> I'm sorry for the incremental feedback, but we also need a suitable
> Fixes tag, thanks!
I didn't include Fixes tag because it would go back up to the initial
driver support commit [0]. I can't be sure that this commit includes
necessary NAPI implementation to be able to get rid of
.ndo_poll_controller callback back then. And I am not able to test it on
older version than 5.15.x hence I only included the 5.15.x Cc tag
version prerequisite.
But I surely can add a Fixed tag if it is ok for it to be [0].
Also sorry for the long replying delay.
[0] commit 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet controllers")
--
Remi
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net v2] net: stmmac: remove unneeded stmmac_poll_controller
2023-09-26 9:47 ` Remi Pommarel
@ 2023-10-02 20:37 ` Jakub Kicinski
2023-10-04 14:29 ` Remi Pommarel
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2023-10-02 20:37 UTC (permalink / raw)
To: Remi Pommarel
Cc: Paolo Abeni, Alexandre Torgue, Jose Abreu, David S. Miller,
Eric Dumazet, Maxime Coquelin, netdev, linux-kernel
On Tue, 26 Sep 2023 11:47:56 +0200 Remi Pommarel wrote:
> > I'm sorry for the incremental feedback, but we also need a suitable
> > Fixes tag, thanks!
>
> I didn't include Fixes tag because it would go back up to the initial
> driver support commit [0]. I can't be sure that this commit includes
> necessary NAPI implementation to be able to get rid of
> .ndo_poll_controller callback back then. And I am not able to test it on
> older version than 5.15.x hence I only included the 5.15.x Cc tag
> version prerequisite.
>
> But I surely can add a Fixed tag if it is ok for it to be [0].
>
> Also sorry for the long replying delay.
>
> [0] commit 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet controllers")
AFAIU the Fixes tag only indicates where the bug was present,
no guarantees on whether the fix can be backported as far back.
IOW I think [0] as Fixes tag will be perfectly correct, please
repost with it included?
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net v2] net: stmmac: remove unneeded stmmac_poll_controller
2023-10-02 20:37 ` Jakub Kicinski
@ 2023-10-04 14:29 ` Remi Pommarel
0 siblings, 0 replies; 5+ messages in thread
From: Remi Pommarel @ 2023-10-04 14:29 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Paolo Abeni, Alexandre Torgue, Jose Abreu, David S. Miller,
Eric Dumazet, Maxime Coquelin, netdev, linux-kernel
On Mon, Oct 02, 2023 at 01:37:59PM -0700, Jakub Kicinski wrote:
> On Tue, 26 Sep 2023 11:47:56 +0200 Remi Pommarel wrote:
> > > I'm sorry for the incremental feedback, but we also need a suitable
> > > Fixes tag, thanks!
> >
> > I didn't include Fixes tag because it would go back up to the initial
> > driver support commit [0]. I can't be sure that this commit includes
> > necessary NAPI implementation to be able to get rid of
> > .ndo_poll_controller callback back then. And I am not able to test it on
> > older version than 5.15.x hence I only included the 5.15.x Cc tag
> > version prerequisite.
> >
> > But I surely can add a Fixed tag if it is ok for it to be [0].
> >
> > Also sorry for the long replying delay.
> >
> > [0] commit 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet controllers")
>
> AFAIU the Fixes tag only indicates where the bug was present,
> no guarantees on whether the fix can be backported as far back.
> IOW I think [0] as Fixes tag will be perfectly correct, please
> repost with it included?
Ok that makes sense, thanks. Will resend with Fixes tag.
--
Remi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-04 14:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-06 9:13 [PATCH net v2] net: stmmac: remove unneeded stmmac_poll_controller Remi Pommarel
2023-09-07 9:23 ` Paolo Abeni
2023-09-26 9:47 ` Remi Pommarel
2023-10-02 20:37 ` Jakub Kicinski
2023-10-04 14:29 ` Remi Pommarel
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).