Skip to content

Commit b7b98f8

Browse files
committed
Alexei Starovoitov says: ==================== pull-request: bpf-next 2021-11-01 We've added 181 non-merge commits during the last 28 day(s) which contain a total of 280 files changed, 11791 insertions(+), 5879 deletions(-). The main changes are: 1) Fix bpf verifier propagation of 64-bit bounds, from Alexei. 2) Parallelize bpf test_progs, from Yucong and Andrii. 3) Deprecate various libbpf apis including af_xdp, from Andrii, Hengqi, Magnus. 4) Improve bpf selftests on s390, from Ilya. 5) bloomfilter bpf map type, from Joanne. 6) Big improvements to JIT tests especially on Mips, from Johan. 7) Support kernel module function calls from bpf, from Kumar. 8) Support typeless and weak ksym in light skeleton, from Kumar. 9) Disallow unprivileged bpf by default, from Pawan. 10) BTF_KIND_DECL_TAG support, from Yonghong. 11) Various bpftool cleanups, from Quentin. * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (181 commits) libbpf: Deprecate AF_XDP support kbuild: Unify options for BTF generation for vmlinux and modules selftests/bpf: Add a testcase for 64-bit bounds propagation issue. bpf: Fix propagation of signed bounds from 64-bit min/max into 32-bit. bpf: Fix propagation of bounds from 64-bit min/max into 32-bit and var_off. selftests/bpf: Fix also no-alu32 strobemeta selftest bpf: Add missing map_delete_elem method to bloom filter map selftests/bpf: Add bloom map success test for userspace calls bpf: Add alignment padding for "map_extra" + consolidate holes bpf: Bloom filter map naming fixups selftests/bpf: Add test cases for struct_ops prog bpf: Add dummy BPF STRUCT_OPS for test purpose bpf: Factor out helpers for ctx access checking bpf: Factor out a helper to prepare trampoline for struct_ops prog selftests, bpf: Fix broken riscv build riscv, libbpf: Add RISC-V (RV64) support to bpf_tracing.h tools, build: Add RISC-V to HOSTARCH parsing riscv, bpf: Increase the maximum number of iterations selftests, bpf: Add one test for sockmap with strparser selftests, bpf: Fix test_txmsg_ingress_parser error ... ==================== Link: https://lore.kernel.org/r/20211102013123.9005-1-alexei.starovoitov@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 52fa3ee + 0b17045 commit b7b98f8

File tree

280 files changed

+11791
-5879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+11791
-5879
lines changed

Documentation/bpf/btf.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ sequentially and type id is assigned to each recognized type starting from id
8585
#define BTF_KIND_VAR 14 /* Variable */
8686
#define BTF_KIND_DATASEC 15 /* Section */
8787
#define BTF_KIND_FLOAT 16 /* Floating point */
88-
#define BTF_KIND_TAG 17 /* Tag */
88+
#define BTF_KIND_DECL_TAG 17 /* Decl Tag */
8989

