Subject: Re: [PATCH net] net: gro_cells: Provide lockdep class for gro_cell's bh_lock

From: Jakub Kicinski <[email-masked]>
Date: Tue, 4 Nov 2025 06:05:33 -0800

On Tue, 4 Nov 2025 12:12:01 +0100 Sebastian Andrzej Siewior wrote:
> 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 <[email-masked]>
> Closes: https://lore.kernel.org/all/[email-masked]/
> Signed-off-by: Sebastian Andrzej Siewior <[email-masked]>

Breaks boot:

[    2.053035][    T1] netem: version 1.3
[    2.054087][    T1] ipip: IPv4 and MPLS over IPv4 tunneling driver
[    2.055273][    T1] BUG: key ffff888009041e10 has not been registered!
[    2.055683][    T1] ------------[ cut here ]------------
[    2.055863][    T1] DEBUG_LOCKS_WARN_ON(1)
[    2.055880][    T1] WARNING: CPU: 1 PID: 1 at kernel/locking/lockdep.c:4976 lockdep_init_map_type+0x24c/0x270
[    2.056328][    T1] Modules linked in:
[    2.056488][    T1] CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.18.0-rc3-virtme #1 PREEMPT(full) 
[    2.056792][    T1] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[    2.057007][    T1] RIP: 0010:lockdep_init_map_type+0x24c/0x270
[    2.057220][    T1] Code: ff 4c 89 e6 48 c7 c7 50 97 83 b6 e8 ee c9 01 00 e9 3d ff ff ff 90 48 c7 c6 1a 2d 7d b6 48 c7 c7 67 29 7d b6 e8 65 6e e9 ff 90 <0f> 0b 90 90 e9 47 ff ff ff 90 48 c7 c6 56 2e 7d b6 48 c7 c7 67 29
[    2.057839][    T1] RSP: 0000:ffffc90000017960 EFLAGS: 00010286
[    2.058161][    T1] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[    2.058417][    T1] RDX: 0000000000000002 RSI: 0000000000000004 RDI: 0000000000000001
[    2.058663][    T1] RBP: ffffe8ffffc01ce8 R08: 0000000000000000 R09: fffffbfff6e4090c
[    2.059045][    T1] R10: 0000000000000003 R11: 0000000000000004 R12: ffff888009041e10
[    2.059298][    T1] R13: 0000000000000000 R14: ffffe8ffffc01ad0 R15: ffffe8ffffc01a78
[    2.059657][    T1] FS:  0000000000000000(0000) GS:ffff8880ae587000(0000) knlGS:0000000000000000
[    2.059966][    T1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    2.060199][    T1] CR2: 0000000000000000 CR3: 0000000079349001 CR4: 0000000000772ef0
[    2.060559][    T1] PKRU: 55555554
[    2.060684][    T1] Call Trace:
[    2.060819][    T1]  <TASK>
[    2.060911][    T1]  gro_cells_init+0x252/0x3d0
[    2.061082][    T1]  ip_tunnel_init+0xef/0x5f0
[    2.061364][    T1]  register_netdevice+0x59f/0x17b0
[    2.061545][    T1]  ? unregister_netdevice_queue+0x410/0x410
[    2.061767][    T1]  ? alloc_netdev_mqs+0xdd7/0x1370
[    2.062035][    T1]  __ip_tunnel_create+0x326/0x440
[    2.062201][    T1]  ? ip_tunnel_add+0x180/0x180
[    2.062374][    T1]  ip_tunnel_init_net+0x16f/0x4e0
[    2.062539][    T1]  ? paint_ptr+0x3b/0x90
[    2.062666][    T1]  ? ip_tunnel_ctl+0x890/0x890
[    2.062953][    T1]  ? mark_held_locks+0x49/0x70
[    2.063125][    T1]  ? _raw_spin_unlock_irqrestore+0x59/0x70
[    2.063332][    T1]  ops_init+0x189/0x550
[    2.063469][    T1]  register_pernet_operations+0x31f/0x8b0
[    2.063747][    T1]  ? ops_undo_list+0x890/0x890
[    2.063918][    T1]  ? rwsem_down_write_slowpath+0xc60/0xc60
[    2.064134][    T1]  ? rng_is_initialized+0x20/0x20
[    2.064408][    T1]  ? __up_write+0x1ad/0x520
[    2.064584][    T1]  ? ip_mr_init+0x120/0x120
[    2.064777][    T1]  register_pernet_device+0x2a/0x60
[    2.064947][    T1]  ipip_init+0x23/0xe0
[    2.065072][    T1]  do_one_initcall+0x8c/0x1d0
[    2.065353][    T1]  ? trace_initcall_start+0x130/0x130
[    2.065535][    T1]  ? rcu_is_watching+0x12/0xb0
[    2.065700][    T1]  ? __kmalloc_noprof+0x313/0x820
[    2.065983][    T1]  ? rcu_is_watching+0x12/0xb0
[    2.066158][    T1]  do_initcalls+0x176/0x280
[    2.066383][    T1]  kernel_init_freeable+0x227/0x310
[    2.066565][    T1]  ? rest_init+0x260/0x260
[    2.066774][    T1]  kernel_init+0x20/0x1f0
[    2.066900][    T1]  ? rest_init+0x260/0x260
[    2.067062][    T1]  ? rest_init+0x260/0x260
[    2.067227][    T1]  ret_from_fork+0x1db/0x270
[    2.067397][    T1]  ? rest_init+0x260/0x260
[    2.067677][    T1]  ret_from_fork_asm+0x11/0x20
[    2.067858][    T1]  </TASK>
[    2.067995][    T1] irq event stamp: 337037
[    2.068127][    T1] hardirqs last  enabled at (337037): [<ffffffffb3bcfb47>] __up_console_sem+0x67/0x70
[    2.068525][    T1] hardirqs last disabled at (337036): [<ffffffffb3bcfb2c>] __up_console_sem+0x4c/0x70
[    2.068829][    T1] softirqs last  enabled at (336962): [<ffffffffb3a63822>] handle_softirqs+0x352/0x610
[    2.069231][    T1] softirqs last disabled at (336631): [<ffffffffb3a6408b>] irq_exit_rcu+0xab/0x100
[    2.069541][    T1] ---[ end trace 0000000000000000 ]---
[    2.073346][    T1] IPv4 over IPsec tunneling driver
[    2.077691][    T1] NET: Registered PF_INET6 protocol family
[    2.087079][    T1] Segment Routing with IPv6
[    2.087254][    T1] RPL Segment Routing with IPv6
[    2.087776][    T1] In-situ OAM (IOAM) with IPv6
[    2.092422][    T1] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    2.100954][    T1] NET: Registered PF_PACKET protocol family
[    2.102004][    T1] 8021q: 802.1Q VLAN Support v1.8
[    2.102407][    T1] 9pnet: Installing 9P2000 support
-- 
pw-bot: cr