Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

res-lock-arena #8613

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
fc3ab17
Merge branch 'selftests-bpf-implement-setting-global-variables-in-ver…
anakryiko Feb 26, 2025
bacac21
bpf/helpers: Refactor bpf_dynptr_read and bpf_dynptr_write
mykyta5 Feb 26, 2025
9d15404
bpf/helpers: Introduce bpf_dynptr_copy kfunc
mykyta5 Feb 26, 2025
8fc1834
selftests/bpf: Add tests for bpf_dynptr_copy
mykyta5 Feb 26, 2025
43d9d43
Merge branch 'introduce-bpf_dynptr_copy-kfunc'
anakryiko Feb 26, 2025
27e3162
selftests/bpf: Allow auto port binding for cgroup connect
mrpre Feb 27, 2025
dbe7d46
selftests/bpf: Allow auto port binding for bpf nf
mrpre Feb 27, 2025
09de329
selftests/bpf: Fixes for test_maps test
mrpre Feb 27, 2025
0ffa016
Merge branch 'optimize-bpf-selftest-to-increase-ci-success-rate'
Feb 27, 2025
78a8a85
bpf: Allow pre-ordering for bpf cgroup progs
Feb 24, 2025
42c5e6d
selftests/bpf: Add selftests allowing cgroup prog pre-ordering
Feb 24, 2025
0aaddfb
locking/local_lock: Introduce localtry_lock_t
Feb 22, 2025
97769a5
mm, bpf: Introduce try_alloc_pages() for opportunistic page allocation
Feb 22, 2025
8c57b68
mm, bpf: Introduce free_pages_nolock()
Feb 22, 2025
01d3722
memcg: Use trylock to access memcg stock_lock.
Feb 22, 2025
e8d78db
mm, bpf: Use memcg in try_alloc_pages().
Feb 22, 2025
c9eb810
bpf: Use try_alloc_pages() to allocate pages for bpf needs.
Feb 22, 2025
93ed6fc
Merge branch 'bpf-mm-introduce-try_alloc_pages'
Feb 27, 2025
e4d68c0
Merge branch 'bpf-next/try_alloc_pages' into bpf-next/master
Feb 27, 2025
0b93631
bpf/selftests: test_select_reuseport_kern: Remove unused header
Tropicao Feb 27, 2025
90d8c89
bpf: Summarize sleepable global subprogs
kkdwivedi Mar 1, 2025
6e2cc60
selftests/bpf: Test sleepable global subprogs in atomic contexts
kkdwivedi Mar 1, 2025
ce9add7
selftests/bpf: Add tests for extending sleepable global subprogs
kkdwivedi Mar 1, 2025
53415f6
Merge branch 'global-subprogs-in-rcu-preempt-irq-disabled-sections'
Mar 2, 2025
17a82ed
bpf: no longer acquire map_idr_lock in bpf_map_inc_not_zero()
Mar 1, 2025
b2d9ef7
bpf: Factor out atomic_ptr_type_ok()
peilin-ye Mar 3, 2025
d430c46
bpf: Factor out check_atomic_rmw()
peilin-ye Mar 3, 2025
d38ad24
bpf: Factor out check_load_mem() and check_store_reg()
peilin-ye Mar 3, 2025
128cd76
veristat: @files-list.txt notation for object files list
eddyz87 Mar 1, 2025
1649753
veristat: Strerror expects positive number (errno)
eddyz87 Mar 1, 2025
b127528
veristat: Report program type guess results to sdterr
eddyz87 Mar 1, 2025
0bf6c8a
Merge branch 'veristat-files-list-txt-notation-for-object-files-list'
anakryiko Mar 3, 2025
6829f3c
selftests/bpf: test_tunnel: Add generic_attach* helpers
bastien-curutchet Mar 3, 2025
7289e59
selftests/bpf: test_tunnel: Add ping helpers
bastien-curutchet Mar 3, 2025
08d20ea
selftests/bpf: test_tunnel: Move gre tunnel test to test_progs
bastien-curutchet Mar 3, 2025
1ea01a8
selftests/bpf: test_tunnel: Move ip6gre tunnel test to test_progs
bastien-curutchet Mar 3, 2025
0ecd1e9
selftests/bpf: test_tunnel: Move erspan tunnel tests to test_progs
bastien-curutchet Mar 3, 2025
cae41f7
selftests/bpf: test_tunnel: Move ip6erspan tunnel test to test_progs
bastien-curutchet Mar 3, 2025
d89542d
selftests/bpf: test_tunnel: Move geneve tunnel test to test_progs
bastien-curutchet Mar 3, 2025
8d86094
selftests/bpf: test_tunnel: Move ip6geneve tunnel test to test_progs
bastien-curutchet Mar 3, 2025
680a752
selftests/bpf: test_tunnel: Move ip6tnl tunnel tests to test_progs
bastien-curutchet Mar 3, 2025
c8d6d78
selftests/bpf: test_tunnel: Remove test_tunnel.sh
bastien-curutchet Mar 3, 2025
a36a835
Merge branch 'selftests-bpf-migrate-test_tunnel-sh-to-test_progs'
Mar 3, 2025
122f1fd
net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
leitao Feb 28, 2025
7218ff1
libbpf: Use map_is_created helper in map setters
mykyta5 Mar 3, 2025
8ca8f6d
libbpf: Introduce more granular state for bpf_object
mykyta5 Mar 3, 2025
da75554
libbpf: Split bpf object load into prepare/load
mykyta5 Mar 3, 2025
68b61a8
selftests/bpf: Add tests for bpf_object__prepare
mykyta5 Mar 3, 2025
7586e21
Merge branch 'introduce-bpf_object__prepare'
anakryiko Mar 3, 2025
13a664f
bpf: Add verifier support for timed may_goto
kkdwivedi Mar 4, 2025
2cb0a52
bpf, x86: Add x86 JIT support for timed may_goto
kkdwivedi Mar 4, 2025
ad55432
Merge branch 'timed-may_goto'
Mar 4, 2025
e24bbad
bpf: Introduce load-acquire and store-release instructions
peilin-ye Mar 4, 2025
4170a60
arm64: insn: Add BIT(23) to {load,store}_ex's mask
peilin-ye Mar 4, 2025
248b190
arm64: insn: Add load-acquire and store-release instructions
peilin-ye Mar 4, 2025
1bfe7f6
bpf, arm64: Support load-acquire and store-release instructions
peilin-ye Mar 4, 2025
14c0427
bpf, x86: Support load-acquire and store-release instructions
peilin-ye Mar 4, 2025
953df09
selftests/bpf: Add selftests for load-acquire and store-release instr…
peilin-ye Mar 4, 2025
c6287f1
Merge branch 'introduce-load-acquire-and-store-release-bpf-instructions'
Mar 4, 2025
1c15257
bpf: jmp_offset() and verbose_insn() utility functions
eddyz87 Mar 4, 2025
0ae958e
bpf: get_call_summary() utility function
eddyz87 Mar 4, 2025
7dad036
bpf: simple DFA-based live registers analysis
eddyz87 Mar 4, 2025
994a876
bpf: use register liveness information for func_states_equal
eddyz87 Mar 4, 2025
8a3fc22
selftests/bpf: test cases for compute_live_registers()
eddyz87 Mar 4, 2025
42ba8a4
Merge branch 'bpf-simple-dfa-based-live-registers-analysis'
Mar 4, 2025
aae1add
bpf: correct use/def for may_goto instruction
eddyz87 Mar 5, 2025
7781fd0
bpf, docs: Fix broken link to renamed bpf_iter_task_vmas.c
Mar 4, 2025
994fd3e
selftests/bpf: Introduce cond_break_label
kkdwivedi Mar 6, 2025
0201027
selftests/bpf: Introduce arena spin lock
kkdwivedi Mar 6, 2025
313149f
selftests/bpf: Add tests for arena spin lock
kkdwivedi Mar 6, 2025
48b3be8
Merge branch 'arena-spin-lock'
Mar 6, 2025
88b1c42
selftests/bpf: Move test_lwt_ip_encap to test_progs
bastien-curutchet Mar 4, 2025
5cb4077
selftests/bpf: Clean up call sites of stdio_restore()
ameryhung Mar 5, 2025
6d54a02
selftests/bpf: Allow assigning traffic monitor print function
ameryhung Mar 5, 2025
15bfc10
selftests/bpf: Fix dangling stdout seen by traffic monitor thread
ameryhung Mar 5, 2025
7e437dc
selftests/bpf: Fix cap_enable_effective() return code
kknjh Mar 5, 2025
359d070
selftests/bpf: lwt_seg6local: Remove unused routes
bastien-curutchet Mar 7, 2025
3fb97a2
selftests/bpf: lwt_seg6local: Move test to test_progs
bastien-curutchet Mar 7, 2025
f282146
Merge branch 'selftests-bpf-move-test_lwt_seg6local-to-test_progs'
Mar 8, 2025
63f99cd
bpf: add kfunc for populating cpumask bits
etsal Mar 9, 2025
3524b15
selftests: bpf: add bpf_cpumask_populate selftests
etsal Mar 9, 2025
d70870e
bpf: fix missing kdoc string fields in cpumask.c
etsal Mar 9, 2025
93ececb
selftests: bpf: fix duplicate selftests in cpumask_success.
etsal Mar 9, 2025
79d93c8
Merge branch 'bpf-introduce-helper-for-populating-bpf_cpumask'
Mar 10, 2025
74f36a9
selftests/bpf: Fix selection of static vs. dynamic LLVM
aspsk Mar 10, 2025
26350a2
mm: Fix the flipped condition in gfpflags_allow_spinning()
tehcaster Mar 10, 2025
bf5af29
selftests/bpf: Convert comma to semicolon
Mar 10, 2025
a8cd035
security: Propagate caller information in bpf hooks
Mar 10, 2025
f563314
selftests/bpf: Add a kernel flag test for LSM bpf hook
Mar 10, 2025
a68894a
Merge branch 'security-propagate-caller-information-in-bpf-hooks'
Mar 11, 2025
474f6ed
adding ci files
Mar 11, 2025
41432dd
bpf, arm64: Add arm64 JIT support for timed may_goto
kkdwivedi Mar 11, 2025
7ce4a8e
test
kkdwivedi Mar 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/actions/veristat_baseline_compare/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 'run-veristat'
description: 'Run veristat benchmark'
inputs:
veristat_output:
description: 'Veristat output filepath'
required: true
baseline_name:
description: 'Veristat baseline cache name'
required: true
runs:
using: "composite"
steps:
- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.baseline_name }}
if-no-files-found: error
path: ${{ github.workspace }}/${{ inputs.veristat_output }}

