netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mlx5e: add add missing BH locking around napi_schdule()
@ 2021-05-05 20:20 Jakub Kicinski
  2021-05-18 19:23 ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2021-05-05 20:20 UTC (permalink / raw)
  To: saeedm, eric.dumazet; +Cc: netdev, Jakub Kicinski

It's not correct to call napi_schedule() in pure process
context. Because we use __raise_softirq_irqoff() we require
callers to be in a context which will eventually lead to
softirq handling (hardirq, bh disabled, etc.).

With code as is users will see:

 NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!

Fixes: a8dd7ac12fc3 ("net/mlx5e: Generalize RQ activation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
We may want to patch net-next once it opens to switch
from __raise_softirq_irqoff() to raise_softirq_irqoff().
The irq_count() check is probably negligable and we'd need
to split the hardirq / non-hardirq paths completely to
keep the current behaviour. Plus what's hardirq is murky
with RT enabled..

Eric WDYT?

 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index bca832cdc4cb..11e50f5b3a1e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -889,10 +889,13 @@ int mlx5e_open_rq(struct mlx5e_params *params, struct mlx5e_rq_param *param,
 void mlx5e_activate_rq(struct mlx5e_rq *rq)
 {
 	set_bit(MLX5E_RQ_STATE_ENABLED, &rq->state);
-	if (rq->icosq)
+	if (rq->icosq) {
 		mlx5e_trigger_irq(rq->icosq);
-	else
+	} else {
+		local_bh_disable();
 		napi_schedule(rq->cq.napi);
+		local_bh_enable();
+	}
 }
 
 void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
-- 
2.31.1


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

end of thread, other threads:[~2021-05-18 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 20:20 [PATCH net] mlx5e: add add missing BH locking around napi_schdule() Jakub Kicinski
2021-05-18 19:23 ` Saeed Mahameed
2021-05-18 19:33   ` Jakub Kicinski

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).