diff mbox series

[v2] net: ntb_netdev: Move ntb_netdev_rx_handler() to call netif_rx() from __netif_rx()

Message ID 20240701181538.3799546-1-dave.jiang@intel.com (mailing list archive)
State Accepted
Commit e15a5d821e5192a3769d846079bc9aa380139baf
Delegated to: Netdev Maintainers
Headers show
Series [v2] net: ntb_netdev: Move ntb_netdev_rx_handler() to call netif_rx() from __netif_rx() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 839 this patch: 839
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 1 blamed authors not CCed: gregkh@linuxfoundation.org; 2 maintainers not CCed: pabeni@redhat.com gregkh@linuxfoundation.org
netdev/build_clang success Errors and warnings before: 846 this patch: 846
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 846 this patch: 846
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-01--21-00 (tests: 665)

Commit Message

Dave Jiang July 1, 2024, 6:15 p.m. UTC
The following is emitted when using idxd (DSA) dmanegine as the data
mover for ntb_transport that ntb_netdev uses.

[74412.546922] BUG: using smp_processor_id() in preemptible [00000000] code: irq/52-idxd-por/14526
[74412.556784] caller is netif_rx_internal+0x42/0x130
[74412.562282] CPU: 6 PID: 14526 Comm: irq/52-idxd-por Not tainted 6.9.5 #5
[74412.569870] Hardware name: Intel Corporation ArcherCity/ArcherCity, BIOS EGSDCRB1.E9I.1752.P05.2402080856 02/08/2024
[74412.581699] Call Trace:
[74412.584514]  <TASK>
[74412.586933]  dump_stack_lvl+0x55/0x70
[74412.591129]  check_preemption_disabled+0xc8/0xf0
[74412.596374]  netif_rx_internal+0x42/0x130
[74412.600957]  __netif_rx+0x20/0xd0
[74412.604743]  ntb_netdev_rx_handler+0x66/0x150 [ntb_netdev]
[74412.610985]  ntb_complete_rxc+0xed/0x140 [ntb_transport]
[74412.617010]  ntb_rx_copy_callback+0x53/0x80 [ntb_transport]
[74412.623332]  idxd_dma_complete_txd+0xe3/0x160 [idxd]
[74412.628963]  idxd_wq_thread+0x1a6/0x2b0 [idxd]
[74412.634046]  irq_thread_fn+0x21/0x60
[74412.638134]  ? irq_thread+0xa8/0x290
[74412.642218]  irq_thread+0x1a0/0x290
[74412.646212]  ? __pfx_irq_thread_fn+0x10/0x10
[74412.651071]  ? __pfx_irq_thread_dtor+0x10/0x10
[74412.656117]  ? __pfx_irq_thread+0x10/0x10
[74412.660686]  kthread+0x100/0x130
[74412.664384]  ? __pfx_kthread+0x10/0x10
[74412.668639]  ret_from_fork+0x31/0x50
[74412.672716]  ? __pfx_kthread+0x10/0x10
[74412.676978]  ret_from_fork_asm+0x1a/0x30
[74412.681457]  </TASK>

The cause is due to the idxd driver interrupt completion handler uses
threaded interrupt and the threaded handler is not hard or soft interrupt
context. However __netif_rx() can only be called from interrupt context.
Change the call to netif_rx() in order to allow completion via normal
context for dmaengine drivers that utilize threaded irq handling.

While the following commit changed from netif_rx() to __netif_rx(),
baebdf48c360 ("net: dev: Makes sure netif_rx() can be invoked in any context."),
the change should've been a noop instead. However, the code precedes this
fix should've been using netif_rx_ni() or netif_rx_any_context().

Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device")
Reported-by: Jerry Dai <jerry.dai@intel.com>
Tested-by: Jerry Dai <jerry.dai@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

---
v2:
- Move fixes tag to original issue (Jakub)
  - I couldn't find the special dependency tag to make note of the situation.
---
 drivers/net/ntb_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 3, 2024, 2 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  1 Jul 2024 11:15:38 -0700 you wrote:
> The following is emitted when using idxd (DSA) dmanegine as the data
> mover for ntb_transport that ntb_netdev uses.
> 
> [74412.546922] BUG: using smp_processor_id() in preemptible [00000000] code: irq/52-idxd-por/14526
> [74412.556784] caller is netif_rx_internal+0x42/0x130
> [74412.562282] CPU: 6 PID: 14526 Comm: irq/52-idxd-por Not tainted 6.9.5 #5
> [74412.569870] Hardware name: Intel Corporation ArcherCity/ArcherCity, BIOS EGSDCRB1.E9I.1752.P05.2402080856 02/08/2024
> [74412.581699] Call Trace:
> [74412.584514]  <TASK>
> [74412.586933]  dump_stack_lvl+0x55/0x70
> [74412.591129]  check_preemption_disabled+0xc8/0xf0
> [74412.596374]  netif_rx_internal+0x42/0x130
> [74412.600957]  __netif_rx+0x20/0xd0
> [74412.604743]  ntb_netdev_rx_handler+0x66/0x150 [ntb_netdev]
> [74412.610985]  ntb_complete_rxc+0xed/0x140 [ntb_transport]
> [74412.617010]  ntb_rx_copy_callback+0x53/0x80 [ntb_transport]
> [74412.623332]  idxd_dma_complete_txd+0xe3/0x160 [idxd]
> [74412.628963]  idxd_wq_thread+0x1a6/0x2b0 [idxd]
> [74412.634046]  irq_thread_fn+0x21/0x60
> [74412.638134]  ? irq_thread+0xa8/0x290
> [74412.642218]  irq_thread+0x1a0/0x290
> [74412.646212]  ? __pfx_irq_thread_fn+0x10/0x10
> [74412.651071]  ? __pfx_irq_thread_dtor+0x10/0x10
> [74412.656117]  ? __pfx_irq_thread+0x10/0x10
> [74412.660686]  kthread+0x100/0x130
> [74412.664384]  ? __pfx_kthread+0x10/0x10
> [74412.668639]  ret_from_fork+0x31/0x50
> [74412.672716]  ? __pfx_kthread+0x10/0x10
> [74412.676978]  ret_from_fork_asm+0x1a/0x30
> [74412.681457]  </TASK>
> 
> [...]

Here is the summary with links:
  - [v2] net: ntb_netdev: Move ntb_netdev_rx_handler() to call netif_rx() from __netif_rx()
    https://git.kernel.org/netdev/net/c/e15a5d821e51

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index 536bd6564f8b..dade51cf599c 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -119,7 +119,7 @@  static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
 	skb->protocol = eth_type_trans(skb, ndev);
 	skb->ip_summed = CHECKSUM_NONE;
 
-	if (__netif_rx(skb) == NET_RX_DROP) {
+	if (netif_rx(skb) == NET_RX_DROP) {
 		ndev->stats.rx_errors++;
 		ndev->stats.rx_dropped++;
 	} else {