History

Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Alexei Starovoitov says: ==================== pull-request: bpf-next 2021-09-17 We've added 63 non-merge commits during the last 12 day(s) which contain a total of 65 files changed, 2653 insertions(+), 751 deletions(-). The main changes are: 1) Streamline internal BPF program sections handling and bpf_program__set_attach_target() in libbpf, from Andrii. 2) Add support for new btf kind BTF_KIND_TAG, from Yonghong. 3) Introduce bpf_get_branch_snapshot() to capture LBR, from Song. 4) IMUL optimization for x86-64 JIT, from Jie. 5) xsk selftest improvements, from Magnus. 6) Introduce legacy kprobe events support in libbpf, from Rafael. 7) Access hw timestamp through BPF's __sk_buff, from Vadim. * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (63 commits) selftests/bpf: Fix a few compiler warnings libbpf: Constify all high-level program attach APIs libbpf: Schedule open_opts.attach_prog_fd deprecation since v0.7 selftests/bpf: Switch fexit_bpf2bpf selftest to set_attach_target() API libbpf: Allow skipping attach_func_name in bpf_program__set_attach_target() libbpf: Deprecated bpf_object_open_opts.relaxed_core_relocs selftests/bpf: Stop using relaxed_core_relocs which has no effect libbpf: Use pre-setup sec_def in libbpf_find_attach_btf_id() bpf: Update bpf_get_smp_processor_id() documentation libbpf: Add sphinx code documentation comments selftests/bpf: Skip btf_tag test if btf_tag attribute not supported docs/bpf: Add documentation for BTF_KIND_TAG selftests/bpf: Add a test with a bpf program with btf_tag attributes selftests/bpf: Test BTF_KIND_TAG for deduplication selftests/bpf: Add BTF_KIND_TAG unit tests selftests/bpf: Change NAME_NTH/IS_NAME_NTH for BTF_KIND_TAG format selftests/bpf: Test libbpf API function btf__add_tag() bpftool: Add support for BTF_KIND_TAG libbpf: Add support for BTF_KIND_TAG libbpf: Rename btf_{hash,equal}_int to btf_{hash,equal}_int_tag ... ====================

Jakub Kicinski committed 5 years ago

Commit af54faa2 parents f68d08c ca21a3e65 files · +2653 −751Browse files

Showing the changes to tools/include/uapi/linux (2 of 65 files). Show all

Unified · Split

2 files
  1. tools/include/uapi/linux/bpf.h +25 −1
  2. tools/include/uapi/linux/btf.h +35 −20