# For pull request:
# - get baseline log from cache
# - compare it to current run
- if: ${{ github.event_name == 'pull_request' }}
uses: actions/cache/restore@v4
with:
key: ${{ inputs.baseline_name }}
restore-keys: |
${{ inputs.baseline_name }}-
path: '${{ github.workspace }}/${{ inputs.baseline_name }}'

- if: ${{ github.event_name == 'pull_request' }}
name: Show veristat comparison
shell: bash
run: ./.github/scripts/compare-veristat-results.sh
env:
BASELINE_PATH: ${{ github.workspace }}/${{ inputs.baseline_name }}
VERISTAT_OUTPUT: ${{ inputs.veristat_output }}

# For push: just put baseline log to cache
- if: ${{ github.event_name == 'push' }}
shell: bash
run: |
mv "${{ github.workspace }}/${{ inputs.veristat_output }}" \
"${{ github.workspace }}/${{ inputs.baseline_name }}"

- if: ${{ github.event_name == 'push' }}
uses: actions/cache/save@v4
with:
key: ${{ inputs.baseline_name }}-${{ github.run_id }}
path: '${{ github.workspace }}/${{ inputs.baseline_name }}'
18 changes: 18 additions & 0 deletions .github/scripts/compare-veristat-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

if [[ ! -f "${BASELINE_PATH}" ]]; then
echo "# No ${BASELINE_PATH} available" >> "${GITHUB_STEP_SUMMARY}"