9090
Note that the type section encodes debug info, not just pure types.
9191
``BTF_KIND_FUNC`` is not a type, and it represents a defined subprogram.
@@ -107,7 +107,7 @@ Each type contains the following common data::
107107
* "size" tells the size of the type it is describing.
108108
*
109109
* "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,
110-
* FUNC, FUNC_PROTO and TAG.
110+
* FUNC, FUNC_PROTO and DECL_TAG.
111111
* "type" is a type_id referring to another type.
112112
*/
113113
union {
@@ -466,30 +466,30 @@ map definition.
466466

467467
No additional type data follow ``btf_type``.
468468

469-
2.2.17 BTF_KIND_TAG
470-
~~~~~~~~~~~~~~~~~~~
469+
2.2.17 BTF_KIND_DECL_TAG
470+
~~~~~~~~~~~~~~~~~~~~~~~~
471471

472472
``struct btf_type`` encoding requirement:
473473
* ``name_off``: offset to a non-empty string
474474
* ``info.kind_flag``: 0
475-
* ``info.kind``: BTF_KIND_TAG
475+
* ``info.kind``: BTF_KIND_DECL_TAG
476476
* ``info.vlen``: 0
477-
* ``type``: ``struct``, ``union``, ``func`` or ``var``
477+
* ``type``: ``struct``, ``union``, ``func``, ``var`` or ``typedef``
478478

479-
``btf_type`` is followed by ``struct btf_tag``.::
479+
``btf_type`` is followed by ``struct btf_decl_tag``.::
480480

481-
struct btf_tag {
481+
struct btf_decl_tag {
482482
__u32 component_idx;
483483
};
484484

485-
The ``name_off`` encodes btf_tag attribute string.
486-
The ``type`` should be ``struct``, ``union``, ``func`` or ``var``.
487-
For ``var`` type, ``btf_tag.component_idx`` must be ``-1``.
488-
For the other three types, if the btf_tag attribute is
485+
The ``name_off`` encodes btf_decl_tag attribute string.
486+
The ``type`` should be ``struct``, ``union``, ``func``, ``var`` or ``typedef``.
487+
For ``var`` or ``typedef`` type, ``btf_decl_tag.component_idx`` must be ``-1``.
488+
For the other three types, if the btf_decl_tag attribute is
489489
applied to the ``struct``, ``union`` or ``func`` itself,
490-
``btf_tag.component_idx`` must be ``-1``. Otherwise,
490+
``btf_decl_tag.component_idx`` must be ``-1``. Otherwise,
491491
the attribute is applied to a ``struct``/``union`` member or
492-
a ``func`` argument, and ``btf_tag.component_idx`` should be a
492+
a ``func`` argument, and ``btf_decl_tag.component_idx`` should be a
493493
valid index (starting from 0) pointing to a member or an argument.
494494

495495
3. BTF Kernel API

Documentation/bpf/libbpf/libbpf_naming_convention.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,46 @@ mirror of the mainline's version of libbpf for a stand-alone build.
150150
However, all changes to libbpf's code base must be upstreamed through
151151
the mainline kernel tree.
152152

153+
154+
API documentation convention
155+
============================
156+
157+
The libbpf API is documented via comments above definitions in
158+
header files. These comments can be rendered by doxygen and sphinx
159+
for well organized html output. This section describes the
160+
convention in which these comments should be formated.
161+
162+
Here is an example from btf.h:
163+
164+
.. code-block:: c
165+
166+
/**
167+
* @brief **btf__new()** creates a new instance of a BTF object from the raw
168+
* bytes of an ELF's BTF section
169+
* @param data raw bytes
170+
* @param size number of bytes passed in `data`
171+
* @return new BTF object instance which has to be eventually freed with
172+
* **btf__free()**
173+
*
174+
* On error, error-code-encoded-as-pointer is returned, not a NULL. To extract
175+
* error code from such a pointer `libbpf_get_error()` should be used. If
176+
* `libbpf_set_strict_mode(LIBBPF_STRICT_CLEAN_PTRS)` is enabled, NULL is
177+
* returned on error instead. In both cases thread-local `errno` variable is
178+
* always set to error code as well.
179+
*/
180+
181+
The comment must start with a block comment of the form '/\*\*'.
182+
183+
The documentation always starts with a @brief directive. This line is a short
184+
description about this API. It starts with the name of the API, denoted in bold
185+
like so: **api_name**. Please include an open and close parenthesis if this is a
186+
function. Follow with the short description of the API. A longer form description
187+
can be added below the last directive, at the bottom of the comment.
188+
189+
Parameters are denoted with the @param directive, there should be one for each
190+
parameter. If this is a function with a non-void return, use the @return directive
191+
to document it.
192+
153193
License
154194
-------------------
155195

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,6 +3442,7 @@ S: Supported
34423442
F: arch/arm64/net/
34433443

34443444
BPF JIT for MIPS (32-BIT AND 64-BIT)
3445+
M: Johan Almbladh <johan.almbladh@anyfinetworks.com>
34453446
M: Paul Burton <paulburton@kernel.org>
34463447
L: netdev@vger.kernel.org
34473448
L: bpf@vger.kernel.org

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ LZ4 = lz4c
480480
XZ = xz
481481
ZSTD = zstd
482482

483+
PAHOLE_FLAGS = $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh)
484+
483485
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
484486
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
485487
NOSTDINC_FLAGS :=
@@ -534,6 +536,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
534536
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
535537
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
536538
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
539+
export PAHOLE_FLAGS
537540

538541
# Files to ignore in find ... statements
539542

arch/arm/net/bpf_jit_32.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,11 +1882,6 @@ static int validate_code(struct jit_ctx *ctx)
18821882
return 0;
18831883
}
18841884

