From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 5A1603B2A4 for ; Sun, 23 Jul 2023 21:59:19 -0400 (EDT) Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-262ff3a4659so2430856a91.0 for ; Sun, 23 Jul 2023 18:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690163958; x=1690768758; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=nIpVgBKCyXf6ETSR1yZj9aBcxzcF6JR4CpLZk6DSo4Y=; b=Vne9XRZj4MEMZIxiCsI41JOA9ncUmP+PJhdLCpVAG3x83k0PoL8l1QpuvNmVf3iH+h mSZc/eb90p9qz7jttzj1xK3avUCaFQcQjqBox0omKtFWQKNwFG4D7EIgQkeCWJUEUG6E Hpjp+wRRlaTgsgmqQ5DDvwcnUvvPfmChSN6y+hPsGZcYzPiBnoSVdENHQpXMrgkug92U rvEoUy3G9PWOD43UEJGMUdAEY1IQU9Bt/KkCawmJHlEqFaIFnhwYU/6WIOSOHBB3HxDG EZPCHZbmkDweVrZ8q8GYIawPHIfJ6btnj6aMUH/ubDF1rkNNE0Y55QaqK8ql+HDg9tG2 bz/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690163958; x=1690768758; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nIpVgBKCyXf6ETSR1yZj9aBcxzcF6JR4CpLZk6DSo4Y=; b=fc1b2L0/hvchPSsWgLX15R7p2EVR/8QeL6mpXvbFNHH1GsVVndc7vMYXxIHbvnU4dL tdPH7DO+WX2vppfjlkgxfvMMUAtMK/aNFhYci3y9S9fryOQtv5v2omOa83UHMHFGI+dI P5RRlxirEufJBHaDwNnA8JTGa3MGO10RpKH6aYFJugN8yI0SsWg48ua8w178Heg66Du9 Z7CmpBc/I1Tbo890OxaGXjYCcmsOJkvchiDLMIETVctcKbL8Hw43KeTj10G55YlcqHvH FfNsesC5q7LRki2T+FZxMhuhlQEG8os32bjbrOqiRzAUtmmCG57q/+peX9NYx+wgdhHv 9XGQ== X-Gm-Message-State: ABy/qLasbjBK/bPOGFvDDw//skqstCgYj+l2AxT0tLz86HEviZphX3NZ RYKY/wGjm8ILrz68ROOEDN0tV9Si+34WkJF9Pi3S8ioV X-Google-Smtp-Source: APBJJlEDDpqMYaV9MjXvpYAGO8KyG/GP383uP4ZnxAWo/TkG1fnncrV7AoaQ5J8KbYpaGuR+Hyw7aRbkP4wcvJAGBf4= X-Received: by 2002:a17:90a:eb16:b0:268:2180:bd06 with SMTP id j22-20020a17090aeb1600b002682180bd06mr611762pjz.43.1690163957691; Sun, 23 Jul 2023 18:59:17 -0700 (PDT) MIME-Version: 1.0 References: <20230713060718.388258-1-yhs@fb.com> In-Reply-To: <20230713060718.388258-1-yhs@fb.com> From: Dave Taht Date: Sun, 23 Jul 2023 18:59:05 -0700 Message-ID: To: libreqos Content-Type: multipart/alternative; boundary="0000000000004f7ad9060131f6fb" Subject: [LibreQoS] Fwd: [PATCH bpf-next v2 00/15] bpf: Support new insns from cpu v4 X-BeenThere: libreqos@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Many ISPs need the kinds of quality shaping cake can do List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2023 01:59:19 -0000 --0000000000004f7ad9060131f6fb Content-Type: text/plain; charset="UTF-8" ---------- Forwarded message --------- From: Yonghong Song Date: Wed, Jul 12, 2023, 11:07 PM Subject: [PATCH bpf-next v2 00/15] bpf: Support new insns from cpu v4 To: Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Fangrui Song , < kernel-team@fb.com> In previous discussion ([1]), it is agreed that we should introduce cpu version 4 (llvm flag -mcpu=v4) which contains some instructions which can simplify code, make code easier to understand, fix the existing problem, or simply for feature completeness. More specifically, the following new insns are proposed: . sign extended load . sign extended mov . bswap . signed div/mod . ja with 32-bit offset This patch set added kernel support for insns proposed in [1] except BPF_ST which already has full kernel support. Beside the above proposed insns, LLVM will generate BPF_ST insn as well under -mcpu=v4 ([2]). The patchset implements interpreter and jit support for these new insns as well as necessary verifier support. To test this patch set, you need to have latest llvm from 'main' branch of llvm-project repo and apply [2] on top of it. [1] https://lore.kernel.org/bpf/4bfe98be-5333-1c7e-2f6d-42486c8ec039@meta.com/ [2] https://reviews.llvm.org/D144829 Changelogs: RFCv1 -> v2: . add more verifier supports for signed extend load and mov insns. . rename some insn names to be more consistent with intel practice. . add cpuv4 test runner for test progs. . add more unit and C tests. . add documentation. Yonghong Song (15): bpf: Support new sign-extension load insns bpf: Fix sign-extension ctx member accesses bpf: Support new sign-extension mov insns bpf: Support new unconditional bswap instruction bpf: Support new signed div/mod instructions. bpf: Fix jit blinding with new sdiv/smov insns bpf: Support new 32bit offset jmp instruction selftests/bpf: Add a cpuv4 test runner for cpu=v4 testing selftests/bpf: Add unit tests for new sign-extension load insns selftests/bpf: Add unit tests for new sign-extension mov insns selftests/bpf: Add unit tests for new bswap insns selftests/bpf: Add unit tests for new sdiv/smod insns selftests/bpf: Add unit tests for new gotol insn selftests/bpf: Test ldsx with more complex cases docs/bpf: Add documentation for new instructions Documentation/bpf/bpf_design_QA.rst | 5 - .../bpf/standardization/instruction-set.rst | 100 ++- arch/x86/net/bpf_jit_comp.c | 131 ++- include/linux/filter.h | 14 +- include/uapi/linux/bpf.h | 1 + kernel/bpf/cgroup.c | 14 +- kernel/bpf/core.c | 174 +++- kernel/bpf/verifier.c | 315 ++++++-- tools/include/uapi/linux/bpf.h | 1 + tools/testing/selftests/bpf/.gitignore | 2 + tools/testing/selftests/bpf/Makefile | 18 +- .../selftests/bpf/bpf_testmod/bpf_testmod.c | 9 +- .../selftests/bpf/prog_tests/test_ldsx_insn.c | 88 ++ .../selftests/bpf/prog_tests/verifier.c | 10 + .../selftests/bpf/progs/test_ldsx_insn.c | 75 ++ .../selftests/bpf/progs/verifier_bswap.c | 45 ++ .../selftests/bpf/progs/verifier_gotol.c | 30 + .../selftests/bpf/progs/verifier_ldsx.c | 115 +++ .../selftests/bpf/progs/verifier_movsx.c | 177 ++++ .../selftests/bpf/progs/verifier_sdiv.c | 763 ++++++++++++++++++ 20 files changed, 1929 insertions(+), 158 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/test_ldsx_insn.c create mode 100644 tools/testing/selftests/bpf/progs/test_ldsx_insn.c create mode 100644 tools/testing/selftests/bpf/progs/verifier_bswap.c create mode 100644 tools/testing/selftests/bpf/progs/verifier_gotol.c create mode 100644 tools/testing/selftests/bpf/progs/verifier_ldsx.c create mode 100644 tools/testing/selftests/bpf/progs/verifier_movsx.c create mode 100644 tools/testing/selftests/bpf/progs/verifier_sdiv.c -- 2.34.1 --0000000000004f7ad9060131f6fb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