tools/include/uapi/linux/bpf.h+25−1
@@ -1629,7 +1629,7 @@ union bpf_attr { · 1628 unmodified lines
16291629 * u32 bpf_get_smp_processor_id(void)
16301630 * Description
16311631 * Get the SMP (symmetric multiprocessing) processor id. Note that
1632− * all programs run with preemption disabled, which means that the
1632+ * all programs run with migration disabled, which means that the
16331633 * SMP processor id is stable during all the execution of the
16341634 * program.
16351635 * Return
@@ -4877,6 +4877,27 @@ union bpf_attr { · 3241 unmodified lines
48774877 * Get the struct pt_regs associated with **task**.
48784878 * Return
48794879 * A pointer to struct pt_regs.
4880+ *
4881+ * long bpf_get_branch_snapshot(void *entries, u32 size, u64 flags)
4882+ * Description
4883+ * Get branch trace from hardware engines like Intel LBR. The
4884+ * hardware engine is stopped shortly after the helper is
4885+ * called. Therefore, the user need to filter branch entries
4886+ * based on the actual use case. To capture branch trace
4887+ * before the trigger point of the BPF program, the helper
4888+ * should be called at the beginning of the BPF program.
4889+ *
4890+ * The data is stored as struct perf_branch_entry into output
4891+ * buffer *entries*. *size* is the size of *entries* in bytes.
4892+ * *flags* is reserved for now and must be zero.
4893+ *
4894+ * Return
4895+ * On success, number of bytes written to *buf*. On error, a
4896+ * negative value.
4897+ *
4898+ * **-EINVAL** if *flags* is not zero.
4899+ *
4900+ * **-ENOENT** if architecture does not support branch records.
48804901 */
48814902 #define __BPF_FUNC_MAPPER(FN) \
48824903 FN(unspec), \
@@ -5055,6 +5076,7 @@ union bpf_attr { · 172 unmodified lines
50555076 FN(get_func_ip), \
50565077 FN(get_attach_cookie), \
50575078 FN(task_pt_regs), \
5079+ FN(get_branch_snapshot), \
50585080 /* */
50595081
50605082 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -5284,6 +5306,8 @@ struct __sk_buff { · 223 unmodified lines
52845306 __u32 gso_segs;
52855307 __bpf_md_ptr(struct bpf_sock *, sk);
52865308 __u32 gso_size;
5309+ __u32 :32; /* Padding, future use. */
5310+ __u64 hwtstamp;
52875311 };
52885312
52895313 struct bpf_tunnel_key {
tools/include/uapi/linux/btf.h+35−20
@@ -43,7 +43,7 @@ struct btf_type { · 42 unmodified lines
4343 * "size" tells the size of the type it is describing.
4444 *
4545 * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
46− * FUNC, FUNC_PROTO and VAR.
46+ * FUNC, FUNC_PROTO, VAR and TAG.
4747 * "type" is a type_id referring to another type.
4848 */
4949 union {
@@ -56,25 +56,29 @@ struct btf_type { · 6 unmodified lines
5656 #define BTF_INFO_VLEN(info) ((info) & 0xffff)
5757 #define BTF_INFO_KFLAG(info) ((info) >> 31)
5858
59−#define BTF_KIND_UNKN 0 /* Unknown */
60−#define BTF_KIND_INT 1 /* Integer */
61−#define BTF_KIND_PTR 2 /* Pointer */
62−#define BTF_KIND_ARRAY 3 /* Array */
63−#define BTF_KIND_STRUCT 4 /* Struct */
64−#define BTF_KIND_UNION 5 /* Union */
65−#define BTF_KIND_ENUM 6 /* Enumeration */
66−#define BTF_KIND_FWD 7 /* Forward */
67−#define BTF_KIND_TYPEDEF 8 /* Typedef */
68−#define BTF_KIND_VOLATILE 9 /* Volatile */
69−#define BTF_KIND_CONST 10 /* Const */
70−#define BTF_KIND_RESTRICT 11 /* Restrict */
71−#define BTF_KIND_FUNC 12 /* Function */
72−#define BTF_KIND_FUNC_PROTO 13 /* Function Proto */
73−#define BTF_KIND_VAR 14 /* Variable */
74−#define BTF_KIND_DATASEC 15 /* Section */
75−#define BTF_KIND_FLOAT 16 /* Floating point */
76−#define BTF_KIND_MAX BTF_KIND_FLOAT
77−#define NR_BTF_KINDS (BTF_KIND_MAX + 1)
59+enum {
60+ BTF_KIND_UNKN = 0, /* Unknown */
61+ BTF_KIND_INT = 1, /* Integer */
62+ BTF_KIND_PTR = 2, /* Pointer */
63+ BTF_KIND_ARRAY = 3, /* Array */
64+ BTF_KIND_STRUCT = 4, /* Struct */
65+ BTF_KIND_UNION = 5, /* Union */
66+ BTF_KIND_ENUM = 6, /* Enumeration */
67+ BTF_KIND_FWD = 7, /* Forward */
68+ BTF_KIND_TYPEDEF = 8, /* Typedef */
69+ BTF_KIND_VOLATILE = 9, /* Volatile */
70+ BTF_KIND_CONST = 10, /* Const */
71+ BTF_KIND_RESTRICT = 11, /* Restrict */
72+ BTF_KIND_FUNC = 12, /* Function */
73+ BTF_KIND_FUNC_PROTO = 13, /* Function Proto */
74+ BTF_KIND_VAR = 14, /* Variable */
75+ BTF_KIND_DATASEC = 15, /* Section */
76+ BTF_KIND_FLOAT = 16, /* Floating point */
77+ BTF_KIND_TAG = 17, /* Tag */
78+
79+ NR_BTF_KINDS,
80+ BTF_KIND_MAX = NR_BTF_KINDS - 1,
81+};
7882
7983 /* For some specific BTF_KIND, "struct btf_type" is immediately
8084 * followed by extra data.
@@ -170,4 +174,15 @@ struct btf_var_secinfo { · 89 unmodified lines
170174 __u32 size;
171175 };
172176
177+/* BTF_KIND_TAG is followed by a single "struct btf_tag" to describe
178+ * additional information related to the tag applied location.
179+ * If component_idx == -1, the tag is applied to a struct, union,
180+ * variable or function. Otherwise, it is applied to a struct/union
181+ * member or a func argument, and component_idx indicates which member
182+ * or argument (0 ... vlen-1).
183+ */
184+struct btf_tag {
185+ __s32 component_idx;
186+};
187+
173188 #endif /* _UAPI__LINUX_BTF_H__ */