linux/include
Joshua Washington 0e0a7e3719 xdp: create locked/unlocked instances of xdp redirect target setters
Commit 03df156dd3 ("xdp: double protect netdev->xdp_flags with
netdev->lock") introduces the netdev lock to xdp_set_features_flag().
The change includes a _locked version of the method, as it is possible
for a driver to have already acquired the netdev lock before calling
this helper. However, the same applies to
xdp_features_(set|clear)_redirect_flags(), which ends up calling the
unlocked version of xdp_set_features_flags() leading to deadlocks in
GVE, which grabs the netdev lock as part of its suspend, reset, and
shutdown processes:

[  833.265543] WARNING: possible recursive locking detected
[  833.270949] 6.15.0-rc1 #6 Tainted: G            E
[  833.276271] --------------------------------------------
[  833.281681] systemd-shutdow/1 is trying to acquire lock:
[  833.287090] ffff949d2b148c68 (&dev->lock){+.+.}-{4:4}, at: xdp_set_features_flag+0x29/0x90
[  833.295470]
[  833.295470] but task is already holding lock:
[  833.301400] ffff949d2b148c68 (&dev->lock){+.+.}-{4:4}, at: gve_shutdown+0x44/0x90 [gve]
[  833.309508]
[  833.309508] other info that might help us debug this:
[  833.316130]  Possible unsafe locking scenario:
[  833.316130]
[  833.322142]        CPU0
[  833.324681]        ----
[  833.327220]   lock(&dev->lock);
[  833.330455]   lock(&dev->lock);
[  833.333689]
[  833.333689]  *** DEADLOCK ***
[  833.333689]
[  833.339701]  May be due to missing lock nesting notation
[  833.339701]
[  833.346582] 5 locks held by systemd-shutdow/1:
[  833.351205]  #0: ffffffffa9c89130 (system_transition_mutex){+.+.}-{4:4}, at: __se_sys_reboot+0xe6/0x210
[  833.360695]  #1: ffff93b399e5c1b8 (&dev->mutex){....}-{4:4}, at: device_shutdown+0xb4/0x1f0
[  833.369144]  #2: ffff949d19a471b8 (&dev->mutex){....}-{4:4}, at: device_shutdown+0xc2/0x1f0
[  833.377603]  #3: ffffffffa9eca050 (rtnl_mutex){+.+.}-{4:4}, at: gve_shutdown+0x33/0x90 [gve]
[  833.386138]  #4: ffff949d2b148c68 (&dev->lock){+.+.}-{4:4}, at: gve_shutdown+0x44/0x90 [gve]

Introduce xdp_features_(set|clear)_redirect_target_locked() versions
which assume that the netdev lock has already been acquired before
setting the XDP feature flag and update GVE to use the locked version.

Fixes: 03df156dd3 ("xdp: double protect netdev->xdp_flags with netdev->lock")
Tested-by: Mina Almasry <almasrymina@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
Signed-off-by: Joshua Washington <joshwash@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250422011643.3509287-1-joshwash@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-04-22 19:57:56 -07:00
..
acpi misc: Constify amba_id table 2025-03-29 18:25:34 -07:00
asm-generic RISC-V Patches for the 6.15 Merge Window, Part 1 2025-04-04 09:49:17 -07:00
clocksource
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-04-17 12:26:50 -07:00
cxl cxl for v6.15 2025-04-02 20:04:43 -07:00
drm Driver Changes: 2025-04-11 09:11:08 +10:00
dt-bindings Char/Misc/IIO driver updates for 6.15-rc1 2025-04-01 11:26:08 -07:00
hyperv
keys rxrpc: Add YFS RxGK (GSSAPI) security class 2025-04-14 17:36:41 -07:00
kunit kunit: Spelling s/slowm/slow/ 2025-04-08 14:57:24 -06:00
kvm
linux net: phy: Add helper for getting MAC termination resistance 2025-04-22 17:49:48 -07:00
math-emu
media
memory
misc
net xdp: create locked/unlocked instances of xdp redirect target setters 2025-04-22 19:57:56 -07:00
pcmcia
ras
rdma RDMA/mlx5: Fix compilation warning when USER_ACCESS isn't set 2025-04-07 15:14:34 -03:00
rv
scsi
soc soc: driver updates for 6.15, part 1 2025-03-27 09:05:55 -07:00
sound soundwire updates for 6.15 2025-04-01 12:43:13 -07:00
target
trace trace: tcp: Add const qualifier to skb parameter in tcp_probe event 2025-04-17 19:04:43 -07:00
uapi net: add UAPI to the header guard in various network headers 2025-04-17 19:04:50 -07:00
ufs scsi: ufs: core: Add device level exception support 2025-04-03 10:54:31 -04:00
vdso vdso: Address variable shadowing in macros 2025-04-10 11:07:10 +02:00
video
xen
Kbuild