netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: gro_cells: Provide lockdep class for gro_cell's bh_lock
@ 2025-11-04 11:12 Sebastian Andrzej Siewior
  2025-11-04 14:05 ` Jakub Kicinski
  2025-11-04 14:22 ` [syzbot ci] Re: net: gro_cells: Provide lockdep class for gro_cell's bh_lock syzbot ci
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-11-04 11:12 UTC (permalink / raw)
  To: netdev
  Cc: Eric Dumazet, Gal Pressman, linux-rt-devel, David S. Miller,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Clark Williams,
	Steven Rostedt

One GRO-cell device's NAPI callback can nest into the GRO-cell of
another device if the underlying device is also using GRO-cell.
This is the case for IPsec over vxlan.
These two GRO-cells are separate devices. From lockdep's point of view
it is the same because each device is sharing the same lock class and so
it reports a possible deadlock assuming one device is nesting into
itself.

Provide a lockclass for the bh_lock on for gro-cell device allowing
lockdep to distinguish between individual devices.

Fixes: 25718fdcbdd2 ("net: gro_cells: Use nested-BH locking for gro_cell")
Reported-by: Gal Pressman <gal@nvidia.com>
Closes: https://lore.kernel.org/all/66664116-edb8-48dc-ad72-d5223696dd19@nvidia.com/
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/net/gro_cells.h | 1 +
 net/core/gro_cells.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h
index 596688b67a2a8..2453d0139c205 100644
--- a/include/net/gro_cells.h
+++ b/include/net/gro_cells.h
@@ -10,6 +10,7 @@ struct gro_cell;
 
 struct gro_cells {
 	struct gro_cell __percpu	*cells;
+	struct lock_class_key		cells_bh_key;
 };
 
 int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb);
diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
index fd57b845de333..a91fdc47e8096 100644
--- a/net/core/gro_cells.c
+++ b/net/core/gro_cells.c
@@ -88,6 +88,7 @@ int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
 
 		__skb_queue_head_init(&cell->napi_skbs);
 		local_lock_init(&cell->bh_lock);
+		lockdep_set_class(&cell->bh_lock, &gcells->cells_bh_key);
 
 		set_bit(NAPI_STATE_NO_BUSY_POLL, &cell->napi.state);
 
-- 
2.51.0


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

end of thread, other threads:[~2025-11-06  1:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 11:12 [PATCH net] net: gro_cells: Provide lockdep class for gro_cell's bh_lock Sebastian Andrzej Siewior
2025-11-04 14:05 ` Jakub Kicinski
2025-11-04 15:34   ` [PATCH net v2] net: gro_cells: Reduce lock scope in gro_cell_poll Sebastian Andrzej Siewior
2025-11-06  1:50     ` patchwork-bot+netdevbpf
2025-11-04 14:22 ` [syzbot ci] Re: net: gro_cells: Provide lockdep class for gro_cell's bh_lock syzbot ci

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