Skip to content

Commit 74f3404

Browse files
committed
Sync kernel-patches/vmtest
Sync workflows, configs and temporary patches with current kernel-patches/vmtest master. Signed-off-by: Ihor Solodrai <[email protected]>
1 parent 83f98c7 commit 74f3404

File tree

6 files changed

+107
-14
lines changed

6 files changed

+107
-14
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
GCC_BPF_RELEASE_GH_REPO=$1
6+
INSTALL_DIR=$(realpath $2)
7+
8+
cd /tmp
9+
10+
tag=$(gh release list -L 1 -R ${GCC_BPF_RELEASE_GH_REPO} --json tagName -q .[].tagName)
11+
if [[ -z "$tag" ]]; then
12+
echo "Could not find latest GCC BPF release at ${GCC_BPF_RELEASE_GH_REPO}"
13+
exit 1
14+
fi
15+
16+
url="https://github.com/${GCC_BPF_RELEASE_GH_REPO}/releases/download/${tag}/${tag}.tar.zst"
17+
echo "Downloading $url"
18+
wget -q "$url"
19+
20+
tarball=${tag}.tar.zst
21+
dir=$(tar tf $tarball | head -1 || true)
22+
23+
echo "Extracting $tarball ..."
24+
tar -I zstd -xf $tarball && rm -f $tarball
25+
26+
rm -rf $INSTALL_DIR
27+
mv -v $dir $INSTALL_DIR
28+
29+
cd -
30+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -x -euo pipefail
4+
5+
TMPFS_SIZE=20 # GB
6+
MEM_TOTAL=$(awk '/MemTotal/ {print int($2/1024)}' /proc/meminfo)
7+
8+
# sanity check: total mem is at least double TMPFS_SIZE
9+
if [ $MEM_TOTAL -lt $(($TMPFS_SIZE*1024*2)) ]; then
10+
echo "tmpfsify-workspace.sh: will not allocate tmpfs, total memory is too low (${MEM_TOTAL}MB)"
11+
exit 0
12+
fi
13+
14+
dir="$(basename "$GITHUB_WORKSPACE")"
15+
cd "$(dirname "$GITHUB_WORKSPACE")"
16+
mv "${dir}" "${dir}.backup"
17+
mkdir "${dir}"
18+
sudo mount -t tmpfs -o size=${TMPFS_SIZE}G tmpfs "${dir}"
19+
rsync -a "${dir}.backup/" "${dir}"
20+
cd -
21+

.github/workflows/gcc-bpf.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,19 @@ on:
2525
jobs:
2626
test:
2727
name: GCC BPF
28-
runs-on: ${{ fromJSON(inputs.runs_on) }}
29-
timeout-minutes: 100
28+
runs-on: >-
29+
${{
30+
contains(fromJSON(inputs.runs_on), 'codebuild')
31+
&& format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt)
32+
|| fromJSON(inputs.runs_on)
33+
}}
3034
env:
3135
ARCH: ${{ inputs.arch }}
32-
BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/gcc-bpf
3336
BPF_NEXT_BASE_BRANCH: 'master'
34-
REPO_ROOT: ${{ github.workspace }}/src
37+
GCC_BPF_INSTALL_DIR: ${{ github.workspace }}/gcc-bpf
38+
GCC_BPF_RELEASE_REPO: 'theihor/gcc-bpf'
3539
KBUILD_OUTPUT: ${{ github.workspace }}/src/kbuild-output
40+
REPO_ROOT: ${{ github.workspace }}/src
3641

3742
steps:
3843

@@ -45,6 +50,12 @@ jobs:
4550
dest: ${{ env.REPO_ROOT }}
4651
rev: ${{ env.BPF_NEXT_BASE_BRANCH }}
4752

53+
- if: ${{ ! inputs.download_sources }}
54+
name: Checkout ${{ github.repository }} to ./src
55+
uses: actions/checkout@v4
56+
with:
57+
path: 'src'
58+
4859
- uses: ./patch-kernel
4960
with:
5061
patches-root: '${{ github.workspace }}/ci/diffs'
@@ -65,16 +76,17 @@ jobs:
6576
arch: ${{ inputs.arch }}
6677
llvm-version: ${{ inputs.llvm-version }}
6778

68-
- name: Build GCC BPF compiler
69-
uses: ./build-bpf-gcc
70-
with:
71-
install-dir: ${{ env.BPF_GCC_INSTALL_DIR }}
79+
- name: Download GCC BPF compiler
80+
shell: bash
81+
env:
82+
GH_TOKEN: ${{ github.token }}
83+
run: .github/scripts/download-gcc-bpf.sh ${{ env.GCC_BPF_RELEASE_REPO }} ${{ env.GCC_BPF_INSTALL_DIR }}
7284

7385
- name: Build selftests/bpf/test_progs-bpf_gcc
7486
uses: ./build-selftests
7587
env:
88+
BPF_GCC: ${{ env.GCC_BPF_INSTALL_DIR }}
7689
MAX_MAKE_JOBS: 32
77-
BPF_GCC: ${{ env.BPF_GCC_INSTALL_DIR }}
7890
SELFTESTS_BPF_TARGETS: 'test_progs-bpf_gcc'
7991
with:
8092
arch: ${{ inputs.arch }}

.github/workflows/kernel-build-test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ on:
5151
default: false
5252