echo "No ${BASELINE_PATH} available"
echo "Printing veristat results"
cat "${VERISTAT_OUTPUT}"

exit
fi

selftests/bpf/veristat \
--output-format csv \
--emit file,prog,verdict,states \
--compare "${BASELINE_PATH}" "${VERISTAT_OUTPUT}" > compare.csv

python3 ./.github/scripts/veristat_compare.py compare.csv
30 changes: 30 additions & 0 deletions .github/scripts/download-gcc-bpf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -euo pipefail

GCC_BPF_RELEASE_GH_REPO=$1
INSTALL_DIR=$(realpath $2)

cd /tmp

tag=$(gh release list -L 1 -R ${GCC_BPF_RELEASE_GH_REPO} --json tagName -q .[].tagName)
if [[ -z "$tag" ]]; then
echo "Could not find latest GCC BPF release at ${GCC_BPF_RELEASE_GH_REPO}"
exit 1
fi

url="https://github.com/${GCC_BPF_RELEASE_GH_REPO}/releases/download/${tag}/${tag}.tar.zst"
echo "Downloading $url"
wget -q "$url"

tarball=${tag}.tar.zst
dir=$(tar tf $tarball | head -1 || true)

echo "Extracting $tarball ..."
tar -I zstd -xf $tarball && rm -f $tarball

rm -rf $INSTALL_DIR
mv -v $dir $INSTALL_DIR