1885-
void bpf_jit_compile(struct bpf_prog *prog)
1886-
{
1887-
/* Nothing to do here. We support Internal BPF. */
1888-
}
1889-
18901885
bool bpf_jit_needs_zext(void)
18911886
{
18921887
return true;

arch/mips/Kconfig

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@ config MIPS
5757
select HAVE_ARCH_TRACEHOOK
5858
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES
5959
select HAVE_ASM_MODVERSIONS
60-
select HAVE_CBPF_JIT if !64BIT && !CPU_MICROMIPS
6160
select HAVE_CONTEXT_TRACKING
6261
select HAVE_TIF_NOHZ
6362
select HAVE_C_RECORDMCOUNT
6463
select HAVE_DEBUG_KMEMLEAK
6564
select HAVE_DEBUG_STACKOVERFLOW
6665
select HAVE_DMA_CONTIGUOUS
6766
select HAVE_DYNAMIC_FTRACE
68-
select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2
67+
select HAVE_EBPF_JIT if !CPU_MICROMIPS && \
68+
!CPU_DADDI_WORKAROUNDS && \
69+
!CPU_R4000_WORKAROUNDS && \
70+
!CPU_R4400_WORKAROUNDS
6971
select HAVE_EXIT_THREAD
7072
select HAVE_FAST_GUP
7173
select HAVE_FTRACE_MCOUNT_RECORD
@@ -1212,15 +1214,6 @@ config SYS_SUPPORTS_RELOCATABLE
12121214
The platform must provide plat_get_fdt() if it selects CONFIG_USE_OF
12131215
to allow access to command line and entropy sources.
12141216

1215-
config MIPS_CBPF_JIT
1216-
def_bool y
1217-
depends on BPF_JIT && HAVE_CBPF_JIT
1218-
1219-
config MIPS_EBPF_JIT
1220-
def_bool y
1221-
depends on BPF_JIT && HAVE_EBPF_JIT
1222-
1223-
12241217
#
12251218
# Endianness selection. Sufficiently obscure so many users don't know what to
12261219
# answer,so we try hard to limit the available choices. Also the use of a

arch/mips/include/asm/uasm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ Ip_u1(_mtlo);
145145
Ip_u3u1u2(_mul);
146146
Ip_u1u2(_multu);
147147
Ip_u3u1u2(_mulu);
148+
Ip_u3u1u2(_muhu);
148149
Ip_u3u1u2(_nor);
149150
Ip_u3u1u2(_or);
150151
Ip_u2u1u3(_ori);
@@ -248,7 +249,11 @@ static inline void uasm_l##lb(struct uasm_label **lab, u32 *addr) \
248249
#define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off)
249250
#define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3)
250251
#define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b)
252+
#ifdef CONFIG_CPU_NOP_WORKAROUNDS
253+
#define uasm_i_nop(buf) uasm_i_or(buf, 1, 1, 0)
254+
#else
251255
#define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0)
256+
#endif
252257
#define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1)
253258

254259
static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,

arch/mips/mm/uasm-mips.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static const struct insn insn_table[insn_invalid] = {
9090
RS | RT | RD},
9191
[insn_dmtc0] = {M(cop0_op, dmtc_op, 0, 0, 0, 0), RT | RD | SET},
9292
[insn_dmultu] = {M(spec_op, 0, 0, 0, 0, dmultu_op), RS | RT},
93-
[insn_dmulu] = {M(spec_op, 0, 0, 0, dmult_dmul_op, dmultu_op),
93+
[insn_dmulu] = {M(spec_op, 0, 0, 0, dmultu_dmulu_op, dmultu_op),
9494
RS | RT | RD},
9595
[insn_drotr] = {M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE},
9696
[insn_drotr32] = {M(spec_op, 1, 0, 0, 0, dsrl32_op), RT | RD | RE},
@@ -150,6 +150,8 @@ static const struct insn insn_table[insn_invalid] = {
150150
[insn_mtlo] = {M(spec_op, 0, 0, 0, 0, mtlo_op), RS},
151151
[insn_mulu] = {M(spec_op, 0, 0, 0, multu_mulu_op, multu_op),
152152
RS | RT | RD},
153+
[insn_muhu] = {M(spec_op, 0, 0, 0, multu_muhu_op, multu_op),
154+
RS | RT | RD},
153155
#ifndef CONFIG_CPU_MIPSR6
154156
[insn_mul] = {M(spec2_op, 0, 0, 0, 0, mul_op), RS | RT | RD},
155157
#else

arch/mips/mm/uasm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ enum opcode {
5959
insn_lddir, insn_ldpte, insn_ldx, insn_lh, insn_lhu, insn_ll, insn_lld,
6060
insn_lui, insn_lw, insn_lwu, insn_lwx, insn_mfc0, insn_mfhc0, insn_mfhi,
6161
insn_mflo, insn_modu, insn_movn, insn_movz, insn_mtc0, insn_mthc0,
62-
insn_mthi, insn_mtlo, insn_mul, insn_multu, insn_mulu, insn_nor,
62+
insn_mthi, insn_mtlo, insn_mul, insn_multu, insn_mulu, insn_muhu, insn_nor,
6363
insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sb, insn_sc,
6464
insn_scd, insn_seleqz, insn_selnez, insn_sd, insn_sh, insn_sll,
6565
insn_sllv, insn_slt, insn_slti, insn_sltiu, insn_sltu, insn_sra,
@@ -344,6 +344,7 @@ I_u1(_mtlo)
344344
I_u3u1u2(_mul)
345345
I_u1u2(_multu)
346346
I_u3u1u2(_mulu)
347+
I_u3u1u2(_muhu)
347348
I_u3u1u2(_nor)
348349
I_u3u1u2(_or)
349350
I_u2u1u3(_ori)

arch/mips/net/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
# MIPS networking code
33

4-
obj-$(CONFIG_MIPS_CBPF_JIT) += bpf_jit.o bpf_jit_asm.o
5-
obj-$(CONFIG_MIPS_EBPF_JIT) += ebpf_jit.o
4+
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o
5+
6+
ifeq ($(CONFIG_32BIT),y)
7+
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp32.o
8+
else
9+
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp64.o
10+
endif

0 commit comments

Comments
 (0)