5353
jobs:
54+
5455
# Build kernel and selftest
5556
build:
5657
uses: ./.github/workflows/kernel-build.yml
@@ -70,7 +71,7 @@ jobs:
7071
arch: ${{ inputs.arch }}
7172
toolchain_full: ${{ inputs.toolchain_full }}
7273
toolchain: ${{ inputs.toolchain }}
73-
runs_on: ${{ inputs.runs_on }}
74+
runs_on: ${{ inputs.build_runs_on }}
7475
llvm-version: ${{ inputs.llvm-version }}
7576
kernel: ${{ inputs.kernel }}
7677
download_sources: ${{ inputs.download_sources }}
@@ -101,7 +102,8 @@ jobs:
101102
uses: ./.github/workflows/gcc-bpf.yml
102103
needs: [build]
103104
with:
104-
runs_on: ${{ inputs.runs_on }}
105+
# GCC BPF does not need /dev/kvm, so use the "build" runners
106+
runs_on: ${{ inputs.build_runs_on }}
105107
arch: ${{ inputs.arch }}
106108
llvm-version: ${{ inputs.llvm-version }}
107109
toolchain: ${{ inputs.toolchain }}

.github/workflows/kernel-build.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,36 @@ on:
4242
jobs:
4343
build:
4444
name: build for ${{ inputs.arch }} with ${{ inputs.toolchain_full }}${{ inputs.release && '-O2' || '' }}
45-
runs-on: ${{ fromJSON(inputs.runs_on) }}
46-
timeout-minutes: 100
45+
# To run on CodeBuild, runs-on value must correspond to the AWS
46+
# CodeBuild project associated with the kernel-patches webhook
47+
# However matrix.py passes just a 'codebuild' string
48+
runs-on: >-
49+
${{
50+
contains(fromJSON(inputs.runs_on), 'codebuild')
51+
&& format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt)
52+
|| fromJSON(inputs.runs_on)
53+
}}
4754
env:
4855
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
4956
BPF_NEXT_BASE_BRANCH: 'master'
5057
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
58+
CROSS_COMPILE: ${{ inputs.arch != 'x86_64' && 'true' || '' }}
5159
# BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
5260
KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output
5361
KERNEL: ${{ inputs.kernel }}
5462
KERNEL_ROOT: ${{ github.workspace }}
5563
REPO_PATH: ""
5664
REPO_ROOT: ${{ github.workspace }}
65+
RUNNER_TYPE: ${{ contains(fromJSON(inputs.runs_on), 'codebuild') && 'codebuild' || 'default' }}
5766
steps:
5867
- uses: actions/checkout@v4
5968
with:
6069
fetch-depth: ${{ inputs.download_sources && 1 || env.BPF_NEXT_FETCH_DEPTH }}
70+
71+
- if: ${{ env.RUNNER_TYPE == 'codebuild' }}
72+
shell: bash
73+
run: .github/scripts/tmpfsify-workspace.sh
74+
6175
- if: ${{ inputs.download_sources }}
6276
name: Download bpf-next tree
6377
env:
@@ -66,6 +80,7 @@ jobs:
6680
with:
6781
dest: '.kernel'
6882
rev: ${{ env.BPF_NEXT_BASE_BRANCH }}
83+
6984
- uses: ./prepare-incremental-build
7085
with:
7186
repo-root: ${{ inputs.download_sources && '.kernel' || env.REPO_ROOT }}
@@ -99,6 +114,18 @@ jobs:
99114
llvm-version: ${{ inputs.llvm-version }}
100115
pahole: master
101116

117+
# We have to setup qemu+binfmt in order to enable cross-compation of selftests.
118+
# During selftests build, freshly built bpftool is executed.
119+
# On self-hosted bare-metal hosts binfmt is pre-configured.
120+
- if: ${{ env.RUNNER_TYPE == 'codebuild' && env.CROSS_COMPILE }}
121+
name: Set up docker
122+
uses: docker/setup-docker-action@v4
123+
- if: ${{ env.RUNNER_TYPE == 'codebuild' && env.CROSS_COMPILE }}
124+
name: Setup binfmt and qemu
125+
uses: docker/setup-qemu-action@v3
126+
with:
127+
image: tonistiigi/binfmt:qemu-v9.2.0
128+
102129
- name: Build kernel image
103130
uses: ./build-linux
104131
with:

.github/workflows/kernel-test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
SELFTESTS_BPF: ${{ github.workspace }}/selftests/bpf
7474
VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
7575
TEST_PROGS_TRAFFIC_MONITOR: ${{ inputs.arch == 'x86_64' && 'true' || '' }}
76-
TEST_PROGS_WATCHDOG_TIMEOUT: 300
76+
TEST_PROGS_WATCHDOG_TIMEOUT: 600
7777
with:
7878
arch: ${{ inputs.arch }}
7979
vmlinuz: '${{ github.workspace }}/vmlinuz'
@@ -83,6 +83,7 @@ jobs:
8383
# Here we must use kbuild-output local to the repo, because
8484
# it was extracted from the artifacts.
8585
kbuild-output: ${{ env.REPO_ROOT }}/kbuild-output
86+
8687
- if: ${{ always() }}
8788
uses: actions/upload-artifact@v4
8889
with:

0 commit comments

Comments
 (0)