Merge tag 'bpf-next-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
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 ...
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
pahole-ver := $(CONFIG_PAHOLE_VERSION)
|
||||
pahole-flags-y :=
|
||||
|
||||
JOBS := $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))
|
||||
|
||||
ifeq ($(call test-le, $(pahole-ver), 125),y)
|
||||
|
||||
# pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars
|
||||
@@ -12,14 +14,14 @@ endif
|
||||
|
||||
pahole-flags-$(call test-ge, $(pahole-ver), 121) += --btf_gen_floats
|
||||
|
||||
pahole-flags-$(call test-ge, $(pahole-ver), 122) += -j
|
||||
pahole-flags-$(call test-ge, $(pahole-ver), 122) += -j$(JOBS)
|
||||
|
||||
pahole-flags-$(call test-ge, $(pahole-ver), 125) += --skip_encoding_btf_inconsistent_proto --btf_gen_optimized
|
||||
|
||||
else
|
||||
|
||||
# Switch to using --btf_features for v1.26 and later.
|
||||
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
|
||||
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
|
||||
|
||||
ifneq ($(KBUILD_EXTMOD),)
|
||||
module-pahole-flags-$(call test-ge, $(pahole-ver), 126) += --btf_features=distilled_base
|
||||
|
||||
@@ -37,10 +37,11 @@ class APIElement(object):
|
||||
@desc: textual description of the symbol
|
||||
@ret: (optional) description of any associated return value
|
||||
"""
|
||||
def __init__(self, proto='', desc='', ret=''):
|
||||
def __init__(self, proto='', desc='', ret='', attrs=[]):
|
||||
self.proto = proto
|
||||
self.desc = desc
|
||||
self.ret = ret
|
||||
self.attrs = attrs
|
||||
|
||||
|
||||
class Helper(APIElement):
|
||||
@@ -81,6 +82,11 @@ class Helper(APIElement):
|
||||
return res
|
||||
|
||||
|
||||
ATTRS = {
|
||||
'__bpf_fastcall': 'bpf_fastcall'
|
||||
}
|
||||
|
||||
|
||||
class HeaderParser(object):
|
||||
"""
|
||||
An object used to parse a file in order to extract the documentation of a
|
||||
@@ -111,7 +117,8 @@ class HeaderParser(object):
|
||||
proto = self.parse_proto()
|
||||
desc = self.parse_desc(proto)
|
||||
ret = self.parse_ret(proto)
|
||||
return Helper(proto=proto, desc=desc, ret=ret)
|
||||
attrs = self.parse_attrs(proto)
|
||||
return Helper(proto=proto, desc=desc, ret=ret, attrs=attrs)
|
||||
|
||||
def parse_symbol(self):
|
||||
p = re.compile(r' \* ?(BPF\w+)$')
|
||||
@@ -192,6 +199,28 @@ class HeaderParser(object):
|
||||
raise Exception("No return found for " + proto)
|
||||
return ret
|
||||
|
||||
def parse_attrs(self, proto):
|
||||
p = re.compile(r' \* ?(?:\t| {5,8})Attributes$')
|
||||
capture = p.match(self.line)
|
||||
if not capture:
|
||||
return []
|
||||
# Expect a single line with mnemonics for attributes separated by spaces
|
||||
self.line = self.reader.readline()
|
||||
p = re.compile(r' \* ?(?:\t| {5,8})(?:\t| {8})(.*)')
|
||||
capture = p.match(self.line)
|
||||
if not capture:
|
||||
raise Exception("Incomplete 'Attributes' section for " + proto)
|
||||
attrs = capture.group(1).split(' ')
|
||||
for attr in attrs:
|
||||
if attr not in ATTRS:
|
||||
raise Exception("Unexpected attribute '" + attr + "' specified for " + proto)
|
||||
self.line = self.reader.readline()
|
||||
if self.line != ' *\n':
|
||||
raise Exception("Expecting empty line after 'Attributes' section for " + proto)
|
||||
# Prepare a line for next self.parse_* to consume
|
||||
self.line = self.reader.readline()
|
||||
return attrs
|
||||
|
||||
def seek_to(self, target, help_message, discard_lines = 1):
|
||||
self.reader.seek(0)
|
||||
offset = self.reader.read().find(target)
|
||||
@@ -789,6 +818,21 @@ class PrinterHelpers(Printer):
|
||||
print('%s;' % fwd)
|
||||
print('')
|
||||
|
||||
used_attrs = set()
|
||||
for helper in self.elements:
|
||||
for attr in helper.attrs:
|
||||
used_attrs.add(attr)
|
||||
for attr in sorted(used_attrs):
|
||||
print('#ifndef %s' % attr)
|
||||
print('#if __has_attribute(%s)' % ATTRS[attr])
|
||||
print('#define %s __attribute__((%s))' % (attr, ATTRS[attr]))
|
||||
print('#else')
|
||||
print('#define %s' % attr)
|
||||
print('#endif')
|
||||
print('#endif')
|
||||
if used_attrs:
|
||||
print('')
|
||||
|
||||
def print_footer(self):
|
||||
footer = ''
|
||||
print(footer)
|
||||
@@ -827,7 +871,10 @@ class PrinterHelpers(Printer):
|
||||
print(' *{}{}'.format(' \t' if line else '', line))
|
||||
|
||||
print(' */')
|
||||
print('static %s %s(* const %s)(' % (self.map_type(proto['ret_type']),
|
||||
print('static ', end='')
|
||||
if helper.attrs:
|
||||
print('%s ' % (" ".join(helper.attrs)), end='')
|
||||
print('%s %s(* const %s)(' % (self.map_type(proto['ret_type']),
|
||||
proto['ret_star'], proto['name']), end='')
|
||||
comma = ''
|
||||
for i, a in enumerate(proto['args']):
|
||||
|
||||
Reference in New Issue
Block a user