public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] Fix lockdep warning for htab of map
@ 2024-11-06  6:35 Hou Tao
  2024-11-06  6:35 ` [PATCH bpf-next 1/3] bpf: Call free_htab_elem() after htab_unlock_bucket() Hou Tao
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Hou Tao @ 2024-11-06  6:35 UTC (permalink / raw)
  To: bpf
  Cc: Martin KaFai Lau, Alexei Starovoitov, Andrii Nakryiko,
	Eduard Zingerman, Song Liu, Hao Luo, Yonghong Song,
	Daniel Borkmann, KP Singh, Stanislav Fomichev, Jiri Olsa,
	John Fastabend, Sebastian Andrzej Siewior, houtao1, xukuohai

From: Hou Tao <houtao1@huawei.com>

Hi,

The patch set fixes a lockdep warning for htab of map. The
warning is found when running test_maps. The warning occurs when
htab_put_fd_value() attempts to acquire map_idr_lock to free the map id
of the inner map while already holding the bucket lock (raw_spinlock_t).

The fix moves the invocation of free_htab_elem() after
htab_unlock_bucket() and adds a test case to verify the solution. Please
see the individual patches for details. Comments are always welcome.

Hou Tao (3):
  bpf: Call free_htab_elem() after htab_unlock_bucket()
  selftests/bpf: Move ENOTSUPP from bpf_util.h
  selftests/bpf: Test the update operations for htab of maps

 kernel/bpf/hashtab.c                          |  56 +++++---
 tools/testing/selftests/bpf/bpf_util.h        |   4 +
 .../selftests/bpf/prog_tests/bpf_tcp_ca.c     |   4 -
 .../selftests/bpf/prog_tests/lsm_cgroup.c     |   4 -
 .../selftests/bpf/prog_tests/map_in_map.c     | 132 +++++++++++++++++-
 .../selftests/bpf/prog_tests/sock_addr.c      |   4 -
 .../selftests/bpf/progs/update_map_in_htab.c  |  30 ++++
 tools/testing/selftests/bpf/test_maps.c       |   4 -
 tools/testing/selftests/bpf/test_verifier.c   |   4 -
 9 files changed, 204 insertions(+), 38 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/update_map_in_htab.c

-- 
2.29.2


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

end of thread, other threads:[~2024-11-09  1:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-06  6:35 [PATCH bpf-next 0/3] Fix lockdep warning for htab of map Hou Tao
2024-11-06  6:35 ` [PATCH bpf-next 1/3] bpf: Call free_htab_elem() after htab_unlock_bucket() Hou Tao
2024-11-06  9:53   ` Hou Tao
2024-11-08 19:55     ` Alexei Starovoitov
2024-11-09  1:29       ` Hou Tao
2024-11-06  6:35 ` [PATCH bpf-next 2/3] selftests/bpf: Move ENOTSUPP from bpf_util.h Hou Tao
2024-11-06  6:35 ` [PATCH bpf-next 3/3] selftests/bpf: Test the update operations for htab of maps Hou Tao
2024-11-06  8:45 ` [PATCH bpf-next 0/3] Fix lockdep warning for htab of map Sebastian Andrzej Siewior
2024-11-06  9:48   ` Hou Tao
2024-11-06 10:05     ` Sebastian Andrzej Siewior
2024-11-08 19:52     ` Alexei Starovoitov
2024-11-09  1:48       ` Hou Tao
2024-11-09  1:55         ` Alexei Starovoitov
2024-11-08 19:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox