Pull bpf updates from Alexei Starovoitov: - Add BPF uprobe session support (Jiri Olsa) - Optimize uprobe performance (Andrii Nakryiko) - Add bpf_fastcall support to helpers and kfuncs (Eduard Zingerman) - Avoid calling free_htab_elem() under hash map bucket lock (Hou Tao) - Prevent tailcall infinite loop caused by freplace (Leon Hwang) - Mark raw_tracepoint arguments as nullable (Kumar Kartikeya Dwivedi) - Introduce uptr support in the task local storage map (Martin KaFai Lau) - Stringify errno log messages in libbpf (Mykyta Yatsenko) - Add kmem_cache BPF iterator for perf's lock profiling (Namhyung Kim) - Support BPF objects of either endianness in libbpf (Tony Ambardar) - Add ksym to struct_ops trampoline to fix stack trace (Xu Kuohai) - Introduce private stack for eligible BPF programs (Yonghong Song) - Migrate samples/bpf tests to selftests/bpf test_progs (Daniel T. Lee) - Migrate test_sock to selftests/bpf test_progs (Jordan Rife) * tag 'bpf-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (152 commits) libbpf: Change hash_combine parameters from long to unsigned long selftests/bpf: Fix build error with llvm 19 libbpf: Fix memory leak in bpf_program__attach_uprobe_multi bpf: use common instruction history across all states bpf: Add necessary migrate_disable to range_tree. bpf: Do not alloc arena on unsupported arches selftests/bpf: Set test path for token/obj_priv_implicit_token_envvar selftests/bpf: Add a test for arena range tree algorithm bpf: Introduce range_tree data structure and use it in bpf arena samples/bpf: Remove unused variable in xdp2skb_meta_kern.c samples/bpf: Remove unused variables in tc_l2_redirect_kern.c bpftool: Cast variable `var` to long long bpf, x86: Propagate tailcall info only for subprogs bpf: Add kernel symbol for struct_ops trampoline bpf: Use function pointers count as struct_ops links count bpf: Remove unused member rcu from bpf_struct_ops_map selftests/bpf: Add struct_ops prog private stack tests bpf: Support private stack for struct_ops progs selftests/bpf: Add tracing prog private stack tests bpf, x86: Support private stack in jit ...
Showing the changes to scripts (2 of 211 files). Show all
Unified · Split
| @@ -3,6 +3,8 @@ · 2 unmodified lines | |||
| 3 | pahole-ver := $(CONFIG_PAHOLE_VERSION) | 3 | pahole-ver := $(CONFIG_PAHOLE_VERSION) |
| 4 | pahole-flags-y := | 4 | pahole-flags-y := |
| 5 | 5 | ||
| 6 | JOBS := $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))) | ||
| 7 | |||
| 6 | ifeq ($(call test-le, $(pahole-ver), 125),y) | 8 | ifeq ($(call test-le, $(pahole-ver), 125),y) |
| 7 | 9 | ||
| 8 | # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars | 10 | # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars |
| @@ -12,14 +14,14 @@ endif · 3 unmodified lines | |||
| 12 | 14 | ||
| 13 | pahole-flags-$(call test-ge, $(pahole-ver), 121) += --btf_gen_floats | 15 | pahole-flags-$(call test-ge, $(pahole-ver), 121) += --btf_gen_floats |
| 14 | 16 | ||
| 15 | pahole-flags-$(call test-ge, $(pahole-ver), 122) += -j | 17 | pahole-flags-$(call test-ge, $(pahole-ver), 122) += -j$(JOBS) |
| 16 | 18 | ||
| 17 | pahole-flags-$(call test-ge, $(pahole-ver), 125) += --skip_encoding_btf_inconsistent_proto --btf_gen_optimized | 19 | pahole-flags-$(call test-ge, $(pahole-ver), 125) += --skip_encoding_btf_inconsistent_proto --btf_gen_optimized |
| 18 | 20 | ||
| 19 | else | 21 | else |
| 20 | 22 | ||
| 21 | # Switch to using --btf_features for v1.26 and later. | 23 | # Switch to using --btf_features for v1.26 and later. |
| 22 | pahole-flags-$(call test-ge, $(pahole-ver), 126) = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs | 24 | pahole-flags-$(call test-ge, $(pahole-ver), 126) = -j$(JOBS) --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs |
| 23 | 25 | ||
| 24 | ifneq ($(KBUILD_EXTMOD),) | 26 | ifneq ($(KBUILD_EXTMOD),) |
| 25 | module-pahole-flags-$(call test-ge, $(pahole-ver), 126) += --btf_features=distilled_base | 27 | module-pahole-flags-$(call test-ge, $(pahole-ver), 126) += --btf_features=distilled_base |
| @@ -37,10 +37,11 @@ class APIElement(object): · 36 unmodified lines | |||
| 37 | @desc: textual description of the symbol | 37 | @desc: textual description of the symbol |
| 38 | @ret: (optional) description of any associated return value | 38 | @ret: (optional) description of any associated return value |
| 39 | """ | 39 | """ |
| 40 | def __init__(self, proto='', desc='', ret=''): | 40 | def __init__(self, proto='', desc='', ret='', attrs=[]): |
| 41 | self.proto = proto | 41 | self.proto = proto |
| 42 | self.desc = desc | 42 | self.desc = desc |
| 43 | self.ret = ret | 43 | self.ret = ret |
| 44 | self.attrs = attrs | ||
| 44 | 45 | ||
| 45 | 46 | ||
| 46 | class Helper(APIElement): | 47 | class Helper(APIElement): |
| @@ -81,6 +82,11 @@ class Helper(APIElement): · 34 unmodified lines | |||
| 81 | return res | 82 | return res |
| 82 | 83 | ||
| 83 | 84 | ||
| 85 | ATTRS = { | ||
| 86 | '__bpf_fastcall': 'bpf_fastcall' | ||
| 87 | } | ||
| 88 | |||
| 89 | |||
| 84 | class HeaderParser(object): | 90 | class HeaderParser(object): |
| 85 | """ | 91 | """ |
| 86 | An object used to parse a file in order to extract the documentation of a | 92 | An object used to parse a file in order to extract the documentation of a |
| @@ -111,7 +117,8 @@ class HeaderParser(object): · 24 unmodified lines | |||
| 111 | proto = self.parse_proto() | 117 | proto = self.parse_proto() |
| 112 | desc = self.parse_desc(proto) | 118 | desc = self.parse_desc(proto) |
| 113 | ret = self.parse_ret(proto) | 119 | ret = self.parse_ret(proto) |
| 114 | return Helper(proto=proto, desc=desc, ret=ret) | 120 | attrs = self.parse_attrs(proto) |
| 121 | return Helper(proto=proto, desc=desc, ret=ret, attrs=attrs) | ||
| 115 | 122 | ||
| 116 | def parse_symbol(self): | 123 | def parse_symbol(self): |
| 117 | p = re.compile(r' \* ?(BPF\w+)$') | 124 | p = re.compile(r' \* ?(BPF\w+)$') |
| @@ -192,6 +199,28 @@ class HeaderParser(object): · 74 unmodified lines | |||
| 192 | raise Exception("No return found for " + proto) | 199 | raise Exception("No return found for " + proto) |
| 193 | return ret | 200 | return ret |
| 194 | 201 | ||
| 202 | def parse_attrs(self, proto): | ||
| 203 | p = re.compile(r' \* ?(?:\t| {5,8})Attributes$') | ||
| 204 | capture = p.match(self.line) | ||
| 205 | if not capture: | ||
| 206 | return [] | ||
| 207 | # Expect a single line with mnemonics for attributes separated by spaces | ||
| 208 | self.line = self.reader.readline() | ||
| 209 | p = re.compile(r' \* ?(?:\t| {5,8})(?:\t| {8})(.*)') | ||
| 210 | capture = p.match(self.line) | ||
| 211 | if not capture: | ||
| 212 | raise Exception("Incomplete 'Attributes' section for " + proto) | ||
| 213 | attrs = capture.group(1).split(' ') | ||
| 214 | for attr in attrs: | ||
| 215 | if attr not in ATTRS: | ||
| 216 | raise Exception("Unexpected attribute '" + attr + "' specified for " + proto) | ||
| 217 | self.line = self.reader.readline() | ||
| 218 | if self.line != ' *\n': | ||
| 219 | raise Exception("Expecting empty line after 'Attributes' section for " + proto) | ||
| 220 | # Prepare a line for next self.parse_* to consume | ||
| 221 | self.line = self.reader.readline() | ||
| 222 | return attrs | ||
| 223 | |||
| 195 | def seek_to(self, target, help_message, discard_lines = 1): | 224 | def seek_to(self, target, help_message, discard_lines = 1): |
| 196 | self.reader.seek(0) | 225 | self.reader.seek(0) |
| 197 | offset = self.reader.read().find(target) | 226 | offset = self.reader.read().find(target) |
| @@ -789,6 +818,21 @@ class PrinterHelpers(Printer): · 591 unmodified lines | |||
| 789 | print('%s;' % fwd) | 818 | print('%s;' % fwd) |
| 790 | print('') | 819 | print('') |
| 791 | 820 | ||
| 821 | used_attrs = set() | ||
| 822 | for helper in self.elements: | ||
| 823 | for attr in helper.attrs: | ||
| 824 | used_attrs.add(attr) | ||
| 825 | for attr in sorted(used_attrs): | ||
| 826 | print('#ifndef %s' % attr) | ||
| 827 | print('#if __has_attribute(%s)' % ATTRS[attr]) | ||
| 828 | print('#define %s __attribute__((%s))' % (attr, ATTRS[attr])) | ||
| 829 | print('#else') | ||
| 830 | print('#define %s' % attr) | ||
| 831 | print('#endif') | ||
| 832 | print('#endif') | ||
| 833 | if used_attrs: | ||
| 834 | print('') | ||
| 835 | |||
| 792 | def print_footer(self): | 836 | def print_footer(self): |
| 793 | footer = '' | 837 | footer = '' |
| 794 | print(footer) | 838 | print(footer) |
| @@ -827,7 +871,10 @@ class PrinterHelpers(Printer): · 32 unmodified lines | |||
| 827 | print(' *{}{}'.format(' \t' if line else '', line)) | 871 | print(' *{}{}'.format(' \t' if line else '', line)) |
| 828 | 872 | ||
| 829 | print(' */') | 873 | print(' */') |
| 830 | print('static %s %s(* const %s)(' % (self.map_type(proto['ret_type']), | 874 | print('static ', end='') |
| 875 | if helper.attrs: | ||
| 876 | print('%s ' % (" ".join(helper.attrs)), end='') | ||
| 877 | print('%s %s(* const %s)(' % (self.map_type(proto['ret_type']), | ||
| 831 | proto['ret_star'], proto['name']), end='') | 878 | proto['ret_star'], proto['name']), end='') |
| 832 | comma = '' | 879 | comma = '' |
| 833 | for i, a in enumerate(proto['args']): | 880 | for i, a in enumerate(proto['args']): |