cd -

194 changes: 194 additions & 0 deletions .github/scripts/matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
#!/usr/bin/env python3

import os
import dataclasses
import json

from enum import Enum
from typing import Any, Dict, List, Final, Set, Union

MANAGED_OWNER: Final[str] = "kernel-patches"
MANAGED_REPOS: Final[Set[str]] = {
f"{MANAGED_OWNER}/bpf",
f"{MANAGED_OWNER}/vmtest",
}

DEFAULT_SELF_HOSTED_RUNNER_TAGS: Final[List[str]] = ["self-hosted", "docker-noble-main"]
DEFAULT_RUNNER: Final[str] = "ubuntu-24.04"
DEFAULT_LLVM_VERSION: Final[int] = 17


class Arch(str, Enum):
"""
CPU architecture supported by CI.
"""

AARCH64 = "aarch64"
S390X = "s390x"
X86_64 = "x86_64"


class Compiler(str, Enum):
GCC = "gcc"
LLVM = "llvm"


@dataclasses.dataclass
class Toolchain:
compiler: Compiler
# This is relevant ONLY for LLVM and should not be required for GCC
version: int

@property
def short_name(self) -> str:
return str(self.compiler.value)

@property
def full_name(self) -> str:
if self.compiler == Compiler.GCC:
return self.short_name

return f"{self.short_name}-{self.version}"

def to_dict(self) -> Dict[str, Union[str, int]]:
return {
"name": self.short_name,
"fullname": self.full_name,
"version": self.version,
}


@dataclasses.dataclass
class BuildConfig:
arch: Arch
toolchain: Toolchain
kernel: str = "LATEST"
run_veristat: bool = False
parallel_tests: bool = False
build_release: bool = False

@property
def runs_on(self) -> List[str]:
if is_managed_repo():
return DEFAULT_SELF_HOSTED_RUNNER_TAGS + [self.arch.value]
else:
return [DEFAULT_RUNNER]

@property
def build_runs_on(self) -> List[str]:
if is_managed_repo():
return ["codebuild"]
else:
return [DEFAULT_RUNNER]

@property
def tests(self) -> Dict[str, Any]:
tests_list = [
"test_progs",
"test_progs_parallel",
"test_progs_no_alu32",
"test_progs_no_alu32_parallel",
"test_verifier",
]

if self.arch.value != "s390x":
tests_list.append("test_maps")

if self.toolchain.version >= 18:
tests_list.append("test_progs_cpuv4")

# if self.arch in [Arch.X86_64, Arch.AARCH64]:
# tests_list.append("sched_ext")

# Don't run GCC BPF runner, because too many tests are failing
# See: https://lore.kernel.org/bpf/[email protected]/
# if self.arch == Arch.X86_64:
# tests_list.append("test_progs-bpf_gcc")

if not self.parallel_tests:
tests_list = [test for test in tests_list if not test.endswith("parallel")]

return {"include": [generate_test_config(test) for test in tests_list]}

def to_dict(self) -> Dict[str, Any]:
return {
"arch": self.arch.value,
"toolchain": self.toolchain.to_dict(),
"kernel": self.kernel,
"run_veristat": self.run_veristat,
"parallel_tests": self.parallel_tests,
"build_release": self.build_release,
"runs_on": self.runs_on,
"tests": self.tests,
"build_runs_on": self.build_runs_on,
}


def is_managed_repo() -> bool:
return (
os.environ["GITHUB_REPOSITORY_OWNER"] == MANAGED_OWNER
and os.environ["GITHUB_REPOSITORY"] in MANAGED_REPOS
)


def set_output(name, value):
"""Write an output variable to the GitHub output file."""
with open(os.getenv("GITHUB_OUTPUT"), "a", encoding="utf-8") as file:
file.write(f"{name}={value}\n")


def generate_test_config(test: str) -> Dict[str, Union[str, int]]:
"""Create the configuration for the provided test."""
is_parallel = test.endswith("_parallel")
config = {
"test": test,
"continue_on_error": is_parallel,
# While in experimental mode, parallel jobs may get stuck
# anywhere, including in user space where the kernel won't detect
# a problem and panic. We add a second layer of (smaller) timeouts
# here such that if we get stuck in a parallel run, we hit this
# timeout and fail without affecting the overall job success (as
# would be the case if we hit the job-wide timeout). For
# non-experimental jobs, 360 is the default which will be
# superseded by the overall workflow timeout (but we need to
# specify something).
"timeout_minutes": 30 if is_parallel else 360,
}
return config