---------- Forwarded message ---------
From: Yonghong Song <yhs@fb.com>
Date: = Wed, Jul 12, 2023, 11:07 PM
Subject: [PATCH bpf-next v2 00/15] bpf: Supp= ort new insns from cpu v4
To: <bpf@vger.kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>, Andrii Nakryiko <andrii@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Fangrui = Song <maskray@google.com>, = <kernel-team@fb.com>


In previous discussion ([1]), it is agreed that we should intro= duce
cpu version 4 (llvm flag -mcpu=3Dv4) which contains some instructions
which can simplify code, make code easier to understand, fix the
existing problem, or simply for feature completeness. More specifically, the following new insns are proposed:
=C2=A0 . sign extended load
=C2=A0 . sign extended mov
=C2=A0 . bswap
=C2=A0 . signed div/mod
=C2=A0 . ja with 32-bit offset

This patch set added kernel support for insns proposed in [1] except
BPF_ST which already has full kernel support. Beside the above proposed
insns, LLVM will generate BPF_ST insn as well under -mcpu=3Dv4 ([2]).

The patchset implements interpreter and jit support for these new
insns as well as necessary verifier support.

To test this patch set, you need to have latest llvm from 'main' br= anch
of llvm-project repo and apply [2] on top of it.

=C2=A0 [1] http= s://lore.kernel.org/bpf/4bfe98be-5333-1c7e-2f6d-42486c8ec039@meta.com/<= br> =C2=A0 [2] https://reviews.llvm.org/D144829

