-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel…
…/git/bpf/bpf-next Daniel Borkmann says: ==================== pull-request: bpf-next 2023-05-16 We've added 57 non-merge commits during the last 19 day(s) which contain a total of 63 files changed, 3293 insertions(+), 690 deletions(-). The main changes are: 1) Add precision propagation to verifier for subprogs and callbacks, from Andrii Nakryiko. 2) Improve BPF's {g,s}setsockopt() handling with wrong option lengths, from Stanislav Fomichev. 3) Utilize pahole v1.25 for the kernel's BTF generation to filter out inconsistent function prototypes, from Alan Maguire. 4) Various dyn-pointer verifier improvements to relax restrictions, from Daniel Rosenberg. 5) Add a new bpf_task_under_cgroup() kfunc for designated task, from Feng Zhou. 6) Unblock tests for arm64 BPF CI after ftrace supporting direct call, from Florent Revest. 7) Add XDP hint kfunc metadata for RX hash/timestamp for igc, from Jesper Dangaard Brouer. 8) Add several new dyn-pointer kfuncs to ease their usability, from Joanne Koong. 9) Add in-depth LRU internals description and dot function graph, from Joe Stringer. 10) Fix KCSAN report on bpf_lru_list when accessing node->ref, from Martin KaFai Lau. 11) Only dump unprivileged_bpf_disabled log warning upon write, from Kui-Feng Lee. 12) Extend test_progs to directly passing allow/denylist file, from Stephen Veiss. 13) Fix BPF trampoline memleak upon failure attaching to fentry, from Yafang Shao. 14) Fix emitting struct bpf_tcp_sock type in vmlinux BTF, from Yonghong Song. * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (57 commits) bpf: Fix memleak due to fentry attach failure bpf: Remove bpf trampoline selector bpf, arm64: Support struct arguments in the BPF trampoline bpftool: JIT limited misreported as negative value on aarch64 bpf: fix calculation of subseq_idx during precision backtracking bpf: Remove anonymous union in bpf_kfunc_call_arg_meta bpf: Document EFAULT changes for sockopt selftests/bpf: Correctly handle optlen > 4096 selftests/bpf: Update EFAULT {g,s}etsockopt selftests bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen libbpf: fix offsetof() and container_of() to work with CO-RE bpf: Address KCSAN report on bpf_lru_list bpf: Add --skip_encoding_btf_inconsistent_proto, --btf_gen_optimized to pahole flags for v1.25 selftests/bpf: Accept mem from dynptr in helper funcs bpf: verifier: Accept dynptr mem as mem in helpers selftests/bpf: Check overflow in optional buffer selftests/bpf: Test allowing NULL buffer in dynptr slice bpf: Allow NULL buffers in bpf_dynptr_slice(_rw) selftests/bpf: Add testcase for bpf_task_under_cgroup bpf: Add bpf_task_under_cgroup() kfunc ... ==================== Link: https://lore.kernel.org/r/20230515225603.27027-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Showing
63 changed files
with
3,293 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
// Copyright (C) 2022-2023 Isovalent, Inc. | ||
digraph { | ||
node [colorscheme=accent4,style=filled] # Apply colorscheme to all nodes | ||
graph [splines=ortho, nodesep=1] | ||
|
||
subgraph cluster_key { | ||
label = "Key\n(locks held during operation)"; | ||
rankdir = TB; | ||
|
||
remote_lock [shape=rectangle,fillcolor=4,label="remote CPU LRU lock"] | ||
hash_lock [shape=rectangle,fillcolor=3,label="hashtab lock"] | ||
lru_lock [shape=rectangle,fillcolor=2,label="LRU lock"] | ||
local_lock [shape=rectangle,fillcolor=1,label="local CPU LRU lock"] | ||
no_lock [shape=rectangle,label="no locks held"] | ||
} | ||
|
||
begin [shape=oval,label="begin\nbpf_map_update()"] | ||
|
||
// Nodes below with an 'fn_' prefix are roughly labeled by the C function | ||
// names that initiate the corresponding logic in kernel/bpf/bpf_lru_list.c. | ||
// Number suffixes and errno suffixes handle subsections of the corresponding | ||
// logic in the function as of the writing of this dot. | ||
|
||
// cf. __local_list_pop_free() / bpf_percpu_lru_pop_free() | ||
local_freelist_check [shape=diamond,fillcolor=1, | ||
label="Local freelist\nnode available?"]; | ||
use_local_node [shape=rectangle, | ||
label="Use node owned\nby this CPU"] | ||
|
||
// cf. bpf_lru_pop_free() | ||
common_lru_check [shape=diamond, | ||
label="Map created with\ncommon LRU?\n(!BPF_F_NO_COMMON_LRU)"]; | ||
|
||
fn_bpf_lru_list_pop_free_to_local [shape=rectangle,fillcolor=2, | ||
label="Flush local pending, | ||
Rotate Global list, move | ||
LOCAL_FREE_TARGET | ||
from global -> local"] | ||
// Also corresponds to: | ||
// fn__local_list_flush() | ||
// fn_bpf_lru_list_rotate() | ||
fn___bpf_lru_node_move_to_free[shape=diamond,fillcolor=2, | ||
label="Able to free\nLOCAL_FREE_TARGET\nnodes?"] | ||
|
||
fn___bpf_lru_list_shrink_inactive [shape=rectangle,fillcolor=3, | ||
label="Shrink inactive list | ||
up to remaining | ||
LOCAL_FREE_TARGET | ||
(global LRU -> local)"] | ||
fn___bpf_lru_list_shrink [shape=diamond,fillcolor=2, | ||
label="> 0 entries in\nlocal free list?"] | ||
fn___bpf_lru_list_shrink2 [shape=rectangle,fillcolor=2, | ||
label="Steal one node from | ||
inactive, or if empty, | ||
from active global list"] | ||
fn___bpf_lru_list_shrink3 [shape=rectangle,fillcolor=3, | ||
label="Try to remove\nnode from hashtab"] | ||
|
||
local_freelist_check2 [shape=diamond,label="Htab removal\nsuccessful?"] | ||
common_lru_check2 [shape=diamond, | ||
label="Map created with\ncommon LRU?\n(!BPF_F_NO_COMMON_LRU)"]; | ||
|
||
subgraph cluster_remote_lock { | ||
label = "Iterate through CPUs\n(start from current)"; | ||
style = dashed; | ||
rankdir=LR; | ||
|
||
local_freelist_check5 [shape=diamond,fillcolor=4, | ||
label="Steal a node from\nper-cpu freelist?"] | ||
local_freelist_check6 [shape=rectangle,fillcolor=4, | ||
label="Steal a node from | ||
(1) Unreferenced pending, or | ||
(2) Any pending node"] | ||
local_freelist_check7 [shape=rectangle,fillcolor=3, | ||
label="Try to remove\nnode from hashtab"] | ||
fn_htab_lru_map_update_elem [shape=diamond, | ||
label="Stole node\nfrom remote\nCPU?"] | ||
fn_htab_lru_map_update_elem2 [shape=diamond,label="Iterated\nall CPUs?"] | ||
// Also corresponds to: | ||
// use_local_node() | ||
// fn__local_list_pop_pending() | ||
} | ||
|
||
fn_bpf_lru_list_pop_free_to_local2 [shape=rectangle, | ||
label="Use node that was\nnot recently referenced"] | ||
local_freelist_check4 [shape=rectangle, | ||
label="Use node that was\nactively referenced\nin global list"] | ||
fn_htab_lru_map_update_elem_ENOMEM [shape=oval,label="return -ENOMEM"] | ||
fn_htab_lru_map_update_elem3 [shape=rectangle, | ||
label="Use node that was\nactively referenced\nin (another?) CPU's cache"] | ||
fn_htab_lru_map_update_elem4 [shape=rectangle,fillcolor=3, | ||
label="Update hashmap\nwith new element"] | ||
fn_htab_lru_map_update_elem5 [shape=oval,label="return 0"] | ||
fn_htab_lru_map_update_elem_EBUSY [shape=oval,label="return -EBUSY"] | ||
fn_htab_lru_map_update_elem_EEXIST [shape=oval,label="return -EEXIST"] | ||
fn_htab_lru_map_update_elem_ENOENT [shape=oval,label="return -ENOENT"] | ||
|
||
begin -> local_freelist_check | ||
local_freelist_check -> use_local_node [xlabel="Y"] | ||
local_freelist_check -> common_lru_check [xlabel="N"] | ||
common_lru_check -> fn_bpf_lru_list_pop_free_to_local [xlabel="Y"] | ||
common_lru_check -> fn___bpf_lru_list_shrink_inactive [xlabel="N"] | ||
fn_bpf_lru_list_pop_free_to_local -> fn___bpf_lru_node_move_to_free | ||
fn___bpf_lru_node_move_to_free -> | ||
fn_bpf_lru_list_pop_free_to_local2 [xlabel="Y"] | ||
fn___bpf_lru_node_move_to_free -> | ||
fn___bpf_lru_list_shrink_inactive [xlabel="N"] | ||
fn___bpf_lru_list_shrink_inactive -> fn___bpf_lru_list_shrink | ||
fn___bpf_lru_list_shrink -> fn_bpf_lru_list_pop_free_to_local2 [xlabel = "Y"] | ||
fn___bpf_lru_list_shrink -> fn___bpf_lru_list_shrink2 [xlabel="N"] | ||
fn___bpf_lru_list_shrink2 -> fn___bpf_lru_list_shrink3 | ||
fn___bpf_lru_list_shrink3 -> local_freelist_check2 | ||
local_freelist_check2 -> local_freelist_check4 [xlabel = "Y"] | ||
local_freelist_check2 -> common_lru_check2 [xlabel = "N"] | ||
common_lru_check2 -> local_freelist_check5 [xlabel = "Y"] | ||
common_lru_check2 -> fn_htab_lru_map_update_elem_ENOMEM [xlabel = "N"] | ||
local_freelist_check5 -> fn_htab_lru_map_update_elem [xlabel = "Y"] | ||
local_freelist_check5 -> local_freelist_check6 [xlabel = "N"] | ||
local_freelist_check6 -> local_freelist_check7 | ||
local_freelist_check7 -> fn_htab_lru_map_update_elem | ||
|
||
fn_htab_lru_map_update_elem -> fn_htab_lru_map_update_elem3 [xlabel = "Y"] | ||
fn_htab_lru_map_update_elem -> fn_htab_lru_map_update_elem2 [xlabel = "N"] | ||
fn_htab_lru_map_update_elem2 -> | ||
fn_htab_lru_map_update_elem_ENOMEM [xlabel = "Y"] | ||
fn_htab_lru_map_update_elem2 -> local_freelist_check5 [xlabel = "N"] | ||
fn_htab_lru_map_update_elem3 -> fn_htab_lru_map_update_elem4 | ||
|
||
use_local_node -> fn_htab_lru_map_update_elem4 | ||
fn_bpf_lru_list_pop_free_to_local2 -> fn_htab_lru_map_update_elem4 | ||
local_freelist_check4 -> fn_htab_lru_map_update_elem4 | ||
|
||
fn_htab_lru_map_update_elem4 -> fn_htab_lru_map_update_elem5 [headlabel="Success"] | ||
fn_htab_lru_map_update_elem4 -> | ||
fn_htab_lru_map_update_elem_EBUSY [xlabel="Hashtab lock failed"] | ||
fn_htab_lru_map_update_elem4 -> | ||
fn_htab_lru_map_update_elem_EEXIST [xlabel="BPF_EXIST set and\nkey already exists"] | ||
fn_htab_lru_map_update_elem4 -> | ||
fn_htab_lru_map_update_elem_ENOENT [headlabel="BPF_NOEXIST set\nand no such entry"] | ||
|
||
// Create invisible pad nodes to line up various nodes | ||
pad0 [style=invis] | ||
pad1 [style=invis] | ||
pad2 [style=invis] | ||
pad3 [style=invis] | ||
pad4 [style=invis] | ||
|
||
// Line up the key with the top of the graph | ||
no_lock -> local_lock [style=invis] | ||
local_lock -> lru_lock [style=invis] | ||
lru_lock -> hash_lock [style=invis] | ||
hash_lock -> remote_lock [style=invis] | ||
remote_lock -> local_freelist_check5 [style=invis] | ||
remote_lock -> fn___bpf_lru_list_shrink [style=invis] | ||
|
||
// Line up return code nodes at the bottom of the graph | ||
fn_htab_lru_map_update_elem -> pad0 [style=invis] | ||
pad0 -> pad1 [style=invis] | ||
pad1 -> pad2 [style=invis] | ||
//pad2-> fn_htab_lru_map_update_elem_ENOMEM [style=invis] | ||
fn_htab_lru_map_update_elem4 -> pad3 [style=invis] | ||
pad3 -> fn_htab_lru_map_update_elem5 [style=invis] | ||
pad3 -> fn_htab_lru_map_update_elem_EBUSY [style=invis] | ||
pad3 -> fn_htab_lru_map_update_elem_EEXIST [style=invis] | ||
pad3 -> fn_htab_lru_map_update_elem_ENOENT [style=invis] | ||
|
||
// Reduce diagram width by forcing some nodes to appear above others | ||
local_freelist_check4 -> fn_htab_lru_map_update_elem3 [style=invis] | ||
common_lru_check2 -> pad4 [style=invis] | ||
pad4 -> local_freelist_check5 [style=invis] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.