if __name__ == "__main__":
matrix = [
BuildConfig(
arch=Arch.X86_64,
toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION),
run_veristat=True,
parallel_tests=True,
),
BuildConfig(
arch=Arch.X86_64,
toolchain=Toolchain(compiler=Compiler.LLVM, version=DEFAULT_LLVM_VERSION),
build_release=True,
),
BuildConfig(
arch=Arch.X86_64,
toolchain=Toolchain(compiler=Compiler.LLVM, version=18),
build_release=True,
),
BuildConfig(
arch=Arch.AARCH64,
toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION),
),
BuildConfig(
arch=Arch.S390X,
toolchain=Toolchain(compiler=Compiler.GCC, version=DEFAULT_LLVM_VERSION),
),
]

# Outside of managed repositories only run on x86_64
if not is_managed_repo():
matrix = [config for config in matrix if config.arch == Arch.X86_64]

json_matrix = json.dumps({"include": [config.to_dict() for config in matrix]})
print(json.dumps(json.loads(json_matrix), indent=4))
set_output("build_matrix", json_matrix)
75 changes: 75 additions & 0 deletions .github/scripts/tests/test_veristat_compare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env python3

import unittest
from typing import Iterable, List

from ..veristat_compare import parse_table, VeristatFields


def gen_csv_table(records: Iterable[str]) -> List[str]:
return [
",".join(VeristatFields.headers()),
*records,
]


class TestVeristatCompare(unittest.TestCase):
def test_parse_table_ignore_new_prog(self):
table = gen_csv_table(
[
"prog_file.bpf.o,prog_name,N/A,success,N/A,N/A,1,N/A",
]
)
veristat_info = parse_table(table)
self.assertEqual(veristat_info.table, [])
self.assertFalse(veristat_info.changes)
self.assertFalse(veristat_info.new_failures)

def test_parse_table_ignore_removed_prog(self):
table = gen_csv_table(
[
"prog_file.bpf.o,prog_name,success,N/A,N/A,1,N/A,N/A",
]
)
veristat_info = parse_table(table)
self.assertEqual(veristat_info.table, [])
self.assertFalse(veristat_info.changes)
self.assertFalse(veristat_info.new_failures)

def test_parse_table_new_failure(self):
table = gen_csv_table(
[
"prog_file.bpf.o,prog_name,success,failure,MISMATCH,1,1,+0 (+0.00%)",
]
)
veristat_info = parse_table(table)
self.assertEqual(
veristat_info.table,
[["prog_file.bpf.o", "prog_name", "success -> failure (!!)", "+0.00 %"]],
)
self.assertTrue(veristat_info.changes)
self.assertTrue(veristat_info.new_failures)

def test_parse_table_new_changes(self):
table = gen_csv_table(
[
"prog_file.bpf.o,prog_name,failure,success,MISMATCH,0,0,+0 (+0.00%)",
"prog_file.bpf.o,prog_name_increase,failure,failure,MATCH,1,2,+1 (+100.00%)",
"prog_file.bpf.o,prog_name_decrease,success,success,MATCH,1,1,-1 (-100.00%)",
]
)
veristat_info = parse_table(table)
self.assertEqual(
veristat_info.table,
[
["prog_file.bpf.o", "prog_name", "failure -> success", "+0.00 %"],
["prog_file.bpf.o", "prog_name_increase", "failure", "+100.00 %"],
["prog_file.bpf.o", "prog_name_decrease", "success", "-100.00 %"],
],
)
self.assertTrue(veristat_info.changes)
self.assertFalse(veristat_info.new_failures)


if __name__ == "__main__":
unittest.main()
21 changes: 21 additions & 0 deletions .github/scripts/tmpfsify-workspace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -x -euo pipefail

TMPFS_SIZE=20 # GB
MEM_TOTAL=$(awk '/MemTotal/ {print int($2/1024)}' /proc/meminfo)

# sanity check: total mem is at least double TMPFS_SIZE
if [ $MEM_TOTAL -lt $(($TMPFS_SIZE*1024*2)) ]; then
echo "tmpfsify-workspace.sh: will not allocate tmpfs, total memory is too low (${MEM_TOTAL}MB)"
exit 0
fi

dir="$(basename "$GITHUB_WORKSPACE")"
cd "$(dirname "$GITHUB_WORKSPACE")"
mv "${dir}" "${dir}.backup"
mkdir "${dir}"
sudo mount -t tmpfs -o size=${TMPFS_SIZE}G tmpfs "${dir}"
rsync -a "${dir}.backup/" "${dir}"
cd -

Loading
Loading