Changelogs:
=C2=A0 RFCv1 -> v2:
=C2=A0 =C2=A0. add more verifier supports for signed extend load and mov in= sns.
=C2=A0 =C2=A0. rename some insn names to be more consistent with intel prac= tice.
=C2=A0 =C2=A0. add cpuv4 test runner for test progs.
=C2=A0 =C2=A0. add more unit and C tests.
=C2=A0 =C2=A0. add documentation.

Yonghong Song (15):
=C2=A0 bpf: Support new sign-extension load insns
=C2=A0 bpf: Fix sign-extension ctx member accesses
=C2=A0 bpf: Support new sign-extension mov insns
=C2=A0 bpf: Support new unconditional bswap instruction
=C2=A0 bpf: Support new signed div/mod instructions.
=C2=A0 bpf: Fix jit blinding with new sdiv/smov insns
=C2=A0 bpf: Support new 32bit offset jmp instruction
=C2=A0 selftests/bpf: Add a cpuv4 test runner for cpu=3Dv4 testing
=C2=A0 selftests/bpf: Add unit tests for new sign-extension load insns
=C2=A0 selftests/bpf: Add unit tests for new sign-extension mov insns
=C2=A0 selftests/bpf: Add unit tests for new bswap insns
=C2=A0 selftests/bpf: Add unit tests for new sdiv/smod insns
=C2=A0 selftests/bpf: Add unit tests for new gotol insn
=C2=A0 selftests/bpf: Test ldsx with more complex cases
=C2=A0 docs/bpf: Add documentation for new instructions

=C2=A0Documentation/bpf/bpf_design_QA.rst=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0|=C2=A0 =C2=A05 -
=C2=A0.../bpf/standardization/instruction-set.rst=C2=A0 =C2=A0| 100 ++-
=C2=A0arch/x86/net/bpf_jit_comp.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0| 131 ++-
=C2=A0include/linux/filter.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 14 +-
=C2=A0include/uapi/linux/bpf.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A01 +
=C2=A0kernel/bpf/cgroup.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 14 +-
=C2=A0kernel/bpf/core.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 174 +++-
=C2=A0kernel/bpf/verifier.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 315 ++++++--
=C2=A0tools/include/uapi/linux/bpf.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A01 +
=C2=A0tools/testing/selftests/bpf/.gitignore=C2=A0 =C2=A0 =C2=A0 =C2=A0 |= =C2=A0 =C2=A02 +
=C2=A0tools/testing/selftests/bpf/Makefile=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 |=C2=A0 18 +-
=C2=A0.../selftests/bpf/bpf_testmod/bpf_testmod.c=C2=A0 =C2=A0|=C2=A0 =C2= =A09 +-
=C2=A0.../selftests/bpf/prog_tests/test_ldsx_insn.c |=C2=A0 88 ++
=C2=A0.../selftests/bpf/prog_tests/verifier.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 10 +
=C2=A0.../selftests/bpf/progs/test_ldsx_insn.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 = 75 ++
=C2=A0.../selftests/bpf/progs/verifier_bswap.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 = 45 ++
=C2=A0.../selftests/bpf/progs/verifier_gotol.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 = 30 +
=C2=A0.../selftests/bpf/progs/verifier_ldsx.c=C2=A0 =C2=A0 =C2=A0 =C2=A0| 1= 15 +++
=C2=A0.../selftests/bpf/progs/verifier_movsx.c=C2=A0 =C2=A0 =C2=A0 | 177 ++= ++
=C2=A0.../selftests/bpf/progs/verifier_sdiv.c=C2=A0 =C2=A0 =C2=A0 =C2=A0| 7= 63 ++++++++++++++++++
=C2=A020 files changed, 1929 insertions(+), 158 deletions(-)
=C2=A0create mode 100644 tools/testing/selftests/bpf/prog_tests/test_ldsx_i= nsn.c
=C2=A0create mode 100644 tools/testing/selftests/bpf/progs/test_ldsx_insn.c=
=C2=A0create mode 100644 tools/testing/selftests/bpf/progs/verifier_bswap.c=
=C2=A0create mode 100644 tools/testing/selftests/bpf/progs/verifier_gotol.c=
=C2=A0create mode 100644 tools/testing/selftests/bpf/progs/verifier_ldsx.c<= br> =C2=A0create mode 100644 tools/testing/selftests/bpf/progs/verifier_movsx.c=
=C2=A0create mode 100644 tools/testing/selftests/bpf/progs/verifier_sdiv.c<= br>
--
2.34.1


--0000000000004f7ad9060131f6fb--