From 0dc1011b0811241432955958e96e76367ba3d26a Mon Sep 17 00:00:00 2001 From: patso Date: Wed, 11 Sep 2024 23:55:55 -0400 Subject: [PATCH] add more details to readme and helpers for local development --- .github/workflows/caching-build.yml | 24 +++++++++++++----------- .gitignore | 3 +++ README.md | 16 ++++++++-------- local-e2e.sh | 16 ++++++++++++++++ 4 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 local-e2e.sh diff --git a/.github/workflows/caching-build.yml b/.github/workflows/caching-build.yml index 5be76ffb7..e94352954 100644 --- a/.github/workflows/caching-build.yml +++ b/.github/workflows/caching-build.yml @@ -1,12 +1,10 @@ name: caching-build on: - # only runs on main, hourly cache update used by all branches - schedule: - - cron: "0 * * * *" push: jobs: build-kernel: + if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo') runs-on: ubuntu-24.04 steps: # redundancy to exit fast @@ -14,8 +12,8 @@ jobs: - run: sudo apt update - run: sudo apt install -y git --no-install-recommends # get latest head commit of sched_ext for-next - - run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $GITHUB_ENV + - run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV - uses: actions/checkout@v4 # use cached kernel if available, create after job if not @@ -54,7 +52,7 @@ jobs: name: Clone Kernel # Get the latest sched-ext enabled kernel directly from the korg # for-next branch - run: git clone --single-branch -b for-next --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git linux + run: git clone --single-branch -b sched_ext https://github.com/sched-ext/sched_ext.git linux && cd linux && git checkout ${{ env.SCHED_EXT_KERNEL_COMMIT }} # guard rail because we are caching - if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} @@ -66,18 +64,20 @@ jobs: - if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} # Build a minimal kernel (with sched-ext enabled) using virtme-ng - run: cd linux && vng -v --build --config ../.github/workflows/sched-ext.config + run: cd linux && find . -type f -exec sed -i 's/-Werror/-Wno-error/g' {} \; && vng -v --build --config ../.github/workflows/sched-ext.config - if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} # Generate kernel headers run: cd linux && make headers integration-test: + if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo') runs-on: ubuntu-24.04 needs: build-kernel strategy: matrix: - scheduler: [ scx_bpfland, scx_lavd, scx_layered, scx_rlfifo, scx_rustland, scx_rusty ] + scheduler: [ scx_layered, scx_rusty ] + fail-fast: false steps: - uses: actions/checkout@v4 - uses: ./.github/actions/install-deps-action @@ -93,7 +93,7 @@ jobs: run: cargo install virtiofsd && sudo cp -a ~/.cargo/bin/virtiofsd /usr/lib/ # get latest head commit of sched_ext for-next - - run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $GITHUB_ENV + - run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV # use cached kernel if available, create after job if not - name: Cache Kernel @@ -133,6 +133,7 @@ jobs: - run: meson compile -C build veristat_${{ matrix.scheduler }} rust-test-core: + if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo') runs-on: ubuntu-24.04 needs: build-kernel strategy: @@ -153,7 +154,7 @@ jobs: run: cargo install virtiofsd && sudo cp -a ~/.cargo/bin/virtiofsd /usr/lib/ # get latest head commit of sched_ext for-next - - run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $GITHUB_ENV + - run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV # cache bzImage alone for rust tests - name: Cache bzImage id: cache-bzImage @@ -178,11 +179,12 @@ jobs: - run: vng -v --memory 10G --cpu 8 -r linux/arch/x86/boot/bzImage --net user -- cargo test --manifest-path rust/${{ matrix.component }}/Cargo.toml rust-test-schedulers: + if: (github.ref != 'refs/heads/main') && (github.ref != 'refs/heads/setup-repo') runs-on: ubuntu-24.04 needs: build-kernel strategy: matrix: - scheduler: [ scx_bpfland, scx_lavd, scx_layered, scx_rlfifo, scx_rustland, scx_rusty ] + scheduler: [ scx_layered, scx_rusty ] steps: - uses: actions/checkout@v4 - uses: ./.github/actions/install-deps-action @@ -198,7 +200,7 @@ jobs: run: cargo install virtiofsd && sudo cp -a ~/.cargo/bin/virtiofsd /usr/lib/ # get latest head commit of sched_ext for-next - - run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $GITHUB_ENV + - run: echo "SCHED_EXT_KERNEL_COMMIT=KERNEL_COMMIT_SHA7_HERE" >> $GITHUB_ENV # cache bzImage alone for rust tests - name: Cache bzImage id: cache-bzImage diff --git a/.gitignore b/.gitignore index cab2ca223..03b2b80a3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ libbpf/ *.gitignore PKGBUILD target +local-linux-checkout +.cache + diff --git a/README.md b/README.md index e06cf7a83..d703378cb 100644 --- a/README.md +++ b/README.md @@ -12,21 +12,20 @@ on kernels with older versions of the sched-ext source tree. ### Setting up a backport -1) Create a branch named `$SHORT_SHA-vmlinux` , where `$SHORT_SHA` is the first 7 characters of the commit hash in the scx kernel tree you are targeting. +1) Create a branch named `$SHORT_SHA-vmlinux` , where `$SHORT_SHA` is the first 7 characters of the commit hash in the scx kernel tree you are targeting. In this branch, in `.github/workflows/caching-build.yml`, replace KERNEL_COMMIT_SHA7_HERE with the 7 character commit hash of the kernel commit you will be packporting to. -2) Run `backport-scripts/generate-backport-vmlinux.sh` passing it `$SHORT_SHA` (such as `af1234`) and branch name, in that order. Optionally, pass a third -arg, the git repo to obtain that commit and branch from, if neccessary. +2) Run `backport-scripts/generate-backport-vmlinux.sh` passing it `$SHORT_SHA` (such as `af1234`) and branch name, in that order. Optionally, pass a third arg, the git repo to obtain that commit and branch from, if neccessary. 3) Update the symlink `scheds/include/vmlinux/vmlinux.h` to point to your new vmlinux.h. -4) Add a CI badge to this branch on this page. +4) Commit and push your branch. -5) Commit and push your branch. +5) Open a new branch (i.e. `af1234-${SCX_RELEASE}-fixes`) off of your initial branch (i.e. `af1234`) +and edit files other than `vmlinux.h` until first `cargo test` (ran in this repo's root) passes and then CI passes. Edit `.github/workflows/caching-build.yml` as is neccessary to reducing the schedulers built/tested (not everything can be reasonably backported). -6) Open a new branch (i.e. `af1234-${SCX_RELEASE}-fixes`) off of your initial branch (i.e. `af1234`) -and edit files other than `vmlinux.h` until first `cargo test` (ran in this repo's root) passes and then CI passes. +6) Push this branch as you get things working, push it as `af1234-${SCX_RELEASE}-backport` once CI passes. -7) Push this branch as you get things working, push it as `af1234-${SCX_RELEASE}-backport` once CI passes. +7) Add a CI badge on this page on the setup-repo branch for the CI job for that new branch. ### Updating a backport @@ -38,3 +37,4 @@ and edit files other than `vmlinux.h` until first `cargo test` (ran in this repo Please make any updates to this document and the setup scripts on the branch `setup-repo`. This will be rebased atop `main` when merging in updates. *`main` will be updated periodically (roughly coinciding with releases of scx), backports will be updated/created on an as-needed basis.* +*`main` will be overwritten with commits from upstream during syncs. setup-repo will be rebased upon main and pushed to main before rebasing other branches, so put things to persist across this process on setup-repo.` \ No newline at end of file diff --git a/local-e2e.sh b/local-e2e.sh new file mode 100644 index 000000000..67b7b6200 --- /dev/null +++ b/local-e2e.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euxo pipefail + +SCHED="$1" +REPO_ROOT="$(git rev-parse --show-toplevel)" + +cd ./local-linux-checkout || exit 1 +vng -v --memory 10G --cpu 8 --build --config "${REPO_ROOT}/.github/workflows/sched-ext.config" +cd $OLDPWD || exit 1 +meson setup build -Dkernel=./local-linux-checkout -Dkernel_headers=./local-linux-checkout/usr/include -Denable_stress=true +ln -sf "${REPO_ROOT}/local-linux-checkout" "${REPO_ROOT}/build/local-linux-checkout" +meson compile -C build "$SCHED" +meson compile -C build test_sched_"$SCHED" +meson compile -C build stress_tests_"$SCHED" +