diff --git a/.ci/check-format.sh b/.ci/check-format.sh index 27379e2b..935ed998 100755 --- a/.ci/check-format.sh +++ b/.ci/check-format.sh @@ -25,6 +25,8 @@ if [ -z "${CLANG_FORMAT:-}" ]; then fi ret=0 +# The benchmark corpus is fixed input data. Formatting it would invalidate its +# performance baseline, so keep it out of the C source set. while IFS= read -r -d '' file; do expected=$(mktemp) "$CLANG_FORMAT" "$file" > "$expected" 2> /dev/null @@ -33,6 +35,6 @@ while IFS= read -r -d '' file; do fi rm -f "$expected" done < <(git ls-files -z -- 'src/*.c' 'src/*.h' 'src/**/*.c' 'src/**/*.h' \ - 'tests/*.c' 'tests/*.h') + 'tests/*.c' 'tests/*.h' ':(exclude)tests/bench-corpus/**') exit $ret diff --git a/.github/workflows/bench-report.yml b/.github/workflows/bench-report.yml new file mode 100644 index 00000000..55933fab --- /dev/null +++ b/.github/workflows/bench-report.yml @@ -0,0 +1,172 @@ +# Publish benchmark changes from an unprivileged pull_request run. This file +# must live on the default branch for workflow_run to grant its scoped token. +name: Benchmark PR report + +on: + workflow_run: + workflows: [CI] + types: [completed] + +permissions: + actions: read + contents: read + pull-requests: write + +jobs: + comment: + name: Comment on benchmark changes + if: ${{ github.event.workflow_run.event == 'pull_request' }} + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - name: Find benchmark report artifact + id: artifact + uses: actions/github-script@v9 + with: + script: | + const artifacts = await github.paginate( + github.rest.actions.listWorkflowRunArtifacts, + { + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + per_page: 100, + } + ); + const report = artifacts.find( + artifact => artifact.name === 'bench-pr-report' && !artifact.expired + ); + if (report && report.size_in_bytes > 128 * 1024) { + core.setFailed(`Benchmark report artifact is unexpectedly large: ${report.size_in_bytes} bytes`); + core.setOutput('found', false); + return; + } + core.setOutput('found', report !== undefined); + + - name: Checkout trusted reporter + if: ${{ steps.artifact.outputs.found == 'true' }} + uses: actions/checkout@v7 + with: + ref: ${{ github.event.repository.default_branch }} + persist-credentials: false + + - name: Download benchmark report + if: ${{ steps.artifact.outputs.found == 'true' }} + uses: actions/download-artifact@v7 + with: + name: bench-pr-report + path: ${{ runner.temp }}/bench-pr-report + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Render benchmark comment + if: ${{ steps.artifact.outputs.found == 'true' }} + id: render + env: + COMMENT_PATH: ${{ runner.temp }}/bench-comment.md + REPORT_PATH: ${{ runner.temp }}/bench-pr-report/bench-pr-report.json + run: | + set -euo pipefail + python3 scripts/bench-report.py \ + --report "$REPORT_PATH" --output "$COMMENT_PATH" \ + --environment elfuse-aarch64 --threshold 0.20 + if [ -s "$COMMENT_PATH" ]; then + echo 'should-comment=true' >> "$GITHUB_OUTPUT" + else + echo 'should-comment=false' >> "$GITHUB_OUTPUT" + fi + + - name: Create or update benchmark comment + if: ${{ steps.render.outputs.should-comment == 'true' }} + uses: actions/github-script@v9 + env: + COMMENT_PATH: ${{ runner.temp }}/bench-comment.md + with: + script: | + const fs = require('fs'); + const marker = ''; + const run = context.payload.workflow_run; + const runHead = run.head_sha; + const headRepository = run.head_repository; + const headOwner = headRepository && headRepository.owner && headRepository.owner.login; + const headBranch = run.head_branch; + if (typeof runHead !== 'string' || !/^[0-9a-f]{40}$/i.test(runHead)) { + core.setFailed('The workflow run has no valid head SHA'); + return; + } + if (typeof headOwner !== 'string' || !headOwner || + typeof headBranch !== 'string' || !headBranch || + !headRepository.full_name) { + core.setFailed('The workflow run has no valid head repository/ref'); + return; + } + + // workflow_run.pull_requests is empty for fork runs in this repo. + // Resolve the PR from trusted workflow-run identity fields, then + // require its current head to match before using the write token. + const candidates = await github.paginate( + github.rest.pulls.list, + { + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + base: context.payload.repository.default_branch, + head: `${headOwner}:${headBranch}`, + per_page: 100, + } + ); + const matches = candidates.filter(pull => + pull.head && pull.head.sha === runHead && pull.head.repo && + pull.head.repo.full_name === headRepository.full_name + ); + if (matches.length !== 1) { + core.notice(`Expected one current pull request for ${headRepository.full_name}:${headBranch}@${runHead}, got ${matches.length}`); + return; + } + const pullNumber = matches[0].number; + + const {data: pull} = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pullNumber, + }); + if (pull.head.sha !== runHead) { + core.notice(`Skipping stale benchmark for ${runHead}; current HEAD is ${pull.head.sha}`); + return; + } + + const report = fs.readFileSync(process.env.COMMENT_PATH, 'utf8').trim(); + if (!report) { + return; + } + const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${run.id}`; + const body = `${marker}\n${report}\n\n[Workflow run](${runUrl}) ยท commit \`${runHead.slice(0, 12)}\`\n`; + const comments = await github.paginate( + github.rest.issues.listComments, + { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pullNumber, + per_page: 100, + } + ); + const previous = comments.find(comment => + comment.user && comment.user.login === 'github-actions[bot]' && + typeof comment.body === 'string' && comment.body.includes(marker) + ); + + if (previous) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: previous.id, + body, + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pullNumber, + body, + }); + } diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6276c986..1eed63eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,9 @@ # scan-macos : LLVM scan-build via `make analyze` # infer-macos : Facebook Infer capture + analyze over the full build # runtime-macos : HVF runtime tests on self-hosted Apple Silicon, -# including release, ASAN, UBSAN, and TSAN variants +# including release, ASAN, UBSAN, and TSAN variants, +# plus a Benchmark leg (tests/bench-suite.sh) that +# compares against tests/bench-baseline.json # # Runtime and sanitizer tests require Hypervisor.framework, which # GitHub-hosted macOS runners do not expose. Those tests run on self-hosted @@ -341,11 +343,17 @@ jobs: github.repository == 'sysprog21/elfuse' && (github.event_name == 'push' || github.event_name == 'pull_request') runs-on: [self-hosted, macOS, arm64] - # Sanitizer builds run several times slower than the release build, so the - # job budget and the per-test TEST_TIMEOUT are widened per leg. Without - # that, a TSAN-slowed guest overruns the 10s default TEST_TIMEOUT and the - # 20-minute job budget, surfacing as TIMEOUT reds indistinguishable from a - # real hang. + # Sanitizers run several times slower than Release, so job_timeout and + # per-test TEST_TIMEOUT are widened per leg -- a slow-but-healthy TSAN + # guest would otherwise overrun the 10s default TEST_TIMEOUT and read + # as TIMEOUT, indistinguishable from a real hang. + # + # job_timeout also has to cover queueing for the shared host lock (see + # "Acquire shared host lock" below): the Benchmark leg holds it + # exclusively for its ~10-minute run, so other legs budget a 15-minute + # queue on top of their own runtime. The Benchmark leg's 95-minute + # budget stacks its own 15-minute queue, the longest sibling's + # 60-minute budget, its ~10-minute run, and setup margin. timeout-minutes: ${{ matrix.job_timeout }} strategy: fail-fast: false @@ -359,7 +367,8 @@ jobs: ubsan_options: '' tsan_options: '' test_timeout: '' - job_timeout: 20 + job_timeout: 35 + shared_lock_wait: 15 run_matrix: true check_target: check brew_pkgs: binutils qemu @@ -370,7 +379,8 @@ jobs: ubsan_options: '' tsan_options: '' test_timeout: '30' - job_timeout: 30 + job_timeout: 45 + shared_lock_wait: 15 run_matrix: false check_target: check-sanitizer brew_pkgs: binutils @@ -381,7 +391,8 @@ jobs: ubsan_options: halt_on_error=1:print_stacktrace=1 tsan_options: '' test_timeout: '30' - job_timeout: 30 + job_timeout: 45 + shared_lock_wait: 15 run_matrix: false check_target: check-sanitizer brew_pkgs: binutils @@ -392,10 +403,29 @@ jobs: ubsan_options: '' tsan_options: halt_on_error=1 test_timeout: '60' - job_timeout: 45 + job_timeout: 60 + shared_lock_wait: 15 run_matrix: false check_target: check-sanitizer brew_pkgs: binutils + # Benchmark leg: runs `make bench-ci`'s two-tier + # suite on a Release build, compares against the committed + # baseline(elfuse, orbstack, qemu-aarch64), and uploads the + # results as an artifact. + - name: Benchmark + sanitizer: bench + extra_cflags: '' + asan_options: '' + ubsan_options: '' + tsan_options: '' + test_timeout: '' + job_timeout: 95 + shared_lock_wait: 15 + lock_wait: 60 + run_matrix: false + run_bench: true + check_target: '' + brew_pkgs: binutils qemu # contents: read for the checkout; pull-requests: read so the guard can # query the PR's current HEAD. (actions: write would let the guard @@ -428,18 +458,6 @@ jobs: MAKEFLAGS: -j8 steps: - # Fail fast if this run targets a commit that is no longer the PR's - # HEAD. cancel-in-progress covers "commit 2 pushed while commit 1 is - # still running", but NOT a manual "Re-run jobs" on an old run: a - # re-run replays the original event payload (a frozen head.sha) - # against this single self-hosted runner, which would otherwise burn - # the full job timeout re-testing stale code. Compare the frozen - # head.sha against the live PR HEAD; when they differ, exit 1 with a - # clear "commit is no longer the latest" message. We fail (rather than - # cancel) because repo policy caps the token at actions: read, so the - # cancel API is unavailable. exit 1 also stops the job, so the later - # steps are skipped automatically -- no per-step guard needed. The - # lookup fails open: if HEAD can't be determined the job runs. - name: Fail fast if superseded by a newer PR commit if: github.event_name == 'pull_request' env: @@ -467,20 +485,19 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Acquire shared host lock (normal runtime load) + # Multiple runners share this physical machine, so a compile on + # the sibling runner would spike a benchmark's microsecond-scale + # measurements. Every leg holds a machine-global shared lock during + # setup/build and still coexists with other readers. The benchmark + # releases it and takes the exclusive lock immediately around + # make bench-ci, so normal legs never queue behind artifact work. + run: | + CI_HOST_LOCK_WAIT_MIN=${{ matrix.shared_lock_wait }} \ + scripts/ci-host-lock.sh acquire shared + - name: Restore cached test fixtures - # Only the release leg needs fixtures: the sanitizer legs run the - # fixture-free check-sanitizer subset. - if: ${{ matrix.run_matrix }} - # actions/checkout's default clean:true runs `git clean -ffdx`, which - # wipes externals/test-fixtures (gitignored) on this self-hosted - # runner even though its disk otherwise persists across runs. - # fetch-fixtures.sh is already idempotent -- it skips re-downloading - # Alpine packages when externals/test-fixtures/versions.lock still - # matches -- so stash that tree outside the workspace and restore it - # here as a real directory. The qemu lane in tests/test-matrix.sh - # shares the workspace root with the guest over virtio-9p, and a - # symlink pointing outside that root does not resolve inside the - # guest, so this must be a real copy, not a symlink. + if: ${{ matrix.run_matrix || matrix.run_bench }} run: | cache="$HOME/.cache/elfuse-ci/test-fixtures" if [ -d "$cache" ]; then @@ -552,10 +569,6 @@ jobs: ls -l "$ROSETTA" - name: Build elfuse - # make does not track EXTRA_CFLAGS changes, so an object built for one - # sanitizer must not be reused for another. Checkout already wipes - # build/ (git clean -ffdx), but clean explicitly so the leg builds from - # scratch even on a workspace that was not freshly cleaned. run: | make clean make EXTRA_CFLAGS="$EXTRA_CFLAGS" elfuse @@ -574,9 +587,7 @@ jobs: make EXTRA_CFLAGS="$EXTRA_CFLAGS" test-multi-vcpu - name: make check - # Release runs the full check suite; sanitizer legs run check-sanitizer, - # a representative internal-implementation subset (the release lane plus - # test-matrix already cover Linux syscall compatibility). + if: ${{ matrix.check_target != '' }} run: | make EXTRA_CFLAGS="$EXTRA_CFLAGS" ${{ matrix.check_target }} @@ -585,6 +596,46 @@ jobs: run: | bash tests/test-matrix.sh all + - name: Benchmark suite (make bench-ci) + if: ${{ matrix.run_bench }} + run: | + scripts/ci-host-lock.sh release + CI_HOST_LOCK_WAIT_MIN=${{ matrix.lock_wait }} \ + scripts/ci-host-lock.sh acquire exclusive + trap 'scripts/ci-host-lock.sh release' EXIT + make bench-ci + + - name: Compare against baseline (soft regressions) + # Soft signal for now: the self-hosted runner's run-to-run variance + # is not yet characterized, so a regression prints loudly in the log + # but does not fail the leg. Flip criterion: once the leg has run + # for ~2 weeks / ~20 runs with every ratio inside the +20% threshold, + # drop BENCH_REPORT_ONLY=1 so regressions hard-fail. Missing metrics + # remain hard failures: they mean a benchmark errored or timed out and + # must not silently remove coverage during the ramp. + if: ${{ matrix.run_bench }} + run: | + BENCH_REPORT_ONLY=1 python3 scripts/bench-compare.py \ + --fail-on-missing --report-json build/bench-pr-report.json + + - name: Upload benchmark PR report + if: ${{ matrix.run_bench && !cancelled() && github.event_name == 'pull_request' }} + uses: actions/upload-artifact@v7 + with: + name: bench-pr-report + path: build/bench-pr-report.json + retention-days: 14 + if-no-files-found: ignore + + - name: Upload benchmark results + if: ${{ matrix.run_bench && !cancelled() }} + uses: actions/upload-artifact@v7 + with: + name: bench-results-${{ runner.os }}-${{ runner.arch }} + path: build/bench-results.json + retention-days: 14 + if-no-files-found: warn + - name: Upload runtime binary if: ${{ !cancelled() }} uses: actions/upload-artifact@v7 @@ -595,13 +646,14 @@ jobs: if-no-files-found: warn - name: Save test fixtures cache - # Persist externals/test-fixtures outside the workspace so the next - # run's "Restore cached test fixtures" step can skip re-downloading - # unchanged Alpine packages. Runs even if an earlier step failed, as - # long as the job wasn't cancelled, so a fixture-unrelated test - # failure doesn't cost the next run its cache. - if: ${{ !cancelled() && matrix.sanitizer == 'release' }} + if: ${{ !cancelled() && (matrix.sanitizer == 'release' || matrix.run_bench) }} run: | + if [ "${{ matrix.sanitizer }}" = "bench" ]; then + scripts/ci-host-lock.sh release + CI_HOST_LOCK_WAIT_MIN=${{ matrix.shared_lock_wait }} \ + scripts/ci-host-lock.sh acquire shared + trap 'scripts/ci-host-lock.sh release' EXIT + fi if [ -d externals/test-fixtures ]; then cache="$HOME/.cache/elfuse-ci/test-fixtures" mkdir -p "$(dirname "$cache")" @@ -611,3 +663,7 @@ jobs: else echo "No externals/test-fixtures to save" fi + + - name: Release host lock + if: ${{ always() }} + run: scripts/ci-host-lock.sh release diff --git a/docs/testing.md b/docs/testing.md index c42e1b72..cc227bb2 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -118,6 +118,8 @@ What they do: - `make test-gdbstub`: debugger integration checks against the built-in GDB stub - `make test-matrix`: cross-check `elfuse` (aarch64), QEMU (aarch64), and `elfuse` (x86_64-via-Rosetta) on overlapping corpora +- `make bench`: two-tier performance benchmark suite (see Performance + Benchmarks below); `make bench-ci` is the strict CI variant - `make lint`: static analysis through `clang-tidy` ## Quick Iteration @@ -132,11 +134,7 @@ make test-matrix-elfuse-aarch64 `make check` alone only covers elfuse-internal plumbing and the sanitizer subset now; `test-matrix-elfuse-aarch64` is what actually exercises the full -unit-test surface against `build/elfuse` (no qemu boot needed, so it is about -as fast to iterate with as `make check` was before the split). For changes -that touch procfs, path handling, `/dev`, FUSE, networking, dynamic linking, -or guest process semantics, also cross-check against the qemu reference -kernel: +unit-test surface against `build/elfuse`. ```sh make test-matrix-qemu-aarch64 @@ -144,191 +142,209 @@ make test-matrix-qemu-aarch64 or run all matrix modes back-to-back with `make test-matrix`. -`make check` already runs the BusyBox applet suite as a second stage, so a -green `make check` covers BusyBox validation. Use `make test-busybox` to -iterate on a single applet failure without rerunning the unit suite. +## Performance Benchmarks + +`make bench` runs `tests/bench-suite.sh`, the two-tier suite, and +writes `build/bench-results.json`: + +- Tier 1 -- lmbench (issue #195): `lat_syscall` + (null/read/write/stat/open) for syscall entry/forwarding cost, + `lat_proc` (fork, fork+execve) for process creation and the ELF-load + path, and `lat_fs -s 1024` (1 KiB create/delete only). + +- Tier 2 -- application workloads over the fixed corpus in + `tests/bench-corpus/` using Alpine fixture tools: `python3 -c pass`, + `git status`, `rg`, `zstd`, and `make`. `rg` searches 512 deterministic + copies of the source tree (~87 MiB, tens of thousands of files) and + `zstd` compresses a matching ~87 MiB input -- fixed sizes chosen so + command startup and scheduler jitter don't dominate what would + otherwise be millisecond-scale workloads + +Each metric runs warmup + timed iterations and reports the median plus +raw samples. `scripts/bench-compare.py` diffs the results against +`tests/bench-baseline.json` and exits non-zero on a metric regressing +past the threshold (default +20%, `BENCH_REGRESSION_THRESHOLD`) or +missing from the current run; `BENCH_REPORT_ONLY=1` downgrades that to +a log-only signal, which is how the CI `Benchmark` leg runs. + +CI measures only the `elfuse-aarch64` column. `qemu-aarch64` (a real +Linux kernel on the same silicon) and the optional `orbstack` column +are static references, captured manually per the refresh procedure +below. + +`BENCH_ENV=qemu-aarch64 make bench` produces the `qemu-aarch64` +reference column; `BENCH_ENV=orbstack` runs the workloads inside the +default OrbStack machine (Tier-2 tools must be installed there); +`BENCH_ENV=native` also works on an aarch64 Linux host. + +Do not edit `tests/bench-corpus/` -- the corpus is part of the benchmark +definition, and any change to it invalidates the baseline. + +### Manual / Ad-hoc Runs + +Prefer the Makefile targets (`bench` / `bench-ci`, `BENCH_ENV` picks the +column) for a full run -- they build the prerequisites and wire up +`ELFUSE`/`BENCH_BIN_DIR`. The commands below drive the same pieces +directly, useful for iterating on one case or comparing an existing +results file without rerunning everything. + +**Full suite with custom env/output:** + +```sh +BENCH_ENV=elfuse-aarch64 BENCH_ITERATIONS=20 BENCH_WARMUP=3 \ + bash tests/bench-suite.sh -o build/bench-results.json +``` + +`BENCH_ENV` selects the column (`elfuse-aarch64` default, +`qemu-aarch64`, `orbstack`, `native`); the CI variant just adds +`BENCH_STRICT=1` (fetch fixtures on demand, fail hard instead of +skipping Tier 2 when they're missing). + +**One Tier-1 benchmark without the suite harness:** + +```sh +tests/fetch-fixtures.sh # builds the lmbench fixtures once +env ENOUGH=100000 ./build/elfuse \ + externals/test-fixtures/aarch64-musl/staticbin/bin/busybox \ + sh -c '"$0" "$@"; exit $?' \ + externals/test-fixtures/aarch64-musl/lmbench/lat_syscall -N 5 null +``` + +**One Tier-2 workload's wall-clock cost:** + +```sh +./build/elfuse --sysroot externals/test-fixtures/rootfs \ + ./build/bench-timeit /bin/busybox true +``` + +**Compare an existing results file against baseline without rerunning:** + +```sh +python3 scripts/bench-compare.py --results build/bench-results.json \ + --baseline tests/bench-baseline.json --threshold 0.20 \ + --report-json build/bench-pr-report.json +``` + +Add `--report-only` (or `BENCH_REPORT_ONLY=1`) to print regressions +without a non-zero exit. Any file matching the schema in +`tests/bench-suite.sh`'s header works, including one captured with +`BENCH_ENV=qemu-aarch64`/`orbstack`/`native`. + +**Promote a captured results file into the baseline:** + +```sh +python3 scripts/bench-promote.py --results build/bench-results.json \ + --baseline tests/bench-baseline.json +``` + +**Environment variables** (all optional; defaults shown): + +| Variable | Default | Meaning | +| --- | --- | --- | +| `BENCH_ENV` | `elfuse-aarch64` | column: `elfuse-aarch64` \| `qemu-aarch64` \| `orbstack` \| `native` | +| `BENCH_ITERATIONS` | `10` | timed Tier-2 samples per metric | +| `BENCH_WARMUP` | `2` | discarded leading Tier-2 samples per metric | +| `BENCH_LMBENCH_REPS` | `1` | lmbench `-N` repetitions per Tier-1 outer sample; outer samples provide the median | +| `BENCH_LMBENCH_RETRIES` | `1` | extra attempts for a failed/hung Tier-1 benchmark before its `ERR` row | +| `BENCH_LMBENCH_TIMEOUT` | `60` | per-lmbench-invocation timeout in seconds | +| `BENCH_LMBENCH_ENOUGH` | `100000` | lmbench `ENOUGH` (us per timing interval); empty restores lmbench auto-calibration | +| `LMBENCH_DIR` | fixtures `aarch64-musl/lmbench` | directory holding the lmbench fixture binaries | +| `BENCH_STRICT` | `0` | `1` = missing fixtures are fatal and fetched on demand (what `bench-ci` sets) | +| `ELFUSE` | `build/elfuse` | elfuse binary driving the elfuse-aarch64 column | +| `BENCH_BIN_DIR` | `build/` | directory holding `bench-timeit` | +| `TEST_TIMEOUT` | `120` | per-invocation timeout in seconds | +| `BENCH_QEMU_NULL_CEILING` | `180` | ns/op; the qemu boot-calibration probe reboots the VM above this (efficiency-core placement) | +| `BENCH_QEMU_BOOT_RETRIES` | `2` | qemu boot-calibration retry attempts before proceeding with a warning | +| `BENCH_REGRESSION_THRESHOLD` | `0.20` | fractional regression that fails `bench-compare.py` | +| `BENCH_REPORT_ONLY` | unset | `1` = `bench-compare.py` reports regressions but exits 0 | ## Test Matrix -The matrix driver lives in `tests/test-matrix.sh`. It currently covers three +The matrix driver lives in `tests/test-matrix.sh` and covers three execution modes: -- `elfuse-aarch64`: every binary is executed via `build/elfuse` on macOS +- `elfuse-aarch64`: every binary executed via `build/elfuse` on macOS - `qemu-aarch64`: the same binaries run natively inside an Alpine `aarch64-linux-musl` minirootfs booted by `qemu-system-aarch64` -- `elfuse-x86_64`: Rosetta-for-Linux acceptance scripts against the staged - Alpine x86_64 fixture tree - -The goal is not to compare performance. The goal is to compare guest-observable -behavior against a ground-truth Linux AArch64 environment so that any divergence -in syscall translation, procfs emulation, or process semantics is caught early. - -`run_unit_tests` in `tests/test-matrix.sh` is the full aarch64 unit-test -surface -- every binary that is meaningful to run against a real kernel, which -is almost everything. It deliberately excludes only the handful of tests that -assert elfuse-internal implementation details with no meaningful counterpart -on a real kernel (the EL1 shim fast-path suite, `test-mremap-infra`, -`test-oom-proc` -- these live solely in `tests/manifest.txt` / `make check`, -see that file's header for the full split rationale). There is no separate -"core" vs "extended" test set inside the matrix; a test that has a real, -understood divergence from the qemu reference kernel is listed in -`QEMU_SKIP` with a comment explaining why instead -- see that variable in -`tests/test-matrix.sh` for the current list and rationale. `run_unit_tests` -runs in both `elfuse-aarch64` and `qemu-aarch64` modes, so most tests are -exercised twice per matrix run: once against `build/elfuse`, once against the -real kernel. - -The x86_64 mode is narrower: it aggregates the Rosetta-specific acceptance -scripts and their per-binary summaries into the same matrix runner, including -the Rosetta thread/signal audit smoke, the LuaJIT guest-JIT probe, and the -glibc dynamic-binary acceptance helper. +- `elfuse-x86_64`: Rosetta-for-Linux acceptance scripts against the + staged Alpine x86_64 fixture tree + +The goal is to compare guest-observable behavior against a +ground-truth Linux AArch64 environment, not performance, so any +divergence in syscall translation, procfs emulation, or process +semantics is caught early. + +`run_unit_tests` runs almost the entire aarch64 unit-test surface, in +both `elfuse-aarch64` and `qemu-aarch64` modes -- excluding only the +elfuse-internal tests already covered by `make check` (see +`tests/manifest.txt`) and the known divergences listed in `QEMU_SKIP`. +The x86_64 mode aggregates the Rosetta-specific acceptance scripts +instead. Run a single mode with `bash tests/test-matrix.sh elfuse-aarch64`, -`bash tests/test-matrix.sh qemu-aarch64`, or -`bash tests/test-matrix.sh elfuse-x86_64`; `all` runs all three back-to-back. - -Fixture handling is self-contained: - -- On first use, `tests/fetch-fixtures.sh` downloads the required Alpine - packages and the `linux-virt` kernel into `externals/test-fixtures/` and - assembles an initramfs. Subsequent runs are zero-config. -- The same fixture tree is reused across the matrix modes. -- When Rosetta mode is requested and the translator is installed, - `tests/test-matrix.sh` auto-fetches the x86_64 fixture tree - (`INCLUDE_X86_64=1`) on demand. -- QEMU mode requires `qemu-system-aarch64` on `PATH` (Homebrew `qemu` provides it). -- musl is the only Alpine libc; the glibc-dynamic suite is skipped unless - `GUEST_GLIBC_*` environment variables point at an external sysroot. +`qemu-aarch64`, or `elfuse-x86_64`; `all` runs all three back-to-back. ## Rosetta Limitations -`elfuse-x86_64` is expected to inherit two Rosetta-internal limitations that are -not treated as elfuse regressions: +`elfuse-x86_64` inherits two Rosetta-internal limitations not treated +as elfuse regressions: -- `SA_RESETHAND` is not reset reliably because Rosetta shadows guest signal - handler state internally. +- `SA_RESETHAND` is not reset reliably (Rosetta shadows guest signal + handler state internally). - `clone(..., CLONE_SETTLS, tls=0, ...)` can hang. -The x86_64 matrix branch is therefore a Rosetta acceptance gate, not a claim -that translated guests fully match native Linux thread and signal semantics. +The x86_64 matrix branch is a Rosetta acceptance gate, not a claim of +full native Linux thread/signal parity. ## x86_64 Acceptance Inventory and Per-Host Baselines -The `elfuse-x86_64` matrix mode aggregates seven sub-suites. Each one +The `elfuse-x86_64` matrix mode aggregates seven sub-suites. Each emits a deterministic per-binary pass list; the matrix runner sums -those into a single `Results:` line and compares against a per-host -baseline. The exact labels each sub-suite emits, and the contract -they verify, are: - -- `tests/test-rosetta-cli.sh` (4): `rosetta-disabled-flag`, - `rosetta-disabled-env`, `rosetta-gdb`, `rosetta-default` -- - command-line gating of the translator path (opt-out flag, env - override, `--gdb` rejection, install-hint surface). - -- `tests/test-rosetta-failure-modes.sh` (3): `no-rosetta-flag`, - `no-rosetta-env`, `gdb-x86_64` -- command-line rejection paths. - Self-contained against a synthesized minimal x86_64 ELF; no - external fixture tree required. The dynamic-linker bring-up and - mid-process execve scenarios that used to live here are now - exclusively in the glibc and statics suites against the vendored - rootfs (see `glibc-hello` / `glibc-hello-via-ldso` and - `env-execve`). - -- `tests/test-rosetta-statics.sh` (20): `echo`, `true`, `false`, - `printenv`, `expr-zero`, `expr-mul`, `basename`, `dirname`, - `stat-self`, `factor`, `seq`, `sha256sum`, `md5sum`, `uname-m`, `arch`, - `busybox-arch-subcommand`, `date-utc`, `id-u`, `nproc`, - `env-execve` -- statically-linked Alpine busybox applets, - exercising VZ ioctl gate, `/proc/self/exe` redirect, high-VA mmap, - and the kbuf alias. - -- `tests/test-rosetta-alpine.sh` (33): `cat-fruits-first-line`, - `wc-l-fruits`, `wc-l-lines`, `wc-c-lines`, `ls-data`, `stat-data`, - `find-by-name`, `du-sk-data`, `sha256-fruits`, - `sha256-lines-matches-host`, `sha512-lines`, `md5-fruits`, - `cksum-fruits`, `sort-first`, `sort-reverse-first`, `pipe-sort-wc`, - `pipe-tr-uppercase`, `pipe-cat-grep`, `pipe-sed-subst`, - `pipe-awk-field`, `head-n3`, `tail-n3`, `pipe-sort-uniq`, - `pipe-cut-field`, `pipe-rev`, `tac-reverse-first-line`, `seq-1-5`, - `seq-step`, `factor-prime`, `factor-composite`, `diff-identical`, - `diff-differs`, `pipe-base64-decode` -- broader file I/O, text - processing, and host-shell pipelines stitched through Rosetta on - every stage. - -- `tests/test-rosetta-audit.sh` (2): `audit-known-limitations`, - `tls0-known-hang` -- bookkeeping probe that asserts the documented - Rosetta shadowing failures (above) remain the only divergences; - fails loudly if a new threading/signal-state edge case starts - diverging. - -- `tests/test-rosetta-jit.sh` (2): `luajit-trace`, - `luajit-coroutine` -- guest-side JIT under translation - (LuaJIT trace emission + coroutine allocation), covering the - small-mprotect RW->RX and per-thread icache observation path that - rosetta's own JIT does not exercise. - -- `tests/test-rosetta-glibc.sh` (7): `glibc-hello`, - `glibc-hello-via-ldso`, `glibc-hello-list`, `glibc-dlopen`, - `glibc-tls`, `glibc-gdtls`, `glibc-pthread-tls` -- - dynamically-linked glibc x86_64 binary acceptance through - `--sysroot` against the staged minimal glibc rootfs under - `externals/test-fixtures/x86_64-glibc/rootfs/`. The first three - cover load-time `PT_INTERP` resolution and `ld.so --list` - introspection. `glibc-dlopen` runs `dlopen("libm.so.6")` plus a - `dlsym(sqrt)` round-trip to exercise the runtime fresh-`.so`-mmap - codepath, which is distinct from the load-time path the first - three probes touch. `glibc-tls` reads and writes two - initial-exec `__thread` variables (one integer, one pointer) so a - broken FS-register to `TPIDR_EL0` translation surfaces as a - value mismatch rather than as a silent skip. `glibc-gdtls` - `dlopen`s a companion `libgdtls.so` whose `__thread` variable - must use the general-dynamic model (calls `__tls_get_addr`); - this is the only probe that exercises that lowering path, which - the initial-exec probe cannot reach. `glibc-pthread-tls` - `pthread_create`s a worker thread that reads and writes its own - `__thread` slot; the probe asserts the worker saw its own - default value (not the main thread's overwritten marker) and that - the main thread's slot survives the worker's write, so a broken - per-thread `TPIDR_EL0` setup on additional threads surfaces as - isolation failure rather than as a silent crash. +them into one `Results:` line and compares against a per-host +baseline: + +- `tests/test-rosetta-cli.sh` (4) -- command-line gating of the + translator path (opt-out flag, env override, `--gdb` rejection, + install-hint surface). +- `tests/test-rosetta-failure-modes.sh` (3) -- command-line rejection + paths, self-contained against a synthesized minimal x86_64 ELF. +- `tests/test-rosetta-statics.sh` (20) -- statically-linked Alpine + busybox applets, exercising the VZ ioctl gate, `/proc/self/exe` + redirect, high-VA mmap, and the kbuf alias. +- `tests/test-rosetta-alpine.sh` (33) -- broader file I/O, text + processing, and host-shell pipelines through Rosetta. +- `tests/test-rosetta-audit.sh` (2) -- bookkeeping probe asserting the + documented Rosetta shadowing failures (above) remain the only + divergences. +- `tests/test-rosetta-jit.sh` (2) -- guest-side JIT under translation + (LuaJIT trace emission + coroutine allocation). +- `tests/test-rosetta-glibc.sh` (7) -- dynamically-linked glibc x86_64 + binary acceptance through `--sysroot` against the staged minimal + glibc rootfs: load-time `PT_INTERP`/`ld.so` resolution, `dlopen`, + and TLS (initial-exec, general-dynamic, per-thread). Total: 71 expected passes, 0 expected failures. ### Per-Host Baseline Capture The matrix runner keys its `elfuse-x86_64` baseline by detected host -SoC class. Two classes matter because `sys_mmap_fixed_high_va` takes -different paths under different IPA widths: - -- `apple-m1-m2`: 36-bit native IPA, exercises the overflow-segment - path. Captured on this codebase against Apple M1 hardware - (MacBookAir10,1). The seven sub-suites land at 71/0/0. - -- `apple-m3-plus`: 40-bit native IPA, exercises the bisected-slab - path (and the M5 slab-bisection variant). Currently held equal to - `apple-m1-m2` pending operator capture on real M3+ hardware. When - that capture lands, only the - `"elfuse-x86_64:apple-m3-plus||"` row in the - `EXPECTED_BASELINES` array in `tests/test-matrix.sh` moves; the - M1/M2 row stays intact. - -- `apple-unknown`: fallback for SoC brand strings the detector does - not recognise. Inherits the M1/M2 numbers and triggers a one-line - warning so a new SoC does not silently graft onto an existing row. - -Class detection reads `sysctl -n machdep.cpu.brand_string` and matches -against `Apple M1`/`Apple M2` (M1/M2) and `Apple M3`/`Apple M4`/`Apple -M5` (M3+). To exercise the M3+ row from an M1/M2 host (and vice -versa) without changing the detector, set -`MATRIX_HOST_CLASS_OVERRIDE=apple-m3-plus` (or `apple-m1-m2`, -`apple-unknown`) before invoking `tests/test-matrix.sh`. - -When the seven sub-suites grow or trim a test, the per-sub-suite -counts in the comment block above `EXPECTED_BASELINES` and the -inventory list above must move in the same commit so the per-host -baseline stays in sync with reality. Each `EXPECTED_BASELINES` entry -is a pipe-separated `mode-key|min_pass|max_fail` triple parsed by -`expected_baseline_get()` in `tests/test-matrix.sh`. +SoC class, since `sys_mmap_fixed_high_va` takes different paths under +different IPA widths: + +- `apple-m1-m2`: 36-bit native IPA (overflow-segment path). Captured + on Apple M1 hardware; lands at 71/0/0. +- `apple-m3-plus`: 40-bit native IPA (bisected-slab path). Currently + held equal to `apple-m1-m2` pending real M3+ hardware capture. +- `apple-unknown`: fallback for unrecognized SoC strings; inherits the + M1/M2 numbers with a one-line warning. + +Class detection reads `sysctl -n machdep.cpu.brand_string`. Override +with `MATRIX_HOST_CLASS_OVERRIDE=apple-m3-plus` (or `apple-m1-m2`, +`apple-unknown`) to exercise a different row without changing host. + +When the sub-suites change, update the per-suite counts in +`EXPECTED_BASELINES` (`tests/test-matrix.sh`) and the inventory above +in the same commit so the baseline stays in sync. ## Test Inventory diff --git a/mk/analysis.mk b/mk/analysis.mk index 246c948f..d6bbfc03 100644 --- a/mk/analysis.mk +++ b/mk/analysis.mk @@ -8,7 +8,8 @@ CLANG_TIDY ?= clang-tidy # untracked mirrors under dot-directories. C_FORMAT_FILES := $(shell git ls-files --cached --others --exclude-standard \ -- 'src/**/*.[ch]' 'src/*.[ch]' \ - 'tests/*.c' 'tests/*.h') + 'tests/*.c' 'tests/*.h' \ + ':(exclude)tests/bench-corpus/**') SHELL_SCRIPTS := $(shell git ls-files --cached --others --exclude-standard \ -- '*.sh') PYTHON_FORMAT_FILES := $(shell git ls-files --cached --others --exclude-standard \ diff --git a/mk/tests.mk b/mk/tests.mk index 85c3e456..f2a77851 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -678,6 +678,39 @@ test-perf: $(ELFUSE_BIN) $(PERF_DEPS) ## Alias for test-perf perf: test-perf +# Two-tier performance benchmark suite (issue #195): lmbench +# microbenchmarks (cross-compiled from pinned source by +# tests/fetch-fixtures.sh) plus application workloads over the Alpine +# fixture tools, emitting build/bench-results.json for +# scripts/bench-compare.py. `bench` is the dev entry point (missing +# fixtures skip a tier); `bench-ci` makes prerequisites fatal and +# fetches fixtures on demand. BENCH_ENV picks the column +# (elfuse-aarch64 default | qemu-aarch64 | orbstack | native) exactly +# like tests/bench-suite.sh itself -- there is no separate -qemu +# target; the qemu-aarch64 column (same silicon, real Linux kernel via +# HVF) is BENCH_ENV=qemu-aarch64 make bench-ci like any other column. +# A non-default BENCH_ENV writes build/bench-results-$BENCH_ENV.json +# instead of build/bench-results.json so one job can capture more than +# one column without a later run clobbering an earlier one. +.PHONY: bench bench-ci +BENCH_SUITE_DEPS := $(ELFUSE_BIN) +ifndef GUEST_TEST_BINARIES + BENCH_SUITE_DEPS += $(BUILD_DIR)/bench-timeit +endif + +bench_out = $(if $(filter-out elfuse-aarch64,$(BENCH_ENV)),$(BUILD_DIR)/bench-results-$(BENCH_ENV).json,$(BUILD_DIR)/bench-results.json) + +## Run the benchmark suite; writes build/bench-results.json (or +## build/bench-results-$BENCH_ENV.json for a non-default BENCH_ENV) +bench: $(BENCH_SUITE_DEPS) + @ELFUSE="$(ELFUSE_BIN)" BENCH_BIN_DIR="$(TEST_DIR)" \ + bash tests/bench-suite.sh -o $(bench_out) + +## Run the benchmark suite for CI (strict prerequisites) +bench-ci: $(BENCH_SUITE_DEPS) + @ELFUSE="$(ELFUSE_BIN)" BENCH_BIN_DIR="$(TEST_DIR)" BENCH_STRICT=1 \ + bash tests/bench-suite.sh -o $(bench_out) + # Test matrix (elfuse aarch64 + qemu aarch64 + elfuse x86_64/Rosetta) ## Run full test matrix (all modes: elfuse-aarch64, qemu-aarch64, elfuse-x86_64) test-matrix: $(ELFUSE_BIN) $(TEST_DEPS) diff --git a/scripts/bench-compare.py b/scripts/bench-compare.py new file mode 100644 index 00000000..6d6729ec --- /dev/null +++ b/scripts/bench-compare.py @@ -0,0 +1,339 @@ +#!/usr/bin/env python3 +"""Compare bench-suite results against the checked-in baseline. + +Reads build/bench-results.json (tests/bench-suite.sh output) and +tests/bench-baseline.json, prints a per-metric ratio table for the +matching environment column, and exits non-zero when any metric +regresses beyond the threshold (default +20%). The checked-in +qemu-aarch64 column is the same-silicon Linux reference for context. + +Usage: + scripts/bench-compare.py [--results PATH] [--baseline PATH] + [--threshold FRACTION] [--report-only] + [--fail-on-missing] [--report-json PATH] + +Environment: + BENCH_REGRESSION_THRESHOLD overrides --threshold (e.g. 0.20) + BENCH_REPORT_ONLY=1 report regressions but exit 0 +""" + +from __future__ import annotations + +import argparse +import json +import math +import os +import pathlib +import sys + +ROOT = pathlib.Path(__file__).resolve().parent.parent +DEFAULT_RESULTS = ROOT / "build" / "bench-results.json" +DEFAULT_BASELINE = ROOT / "tests" / "bench-baseline.json" + +SECTIONS = ("lmbench", "applications") + + +class BenchDataError(ValueError): + """A benchmark document is valid JSON but has an invalid schema/value.""" + + +def non_negative_finite_fraction(value: str) -> float: + """Parse a regression threshold without allowing it to disable checks.""" + try: + fraction = float(value) + except ValueError as exc: + raise argparse.ArgumentTypeError( + "must be a finite, non-negative fraction") from exc + if not math.isfinite(fraction) or fraction < 0: + raise argparse.ArgumentTypeError( + "must be a finite, non-negative fraction") + return fraction + + +def flatten(tree: dict, *, source: str) -> dict[str, float]: + """Flatten a results/baseline document into {dotted-path: median}. + + Result files store {"median": x, "samples": [...]} leaves; baseline + columns store plain numbers. Both shapes are accepted so a captured + results file can be pasted into the baseline as-is if desired. + """ + if not isinstance(tree, dict): + raise BenchDataError(f"{source} must be an object") + flat: dict[str, float] = {} + + def walk(prefix: str, node) -> None: + if isinstance(node, dict): + if "median" in node: + value = node["median"] + if isinstance(value, bool): + raise BenchDataError( + f"{source}: metric '{prefix}' has a boolean median") + try: + number = float(value) + except (TypeError, ValueError) as exc: + raise BenchDataError( + f"{source}: metric '{prefix}' has a non-numeric " + "median") from exc + if not math.isfinite(number): + raise BenchDataError( + f"{source}: metric '{prefix}' has a non-finite " + "median") + if number < 0: + raise BenchDataError( + f"{source}: metric '{prefix}' has a negative median") + flat[prefix] = number + return + if "status" in node: + return + for key, value in node.items(): + walk(f"{prefix}.{key}" if prefix else key, value) + elif isinstance(node, (int, float)) and not isinstance(node, bool): + number = float(node) + if not math.isfinite(number): + raise BenchDataError( + f"{source}: metric '{prefix}' is non-finite") + if number < 0: + raise BenchDataError( + f"{source}: metric '{prefix}' is negative") + flat[prefix] = number + else: + raise BenchDataError( + f"{source}: metric '{prefix}' must be numeric or an object") + + for section in SECTIONS: + section_tree = tree.get(section, {}) + if not isinstance(section_tree, dict): + raise BenchDataError( + f"{source}: section '{section}' must be an object") + walk(section, section_tree) + return flat + + +def load_json(path: pathlib.Path) -> dict: + try: + document = json.loads(path.read_text(encoding="utf-8")) + except FileNotFoundError: + print(f"bench-compare: missing {path}", file=sys.stderr) + raise SystemExit(2) + except json.JSONDecodeError as exc: + print(f"bench-compare: invalid JSON in {path}: {exc}", + file=sys.stderr) + raise SystemExit(2) + if not isinstance(document, dict): + print(f"bench-compare: invalid JSON in {path}: top-level value " + "must be an object", file=sys.stderr) + raise SystemExit(2) + return document + + +def print_table(rows: list[tuple[str, str, str, str, str]]) -> None: + widths = [max(len(row[col]) for row in rows) for col in range(5)] + for row in rows: + print(" {0:<{w0}} {1:>{w1}} {2:>{w2}} {3:>{w3}} {4}".format( + *row, w0=widths[0], w1=widths[1], w2=widths[2], w3=widths[3])) + + +def write_report(path: pathlib.Path, *, environment: str, threshold: float, + metrics: list[dict[str, str | float]]) -> None: + """Write the data-only artifact consumed by the trusted PR reporter.""" + report = { + "schema_version": 1, + "environment": environment, + "direction": "lower-is-better", + "threshold": threshold, + "metrics": metrics, + } + try: + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text( + json.dumps(report, indent=2, sort_keys=True, allow_nan=False) + + "\n", + encoding="utf-8", + ) + except (OSError, ValueError) as exc: + raise BenchDataError(f"cannot write report {path}: {exc}") from exc + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--results", type=pathlib.Path, + default=DEFAULT_RESULTS) + parser.add_argument("--baseline", type=pathlib.Path, + default=DEFAULT_BASELINE) + parser.add_argument( + "--threshold", type=non_negative_finite_fraction, + default=os.environ.get("BENCH_REGRESSION_THRESHOLD", "0.20"), + help="regression threshold as a fraction (default 0.20 = +20%%)") + parser.add_argument("--report-only", action="store_true", + default=os.environ.get("BENCH_REPORT_ONLY") == "1", + help="print the report but always exit 0") + parser.add_argument("--fail-on-missing", action="store_true", + help="make missing baseline metrics fail even in " + "report-only mode") + parser.add_argument( + "--report-json", type=pathlib.Path, + help="write a data-only comparison report for CI automation") + args = parser.parse_args() + + results = load_json(args.results) + baseline = load_json(args.baseline) + + meta = results.get("meta") + if not isinstance(meta, dict): + print("bench-compare: results meta must be an object", + file=sys.stderr) + return 2 + env = meta.get("env") + if not isinstance(env, str) or not env.strip(): + print("bench-compare: results file has no non-empty meta.env", + file=sys.stderr) + return 2 + env = env.strip() + + environments = baseline.get("environments", {}) + if not isinstance(environments, dict): + print("bench-compare: baseline environments must be an object", + file=sys.stderr) + return 2 + column = environments.get(env) + if not isinstance(column, dict) or not column: + print(f"bench-compare: baseline has no usable '{env}' column; " + "nothing to compare (capture one per the procedure in " + "tests/bench-suite.sh)", file=sys.stderr) + return 1 if args.fail_on_missing else 0 + + try: + current = flatten(results, source="results") + base = flatten(column, source=f"baseline.{env}") + except BenchDataError as exc: + print(f"bench-compare: invalid benchmark data: {exc}", + file=sys.stderr) + return 2 + + regressions: list[str] = [] + missing: list[str] = [] + improvements: list[str] = [] + invalid_baselines: list[str] = [] + comparison_metrics: list[dict[str, str | float]] = [] + rows = [("metric", "baseline", "current", "ratio", "")] + for metric in sorted(base): + if metric not in current: + rows.append((metric, f"{base[metric]:g}", "-", "-", + "MISSING (measurement failed)")) + missing.append(metric) + continue + if base[metric] <= 0: + rows.append((metric, f"{base[metric]:g}", + f"{current[metric]:g}", "-", + "n/a (baseline must be > 0)")) + invalid_baselines.append(metric) + continue + ratio = current[metric] / base[metric] + comparison_metrics.append({ + "metric": metric, + "baseline": base[metric], + "current": current[metric], + }) + verdict = "" + if ratio > 1.0 + args.threshold: + verdict = f"REGRESSION (> +{args.threshold:.0%})" + regressions.append(metric) + elif ratio < 1.0 - args.threshold: + verdict = "improved" + improvements.append(metric) + rows.append((metric, f"{base[metric]:g}", f"{current[metric]:g}", + f"{ratio:.2f}x", verdict)) + for metric in sorted(set(current) - set(base)): + rows.append((metric, "-", f"{current[metric]:g}", "-", + "NEW (no baseline)")) + + captured_columns = baseline.get("captured") or {} + captured = (captured_columns.get(env, {}) + if isinstance(captured_columns, dict) else {}) + if not isinstance(captured, dict): + print(f"bench-compare: baseline captured.{env} must be an object", + file=sys.stderr) + return 2 + print(f"bench-compare: environment '{env}', threshold " + f"+{args.threshold:.0%}") + if captured: + print(f" baseline captured: {captured.get('date', '?')} on " + f"{captured.get('host', '?')}") + print_table(rows) + + if args.report_json is not None: + try: + write_report(args.report_json, environment=env, + threshold=args.threshold, + metrics=comparison_metrics) + except BenchDataError as exc: + print(f"bench-compare: {exc}", file=sys.stderr) + return 2 + + # qemu-aarch64 runs a real Linux kernel on the same Apple Silicon host, + # so it is this project's reference target where native M-series Linux + # is unavailable. This ratio is informational only. + for ref in ("qemu-aarch64",): + if ref == env: + continue + ref_column = environments.get(ref) + if not ref_column: + continue + try: + rbase = flatten(ref_column, source=f"baseline.{ref}") + except BenchDataError as exc: + print(f"bench-compare: invalid benchmark data: {exc}", + file=sys.stderr) + return 2 + shared = sorted(set(rbase) & set(current)) + if not shared: + continue + print(f"\n ratio vs {ref} baseline column (informational):") + rrows = [("metric", ref, env, "ratio", "")] + for metric in shared: + if rbase[metric] <= 0: + rrows.append((metric, f"{rbase[metric]:g}", + f"{current[metric]:g}", "-", + "n/a (non-positive reference)")) + continue + ratio = current[metric] / rbase[metric] + rrows.append((metric, f"{rbase[metric]:g}", + f"{current[metric]:g}", f"{ratio:.2f}x", "")) + print_table(rrows) + + if improvements: + print(f"\nimproved beyond threshold: {', '.join(improvements)}") + print(" (consider refreshing tests/bench-baseline.json so the " + "gain is locked in)") + + if regressions or missing or invalid_baselines: + sys.stdout.flush() + failures = [] + if regressions: + failures.append( + f"{len(regressions)} regression(s): " + f"{', '.join(regressions)}") + if missing: + failures.append( + f"{len(missing)} missing measurement(s): " + f"{', '.join(missing)}") + if invalid_baselines: + failures.append( + f"{len(invalid_baselines)} invalid baseline metric(s): " + f"{', '.join(invalid_baselines)}") + print(f"\nbench-compare: FAIL -- {'; '.join(failures)}", + file=sys.stderr) + if invalid_baselines: + return 2 + if args.report_only and not (args.fail_on_missing and missing): + print("bench-compare: report-only mode, exiting 0", + file=sys.stderr) + return 0 + return 1 + + print("\nbench-compare: PASS") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/bench-promote.py b/scripts/bench-promote.py new file mode 100644 index 00000000..8f030eb6 --- /dev/null +++ b/scripts/bench-promote.py @@ -0,0 +1,264 @@ +#!/usr/bin/env python3 +"""Promote a captured bench-suite results file into the baseline. + +Reads build/bench-results.json (tests/bench-suite.sh output) and merges +its per-metric medians into tests/bench-baseline.json under the +"environments." and "captured." entries for the run's +BENCH_ENV column (taken from the results file's meta.env), then writes +the baseline back in place. + +This is the mechanical half of the baseline refresh procedure in the +header of tests/bench-suite.sh: it does not decide whether an update is +warranted (capture back-to-back runs and confirm they agree within a +few percent first) or commit the result. Run it once per column after +each `make bench-ci` / `BENCH_ENV=... make bench-ci`: + + make bench-ci && scripts/bench-promote.py + BENCH_ENV=qemu-aarch64 make bench-ci && scripts/bench-promote.py \\ + --results build/bench-results-qemu-aarch64.json + BENCH_ENV=orbstack make bench-ci && scripts/bench-promote.py \\ + --results build/bench-results-orbstack.json + +Cases/metrics present in the baseline but absent from the results file +(e.g. an ERR/SKIP row, or a filtered partial run) are left untouched by +default; pass --prune to drop them instead, which is what a full +recapture after removing or renaming cases should use. + +Usage: + scripts/bench-promote.py [--results PATH] [--baseline PATH] + [--prune] [--dry-run] +""" + +from __future__ import annotations + +import argparse +import json +import math +import os +import pathlib +import stat +import sys +import tempfile + +ROOT = pathlib.Path(__file__).resolve().parent.parent +DEFAULT_RESULTS = ROOT / "build" / "bench-results.json" +DEFAULT_BASELINE = ROOT / "tests" / "bench-baseline.json" + +SECTIONS = ("lmbench", "applications") + + +class BenchPromoteError(ValueError): + """A benchmark document has an invalid shape or value.""" + + +def to_baseline_tree(node: dict, prefix: str) -> dict: + """Recursively collapse a results section tree to plain medians + ({name: median} leaves, nested dicts preserved), dropping SKIP/ERR + rows (they carry no number to promote).""" + if not isinstance(node, dict): + raise BenchPromoteError(f"results {prefix} must be an object") + + out: dict = {} + for name, leaf in node.items(): + tag = f"{prefix}.{name}" if prefix else name + if not isinstance(leaf, dict): + raise BenchPromoteError(f"results {tag} must be an object") + if "median" in leaf: + value = leaf["median"] + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise BenchPromoteError( + f"results {tag}.median must be numeric") + if not math.isfinite(float(value)) or value < 0: + raise BenchPromoteError( + f"results {tag}.median must be finite and non-negative") + out[name] = value + elif "status" in leaf: + continue # {"status": "SKIP"|"ERR"} -- nothing to promote. + else: + sub = to_baseline_tree(leaf, tag) + if sub: + out[name] = sub + return out + + +def merge_tree(dest: dict, src: dict, prefix: str, + added: list, updated: list) -> None: + for name, value in src.items(): + tag = f"{prefix}{name}" + if isinstance(value, dict): + if name in dest and not isinstance(dest[name], dict): + raise BenchPromoteError( + f"shape mismatch at {tag}: baseline is scalar, " + "results is an object") + child = dest.setdefault(name, {}) + merge_tree(child, value, f"{tag}.", added, updated) + else: + if name in dest and isinstance(dest[name], dict): + raise BenchPromoteError( + f"shape mismatch at {tag}: baseline is an object, " + "results is scalar") + if name in dest: + if dest[name] != value: + updated.append(tag) + else: + added.append(tag) + dest[name] = value + + +def prune_tree(dest: dict, src: dict, prefix: str, pruned: list) -> None: + for name in list(dest): + tag = f"{prefix}{name}" + if name not in src: + pruned.append(tag) + del dest[name] + elif isinstance(dest[name], dict) and isinstance(src[name], dict): + prune_tree(dest[name], src[name], f"{tag}.", pruned) + + +def missing_leaves(dest: dict, src: dict, prefix: str, + missing: list) -> None: + """Record existing baseline metrics absent from this result capture.""" + for name, value in dest.items(): + tag = f"{prefix}{name}" + if name not in src: + missing.append(tag) + elif isinstance(value, dict) and isinstance(src[name], dict): + missing_leaves(value, src[name], f"{tag}.", missing) + + +def format_host(host: dict) -> str: + if not isinstance(host, dict): + raise BenchPromoteError("results meta.host must be an object") + return (f"{host.get('os', '?')} {host.get('os_version', '?')} " + f"{host.get('machine', '?')} ({host.get('cpu', '?')})") + + +def load_json(path: pathlib.Path) -> dict: + try: + document = json.loads(path.read_text(encoding="utf-8")) + except FileNotFoundError: + print(f"bench-promote: missing {path}", file=sys.stderr) + raise SystemExit(2) + except json.JSONDecodeError as exc: + print(f"bench-promote: invalid JSON in {path}: {exc}", file=sys.stderr) + raise SystemExit(2) + if not isinstance(document, dict): + print(f"bench-promote: invalid JSON in {path}: top-level value " + "must be an object", file=sys.stderr) + raise SystemExit(2) + return document + + +def mapping_entry(parent: dict, name: str, label: str) -> dict: + value = parent.setdefault(name, {}) + if not isinstance(value, dict): + raise BenchPromoteError(f"{label} must be an object") + return value + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--results", type=pathlib.Path, + default=DEFAULT_RESULTS) + parser.add_argument("--baseline", type=pathlib.Path, + default=DEFAULT_BASELINE) + parser.add_argument("--prune", action="store_true", + help="drop baseline cases/metrics absent from " + "--results instead of leaving them untouched") + parser.add_argument("--dry-run", action="store_true", + help="print what would change; don't write " + "--baseline") + args = parser.parse_args() + + results = load_json(args.results) + baseline = load_json(args.baseline) + + try: + meta = results.get("meta") + if not isinstance(meta, dict): + raise BenchPromoteError("results meta must be an object") + env = meta.get("env") + if not isinstance(env, str) or not env.strip(): + raise BenchPromoteError("results file has no non-empty meta.env") + env = env.strip() + + environments = mapping_entry( + baseline, "environments", "baseline environments") + column = mapping_entry( + environments, env, f"baseline environments.{env}") + + added, updated, pruned, missing = [], [], [], [] + for section in SECTIONS: + new_leaves = to_baseline_tree( + results.get(section, {}), section) + dest = mapping_entry( + column, section, + f"baseline environments.{env}.{section}") + prefix = f"{section}." + missing_leaves(dest, new_leaves, prefix, missing) + merge_tree(dest, new_leaves, prefix, added, updated) + if args.prune: + prune_tree(dest, new_leaves, prefix, pruned) + + captured_entry = { + "date": meta.get("date"), + "host": format_host(meta.get("host", {})), + "iterations": meta.get("iterations"), + } + if meta.get("note"): + captured_entry["note"] = meta["note"] + captured = mapping_entry(baseline, "captured", "baseline captured") + if missing and not args.prune: + print(" capture is partial; preserving existing provenance " + f"({len(missing)} baseline metric(s) absent)") + else: + captured[env] = captured_entry + except BenchPromoteError as exc: + print(f"bench-promote: invalid benchmark data: {exc}", + file=sys.stderr) + return 2 + + print(f"bench-promote: environment '{env}' from {args.results}") + print(f" {len(added)} added, {len(updated)} updated, " + f"{len(pruned)} pruned") + for tag in added: + print(f" + {tag}") + for tag in updated: + print(f" ~ {tag}") + for tag in pruned: + print(f" - {tag}") + + if args.dry_run: + print("bench-promote: --dry-run, not writing", file=sys.stderr) + return 0 + + try: + serialized = json.dumps( + baseline, indent=2, sort_keys=True, allow_nan=False) + "\n" + except (TypeError, ValueError) as exc: + print(f"bench-promote: baseline cannot be serialized: {exc}", + file=sys.stderr) + return 2 + + fd, tmp_name = tempfile.mkstemp(prefix=f".{args.baseline.name}.", + suffix=".tmp", dir=args.baseline.parent, + text=True) + try: + os.fchmod(fd, stat.S_IMODE(args.baseline.stat().st_mode)) + with os.fdopen(fd, "w", encoding="utf-8") as tmp: + tmp.write(serialized) + tmp.flush() + os.fsync(tmp.fileno()) + os.replace(tmp_name, args.baseline) + except BaseException: + try: + os.unlink(tmp_name) + except FileNotFoundError: + pass + raise + print(f"bench-promote: wrote {args.baseline}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/bench-report.py b/scripts/bench-report.py new file mode 100644 index 00000000..d32356c2 --- /dev/null +++ b/scripts/bench-report.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python3 +"""Render an advisory PR comment from a bench-compare JSON report. + +The input artifact comes from an unprivileged pull-request workflow. Treat it +strictly as untrusted data: validate its schema and values, recompute every +ratio, escape metric names, and never execute anything from the artifact. + +An empty output means every comparable metric was inside the threshold and the +caller must not create or update a comment. +""" + +from __future__ import annotations + +import argparse +import html +import json +import math +import pathlib +import sys + +MAX_METRICS = 256 +MAX_METRIC_NAME = 160 +MAX_REPORT_BYTES = 64 * 1024 + + +class ReportError(ValueError): + """The report is not safe or usable as benchmark data.""" + + +def unique_object(pairs: list[tuple[str, object]]) -> dict[str, object]: + result: dict[str, object] = {} + for key, value in pairs: + if key in result: + raise ReportError(f"duplicate JSON key: {key!r}") + result[key] = value + return result + + +def reject_json_constant(value: str) -> None: + raise ReportError(f"non-finite JSON value: {value}") + + +def finite_number(value: object, *, field: str) -> float: + if isinstance(value, bool) or not isinstance(value, (int, float)): + raise ReportError(f"{field} must be a number") + number = float(value) + if not math.isfinite(number): + raise ReportError(f"{field} must be finite") + return number + + +def metric_name(value: object) -> str: + if not isinstance(value, str) or not value or len(value) > MAX_METRIC_NAME: + raise ReportError("metric name must be a non-empty short string") + if any(ord(char) < 0x20 or ord(char) == 0x7F for char in value): + raise ReportError(f"metric name contains control characters: {value!r}") + return value + + +def markdown_cell(value: str) -> str: + return (html.escape(value, quote=False).replace("|", "\\|") + .replace("`", "`")) + + +def display_number(value: float) -> str: + return f"{value:.6g}" + + +def load_report( + path: pathlib.Path, *, expected_environment: str +) -> list[tuple[str, float, float]]: + try: + if path.stat().st_size > MAX_REPORT_BYTES: + raise ReportError( + f"report exceeds the {MAX_REPORT_BYTES}-byte limit" + ) + document = json.loads( + path.read_text(encoding="utf-8"), + object_pairs_hook=unique_object, + parse_constant=reject_json_constant, + ) + except FileNotFoundError as exc: + raise ReportError(f"missing report: {path}") from exc + except (OSError, json.JSONDecodeError) as exc: + raise ReportError(f"cannot read report {path}: {exc}") from exc + + if not isinstance(document, dict): + raise ReportError("top-level report must be an object") + schema_version = document.get("schema_version") + if isinstance(schema_version, bool) or schema_version != 1: + raise ReportError("unsupported schema_version") + if document.get("environment") != expected_environment: + raise ReportError( + f"expected environment {expected_environment!r}, got " + f"{document.get('environment')!r}" + ) + if document.get("direction") != "lower-is-better": + raise ReportError("unsupported metric direction") + + metrics = document.get("metrics") + if not isinstance(metrics, list): + raise ReportError("metrics must be an array") + if len(metrics) > MAX_METRICS: + raise ReportError(f"metrics exceeds the {MAX_METRICS}-item limit") + + parsed: list[tuple[str, float, float]] = [] + seen: set[str] = set() + for index, item in enumerate(metrics): + if not isinstance(item, dict): + raise ReportError(f"metrics[{index}] must be an object") + name = metric_name(item.get("metric")) + if name in seen: + raise ReportError(f"duplicate metric: {name}") + seen.add(name) + baseline = finite_number(item.get("baseline"), + field=f"{name}.baseline") + current = finite_number(item.get("current"), + field=f"{name}.current") + if baseline <= 0: + raise ReportError(f"{name}.baseline must be greater than zero") + if current < 0: + raise ReportError(f"{name}.current must be non-negative") + parsed.append((name, baseline, current)) + return sorted(parsed) + + +def section( + title: str, rows: list[tuple[str, float, float, float]] +) -> list[str]: + rendered = [ + f"### {title}", + "", + "| Metric | Baseline | Current | Change |", + "| --- | ---: | ---: | ---: |", + ] + for name, baseline, current, change in rows: + rendered.append( + f"| `{markdown_cell(name)}` | {display_number(baseline)} | " + f"{display_number(current)} | {change:+.1%} |" + ) + return rendered + + +def render( + metrics: list[tuple[str, float, float]], *, threshold: float, + environment: str +) -> str: + regressions: list[tuple[str, float, float, float]] = [] + improvements: list[tuple[str, float, float, float]] = [] + for name, baseline, current in metrics: + change = current / baseline - 1.0 + row = (name, baseline, current, change) + if change > threshold: + regressions.append(row) + elif change < -threshold: + improvements.append(row) + + if not regressions and not improvements: + return "" + + threshold_text = f"{threshold:.0%}" + lines = [ + f"## Benchmark changes outside ยฑ{threshold_text}", + "", + f"Compared `{environment}` with the checked-in baseline. " + "Lower is better.", + ] + if regressions: + lines.extend(["", *section("Regressions", regressions)]) + if improvements: + lines.extend(["", *section("Improvements", improvements)]) + return "\n".join(lines) + "\n" + + +def non_negative_finite_fraction(value: str) -> float: + try: + fraction = float(value) + except ValueError as exc: + raise argparse.ArgumentTypeError( + "must be a finite, non-negative fraction" + ) from exc + if not math.isfinite(fraction) or fraction < 0: + raise argparse.ArgumentTypeError( + "must be a finite, non-negative fraction" + ) + return fraction + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--report", type=pathlib.Path, required=True) + parser.add_argument("--output", type=pathlib.Path, required=True) + parser.add_argument("--environment", default="elfuse-aarch64") + parser.add_argument("--threshold", type=non_negative_finite_fraction, + default=0.20) + args = parser.parse_args() + + try: + metrics = load_report(args.report, + expected_environment=args.environment) + comment = render(metrics, threshold=args.threshold, + environment=args.environment) + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(comment, encoding="utf-8") + except (OSError, ReportError) as exc: + print(f"bench-report: {exc}", file=sys.stderr) + return 2 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/ci-host-lock.sh b/scripts/ci-host-lock.sh new file mode 100755 index 00000000..4cc0c559 --- /dev/null +++ b/scripts/ci-host-lock.sh @@ -0,0 +1,278 @@ +#!/usr/bin/env bash +# ci-host-lock.sh -- machine-wide reader-writer lock for the self-hosted +# CI host. +# +# Normal runtime legs hold a shared lock while they may load the host. The +# benchmark leg acquires the exclusive lock immediately around make bench-ci, +# keeping only the measurement window isolated. A detached holder owns flock; +# release talks to that exact holder over a job-scoped Unix socket rather than +# signaling a possibly recycled PID. +# +# Environment: +# CI_HOST_LOCK_FILE machine-global lock file +# (default /tmp/elfuse-ci-host.lock) +# CI_HOST_LOCK_PID_FILE job-scoped holder state file +# (default $RUNNER_TEMP/elfuse-ci-host-lock.pid) +# CI_HOST_LOCK_CONTROL_FILE job-scoped holder control socket +# (default $CI_HOST_LOCK_PID_FILE.sock) +# CI_HOST_LOCK_WAIT_MIN acquisition timeout in minutes (default 60) +# CI_HOST_LOCK_MAX_HOLD_MIN holder self-expiry in minutes (default 120) +# +# SPDX-License-Identifier: Apache-2.0 + +set -euo pipefail + +LOCK_FILE="${CI_HOST_LOCK_FILE:-/tmp/elfuse-ci-host.lock}" +PID_FILE="${CI_HOST_LOCK_PID_FILE:-${RUNNER_TEMP:-/tmp}/elfuse-ci-host-lock.pid}" +CONTROL_FILE="${CI_HOST_LOCK_CONTROL_FILE:-${PID_FILE}.sock}" +WAIT_MIN="${CI_HOST_LOCK_WAIT_MIN:-60}" +MAX_HOLD_MIN="${CI_HOST_LOCK_MAX_HOLD_MIN:-120}" + +usage() +{ + echo "usage: $0 acquire shared|exclusive | release" >&2 + exit 2 +} + +case "${1:-}" in + acquire) + case "${2:-}" in shared | exclusive) ;; *) usage ;; esac + exec python3 - "$LOCK_FILE" "${2}" "$PID_FILE" "$CONTROL_FILE" \ + "$WAIT_MIN" "$MAX_HOLD_MIN" << 'PY' +import fcntl +import os +import select +import signal +import socket +import sys +import time +import uuid + +lock_path, mode, pid_path, control_path, wait_min, hold_min = sys.argv[1:7] +wait_seconds = float(wait_min) * 60 +hold_seconds = float(hold_min) * 60 +if wait_seconds <= 0 or hold_seconds <= 0: + sys.exit("ci-host-lock: wait and maximum hold must be positive") + +flags = fcntl.LOCK_EX if mode == "exclusive" else fcntl.LOCK_SH +writers_dir = f"{lock_path}.writers" + + +def writer_pending(): + """Return true while any live exclusive waiter has published intent.""" + os.makedirs(writers_dir, mode=0o777, exist_ok=True) + pending = False + for name in os.listdir(writers_dir): + if name.startswith("."): + continue + path = os.path.join(writers_dir, name) + try: + fd = os.open(path, os.O_RDWR) + except FileNotFoundError: + continue + try: + try: + fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) + except BlockingIOError: + pending = True + else: + # The publishing process died before removing its marker. + try: + os.unlink(path) + except FileNotFoundError: + pass + finally: + os.close(fd) + return pending + + +def publish_writer(): + """Publish a pre-locked marker atomically so readers cannot miss it.""" + os.makedirs(writers_dir, mode=0o777, exist_ok=True) + token = f"{os.getpid()}-{uuid.uuid4().hex}" + tmp_path = os.path.join(writers_dir, f".{token}.tmp") + marker_path = os.path.join(writers_dir, token) + fd = os.open(tmp_path, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o600) + fcntl.flock(fd, fcntl.LOCK_EX) + os.rename(tmp_path, marker_path) + return fd, marker_path + + +r, w = os.pipe() +child = os.fork() +if child == 0: + os.close(r) + os.setsid() + + # A detached descendant retaining the runner's stdout/stderr keeps the + # Actions step pipe open even after the acquire parent exits. + devnull = os.open(os.devnull, os.O_RDWR) + for target in (0, 1, 2): + os.dup2(devnull, target) + if devnull > 2: + os.close(devnull) + + lock_fd = -1 + marker_fd = -1 + marker_path = None + listener = None + try: + control_parent = os.path.dirname(control_path) + if control_parent: + os.makedirs(control_parent, exist_ok=True) + try: + os.unlink(control_path) + except FileNotFoundError: + pass + listener = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + listener.bind(control_path) + os.chmod(control_path, 0o600) + listener.listen(2) + + lock_fd = os.open(lock_path, os.O_RDWR | os.O_CREAT, 0o666) + if mode == "exclusive": + marker_fd, marker_path = publish_writer() + fcntl.flock(lock_fd, fcntl.LOCK_EX) + os.unlink(marker_path) + marker_path = None + os.close(marker_fd) + marker_fd = -1 + else: + # Check the writer-intent directory both before and after the + # non-blocking shared flock. This closes the publication race and + # prevents a stream of new readers from starving an exclusive job. + while True: + while writer_pending(): + time.sleep(0.1) + try: + fcntl.flock(lock_fd, fcntl.LOCK_SH | fcntl.LOCK_NB) + except BlockingIOError: + time.sleep(0.1) + continue + if not writer_pending(): + break + fcntl.flock(lock_fd, fcntl.LOCK_UN) + time.sleep(0.1) + + os.write(w, b"1") + os.close(w) + w = -1 + + deadline = time.monotonic() + hold_seconds + released = False + while not released: + remaining = deadline - time.monotonic() + if remaining <= 0: + break + listener.settimeout(remaining) + try: + conn, _ = listener.accept() + except socket.timeout: + break + with conn: + conn.settimeout(2) + try: + request = conn.recv(16) + except socket.timeout: + continue + if request == b"probe": + conn.sendall(b"live") + continue + if request != b"release": + continue + fcntl.flock(lock_fd, fcntl.LOCK_UN) + os.close(lock_fd) + lock_fd = -1 + conn.sendall(b"released") + released = True + finally: + if w >= 0: + os.close(w) + if lock_fd >= 0: + os.close(lock_fd) + if marker_path is not None: + try: + os.unlink(marker_path) + except FileNotFoundError: + pass + if marker_fd >= 0: + os.close(marker_fd) + if listener is not None: + listener.close() + try: + os.unlink(control_path) + except FileNotFoundError: + pass + os._exit(0) + +os.close(w) +start = time.monotonic() +granted, _, _ = select.select([r], [], [], wait_seconds) +ready = os.read(r, 1) if granted else b"" +os.close(r) +if ready == b"1": + pid_parent = os.path.dirname(pid_path) + if pid_parent: + os.makedirs(pid_parent, exist_ok=True) + tmp_path = f"{pid_path}.{os.getpid()}.tmp" + with open(tmp_path, "w", encoding="ascii") as state: + state.write(f"{child}\n") + os.replace(tmp_path, pid_path) + print(f"ci-host-lock: {mode} lock acquired (holder pid {child}, " + f"waited {time.monotonic() - start:.0f}s)") + sys.exit(0) + +try: + os.killpg(child, signal.SIGKILL) +except (ProcessLookupError, PermissionError): + try: + os.kill(child, signal.SIGKILL) + except ProcessLookupError: + pass +try: + os.waitpid(child, 0) +except ChildProcessError: + pass +try: + os.unlink(control_path) +except FileNotFoundError: + pass +sys.exit(f"ci-host-lock: {mode} lock on {lock_path} not acquired within " + f"{wait_min} min (holder died or a sibling job is wedged; " + f"inspect with: lsof {lock_path})") +PY + ;; + release) + python3 - "$PID_FILE" "$CONTROL_FILE" << 'PY' +import os +import socket +import sys + +pid_path, control_path = sys.argv[1:3] +released = False +try: + client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + client.settimeout(5) + client.connect(control_path) + client.sendall(b"release") + released = client.recv(16) == b"released" + client.close() +except (FileNotFoundError, ConnectionError, socket.timeout): + pass + +for path in (pid_path, control_path): + try: + os.unlink(path) + except FileNotFoundError: + pass + +if released: + print("ci-host-lock: released") +else: + print("ci-host-lock: no live holder recorded (nothing to release)") +PY + ;; + *) + usage + ;; +esac diff --git a/tests/bench-baseline.json b/tests/bench-baseline.json new file mode 100644 index 00000000..dcde1188 --- /dev/null +++ b/tests/bench-baseline.json @@ -0,0 +1,114 @@ +{ + "schema": 1, + "comment": "Per-environment baseline medians for scripts/bench-compare.py. Refresh procedure: header of tests/bench-suite.sh. CI measures and gates only elfuse-aarch64. qemu-aarch64 is the same-Apple-Silicon Linux comparison target; orbstack is informational. Both static columns are captured manually and do not change with elfuse patches. A metric absent from a column reports NEW and does not gate until promoted.", + "tooling": { + "lmbench": { + "repository": "https://github.com/intel/lmbench", + "commit": "a33716428dc2e717ce3e7dfce767302583eb8fdc", + "source_sha256": "7769d4758dcbdfb54b443b2e44d65bd0b6c47d49efa87380d83fd12d5ad36f76" + } + }, + "captured": { + "elfuse-aarch64": { + "date": "2026-07-16T17:00:27Z", + "host": "Darwin 24.4.0 arm64 (Apple M4)", + "iterations": 10, + "note": "Tier-2 samples are timed in-guest by bench-timeit (workload only); startup_ms is the per-command VM + sysroot setup + static ELF-load cost" + }, + "qemu-aarch64": { + "date": "2026-07-16T16:40:52Z", + "host": "Darwin 24.4.0 arm64 (Apple M4)", + "iterations": 10, + "note": "qemu guest root is tmpfs (initramfs): lat_fs and write-heavy application metrics measure tmpfs, not a disk filesystem; Tier-2 samples timed in-guest by bench-timeit (workload only); startup_ms is the per-command ssh entry cost" + }, + "orbstack": { + "date": "2026-07-16T17:20:09Z", + "host": "Darwin 24.4.0 arm64 (Apple M4)", + "iterations": 10, + "note": "workloads run on the OrbStack machine's own filesystem (machine-local /tmp), timed in-machine by bench-timeit (workload only); startup_ms is the orb run session cost" + } + }, + "environments": { + "elfuse-aarch64": { + "applications": { + "git_status_ms": 113.327, + "make_ms": 5850.394, + "python_startup_ms": 117.826, + "ripgrep_ms": 2870.226, + "startup_ms": 20.094, + "zstd_ms": 112.975 + }, + "lmbench": { + "lat_syscall": { + "null": 0.0232, + "read": 1.72295, + "write": 1.7114, + "stat": 2.5146, + "open": 11.3016 + }, + "lat_proc": { + "fork": 116097.05, + "exec": 112392.15 + }, + "lat_fs": { + "create": 51.92, + "delete": 40.295 + } + } + }, + "orbstack": { + "applications": { + "git_status_ms": 0.895, + "make_ms": 21.649, + "python_startup_ms": 4.278, + "ripgrep_ms": 30.139, + "startup_ms": 16.952, + "zstd_ms": 15.444 + }, + "lmbench": { + "lat_syscall": { + "null": 0.07225, + "read": 0.093, + "write": 0.0898, + "stat": 0.1542, + "open": 0.29625 + }, + "lat_proc": { + "fork": 36.98875, + "exec": 46.6929 + }, + "lat_fs": { + "create": 1.7155, + "delete": 0.807 + } + } + }, + "qemu-aarch64": { + "applications": { + "git_status_ms": 1.185, + "make_ms": 28.076, + "python_startup_ms": 5.87, + "ripgrep_ms": 48.901, + "startup_ms": 16.104, + "zstd_ms": 12.581 + }, + "lmbench": { + "lat_syscall": { + "null": 0.1452, + "read": 0.1814, + "write": 0.17975, + "stat": 0.3841, + "open": 0.63405 + }, + "lat_proc": { + "fork": 60.50535, + "exec": 72.82645 + }, + "lat_fs": { + "create": 1.414, + "delete": 0.7085 + } + } + } + } +} diff --git a/tests/bench-corpus/Makefile b/tests/bench-corpus/Makefile new file mode 100644 index 00000000..a29d3b04 --- /dev/null +++ b/tests/bench-corpus/Makefile @@ -0,0 +1,29 @@ +# bench-corpus build graph for the `make` application benchmark. +# Every rule uses only busybox/coreutils tools present in the +# Alpine fixture rootfs; see README.md. OUT must point at a +# writable scratch directory outside the source tree. +OUT ?= out + +OBJS := $(OUT)/core_mod_00.obj $(OUT)/core_mod_01.obj $(OUT)/core_mod_02.obj $(OUT)/core_mod_03.obj $(OUT)/core_mod_04.obj $(OUT)/core_mod_05.obj $(OUT)/core_mod_06.obj $(OUT)/core_mod_07.obj $(OUT)/core_mod_08.obj $(OUT)/core_mod_09.obj $(OUT)/core_mod_10.obj $(OUT)/core_mod_11.obj $(OUT)/core_mod_12.obj $(OUT)/core_mod_13.obj $(OUT)/core_mod_14.obj $(OUT)/core_mod_15.obj $(OUT)/fs_mod_00.obj $(OUT)/fs_mod_01.obj $(OUT)/fs_mod_02.obj $(OUT)/fs_mod_03.obj $(OUT)/fs_mod_04.obj $(OUT)/fs_mod_05.obj $(OUT)/fs_mod_06.obj $(OUT)/fs_mod_07.obj $(OUT)/fs_mod_08.obj $(OUT)/fs_mod_09.obj $(OUT)/fs_mod_10.obj $(OUT)/fs_mod_11.obj $(OUT)/fs_mod_12.obj $(OUT)/fs_mod_13.obj $(OUT)/fs_mod_14.obj $(OUT)/fs_mod_15.obj $(OUT)/net_mod_00.obj $(OUT)/net_mod_01.obj $(OUT)/net_mod_02.obj $(OUT)/net_mod_03.obj $(OUT)/net_mod_04.obj $(OUT)/net_mod_05.obj $(OUT)/net_mod_06.obj $(OUT)/net_mod_07.obj $(OUT)/net_mod_08.obj $(OUT)/net_mod_09.obj $(OUT)/net_mod_10.obj $(OUT)/net_mod_11.obj $(OUT)/net_mod_12.obj $(OUT)/net_mod_13.obj $(OUT)/net_mod_14.obj $(OUT)/net_mod_15.obj + +all: $(OUT)/app.bin + +$(OUT): + mkdir -p $(OUT) + +$(OUT)/core_mod_%.obj: core/mod_%.c runtime.h | $(OUT) + sed 's/syscall_entry_/obj_entry_/' $< > $@ + +$(OUT)/fs_mod_%.obj: fs/mod_%.c runtime.h | $(OUT) + sed 's/syscall_entry_/obj_entry_/' $< > $@ + +$(OUT)/net_mod_%.obj: net/mod_%.c runtime.h | $(OUT) + sed 's/syscall_entry_/obj_entry_/' $< > $@ + +$(OUT)/app.bin: $(OBJS) + cat $(OBJS) > $@ + +clean: + rm -rf $(OUT) + +.PHONY: all clean diff --git a/tests/bench-corpus/README.md b/tests/bench-corpus/README.md new file mode 100644 index 00000000..fb2a7700 --- /dev/null +++ b/tests/bench-corpus/README.md @@ -0,0 +1,16 @@ +# bench-corpus + +Fixed synthetic source tree consumed by `tests/bench-suite.sh` for the +Tier-2 application benchmarks: + +- `git status` walks it as a freshly committed repository, +- `rg` searches it for `syscall_entry_` definitions, +- `make` runs its `Makefile` (BusyBox-only rules, no compiler), +- `zstd` compresses a concatenation of its files. + +The content is deterministic output of a one-shot generator and is part +of the benchmark definition: editing, reformatting, or regenerating it +changes every measurement and invalidates `tests/bench-baseline.json`. +Do not modify these files; if the corpus ever must change, regenerate +the baseline in the same change (see the header of +`tests/bench-suite.sh` for the refresh procedure). diff --git a/tests/bench-corpus/core/mod_00.c b/tests/bench-corpus/core/mod_00.c new file mode 100644 index 00000000..307b9c20 --- /dev/null +++ b/tests/bench-corpus/core/mod_00.c @@ -0,0 +1,84 @@ +/* bench-corpus module core/00 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core00_0(struct request *req) +{ + unsigned long extent_0 = req->args[3] ^ 11441UL; + unsigned long packet_1 = req->args[1] ^ 44178UL; + if (req->opcode != 190) + return -EINVAL; + req->state += flags_0 * 1; + trace_event("vector", req->state); + return (long) (req->state & 0x2cefed22); +} + +static long syscall_entry_core00_1(struct request *req) +{ + unsigned long nonce_0 = req->args[3] ^ 865UL; + unsigned long packet_1 = req->args[2] ^ 8619UL; + unsigned long nonce_2 = req->args[5] ^ 31432UL; + if (req->opcode != 57) + return -EINVAL; + req->state += window_0 * 7; + req->state += bitmap_1 * 16; + trace_event("extent", req->state); + return (long) (req->state & 0x294d4f6e); +} + +static long syscall_entry_core00_2(struct request *req) +{ + unsigned long inode_0 = req->args[3] ^ 29278UL; + unsigned long inode_1 = req->args[4] ^ 21588UL; + if (req->opcode != 15) + return -EINVAL; + req->state += cursor_0 * 18; + trace_event("packet", req->state); + return (long) (req->state & 0x15973ce0); +} + +static long syscall_entry_core00_3(struct request *req) +{ + unsigned long extent_0 = req->args[2] ^ 36022UL; + unsigned long queue_1 = req->args[2] ^ 43873UL; + unsigned long inode_2 = req->args[4] ^ 56555UL; + if (req->opcode != 2) + return -EINVAL; + req->state += nonce_0 * 4; + req->state += nonce_1 * 2; + trace_event("inode", req->state); + return (long) (req->state & 0x25841754); +} + +static long syscall_entry_core00_4(struct request *req) +{ + unsigned long bitmap_0 = req->args[0] ^ 40091UL; + unsigned long kernel_1 = req->args[0] ^ 61553UL; + unsigned long buffer_2 = req->args[5] ^ 15790UL; + unsigned long cache_3 = req->args[0] ^ 33616UL; + if (req->opcode != 1) + return -EINVAL; + req->state += mapper_0 * 5; + req->state += handle_1 * 4; + req->state += token_2 * 11; + trace_event("buffer", req->state); + return (long) (req->state & 0x6908c92a); +} + +static long syscall_entry_core00_5(struct request *req) +{ + unsigned long kernel_0 = req->args[1] ^ 11547UL; + unsigned long inode_1 = req->args[1] ^ 23894UL; + if (req->opcode != 139) + return -EINVAL; + req->state += epoch_0 * 3; + trace_event("packet", req->state); + return (long) (req->state & 0x8101788); +} + +const struct module_ops core_00_ops = { + .name = "core-00", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/core/mod_01.c b/tests/bench-corpus/core/mod_01.c new file mode 100644 index 00000000..c0274d7c --- /dev/null +++ b/tests/bench-corpus/core/mod_01.c @@ -0,0 +1,84 @@ +/* bench-corpus module core/01 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core01_0(struct request *req) +{ + unsigned long handle_0 = req->args[5] ^ 7573UL; + unsigned long bitmap_1 = req->args[0] ^ 21985UL; + if (req->opcode != 199) + return -EINVAL; + req->state += cursor_0 * 31; + trace_event("handle", req->state); + return (long) (req->state & 0x2fdc5494); +} + +static long syscall_entry_core01_1(struct request *req) +{ + unsigned long vector_0 = req->args[4] ^ 9371UL; + unsigned long table_1 = req->args[2] ^ 6936UL; + unsigned long nonce_2 = req->args[4] ^ 29864UL; + if (req->opcode != 241) + return -EINVAL; + req->state += latch_0 * 5; + req->state += bitmap_1 * 2; + trace_event("region", req->state); + return (long) (req->state & 0x67f69ada); +} + +static long syscall_entry_core01_2(struct request *req) +{ + unsigned long sector_0 = req->args[3] ^ 9211UL; + unsigned long latch_1 = req->args[0] ^ 47368UL; + if (req->opcode != 78) + return -EINVAL; + req->state += dentry_0 * 23; + trace_event("offset", req->state); + return (long) (req->state & 0x186882e4); +} + +static long syscall_entry_core01_3(struct request *req) +{ + unsigned long buffer_0 = req->args[3] ^ 58115UL; + unsigned long table_1 = req->args[3] ^ 53922UL; + unsigned long sector_2 = req->args[2] ^ 15898UL; + if (req->opcode != 159) + return -EINVAL; + req->state += nonce_0 * 3; + req->state += window_1 * 24; + trace_event("latch", req->state); + return (long) (req->state & 0x533937dd); +} + +static long syscall_entry_core01_4(struct request *req) +{ + unsigned long slab_0 = req->args[1] ^ 7109UL; + unsigned long dentry_1 = req->args[5] ^ 13543UL; + unsigned long cursor_2 = req->args[5] ^ 27147UL; + if (req->opcode != 119) + return -EINVAL; + req->state += sector_0 * 28; + req->state += packet_1 * 20; + trace_event("quota", req->state); + return (long) (req->state & 0x4d91c2ee); +} + +static long syscall_entry_core01_5(struct request *req) +{ + unsigned long guard_0 = req->args[1] ^ 20816UL; + unsigned long buffer_1 = req->args[4] ^ 37505UL; + unsigned long sector_2 = req->args[2] ^ 25823UL; + if (req->opcode != 167) + return -EINVAL; + req->state += dentry_0 * 14; + req->state += packet_1 * 10; + trace_event("journal", req->state); + return (long) (req->state & 0x3fe6dbdd); +} + +const struct module_ops core_01_ops = { + .name = "core-01", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/core/mod_02.c b/tests/bench-corpus/core/mod_02.c new file mode 100644 index 00000000..8abd94cf --- /dev/null +++ b/tests/bench-corpus/core/mod_02.c @@ -0,0 +1,94 @@ +/* bench-corpus module core/02 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core02_0(struct request *req) +{ + unsigned long handle_0 = req->args[5] ^ 54015UL; + unsigned long quota_1 = req->args[0] ^ 40454UL; + unsigned long kernel_2 = req->args[5] ^ 56552UL; + if (req->opcode != 231) + return -EINVAL; + req->state += slab_0 * 25; + req->state += bitmap_1 * 19; + trace_event("mapper", req->state); + return (long) (req->state & 0x1479661f); +} + +static long syscall_entry_core02_1(struct request *req) +{ + unsigned long epoch_0 = req->args[2] ^ 18794UL; + unsigned long inode_1 = req->args[1] ^ 37134UL; + unsigned long latch_2 = req->args[2] ^ 6132UL; + unsigned long vector_3 = req->args[2] ^ 14071UL; + if (req->opcode != 216) + return -EINVAL; + req->state += window_0 * 13; + req->state += offset_1 * 23; + req->state += kernel_2 * 30; + trace_event("kernel", req->state); + return (long) (req->state & 0x530283d9); +} + +static long syscall_entry_core02_2(struct request *req) +{ + unsigned long epoch_0 = req->args[0] ^ 21328UL; + unsigned long queue_1 = req->args[5] ^ 4372UL; + unsigned long region_2 = req->args[4] ^ 61566UL; + unsigned long latch_3 = req->args[1] ^ 47386UL; + if (req->opcode != 225) + return -EINVAL; + req->state += extent_0 * 30; + req->state += cursor_1 * 28; + req->state += window_2 * 13; + trace_event("handle", req->state); + return (long) (req->state & 0x28abde8a); +} + +static long syscall_entry_core02_3(struct request *req) +{ + unsigned long flags_0 = req->args[1] ^ 57195UL; + unsigned long quota_1 = req->args[4] ^ 34990UL; + if (req->opcode != 199) + return -EINVAL; + req->state += dentry_0 * 31; + trace_event("packet", req->state); + return (long) (req->state & 0x51609a1d); +} + +static long syscall_entry_core02_4(struct request *req) +{ + unsigned long mapper_0 = req->args[2] ^ 22112UL; + unsigned long queue_1 = req->args[3] ^ 55863UL; + unsigned long queue_2 = req->args[5] ^ 65481UL; + unsigned long vector_3 = req->args[2] ^ 35589UL; + if (req->opcode != 88) + return -EINVAL; + req->state += sector_0 * 26; + req->state += dentry_1 * 12; + req->state += packet_2 * 31; + trace_event("flags", req->state); + return (long) (req->state & 0x5ad2c229); +} + +static long syscall_entry_core02_5(struct request *req) +{ + unsigned long dentry_0 = req->args[0] ^ 61491UL; + unsigned long cache_1 = req->args[4] ^ 19041UL; + unsigned long latch_2 = req->args[0] ^ 10429UL; + unsigned long vector_3 = req->args[0] ^ 30701UL; + if (req->opcode != 187) + return -EINVAL; + req->state += handle_0 * 8; + req->state += extent_1 * 7; + req->state += queue_2 * 16; + trace_event("buffer", req->state); + return (long) (req->state & 0x5f14f12d); +} + +const struct module_ops core_02_ops = { + .name = "core-02", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/core/mod_03.c b/tests/bench-corpus/core/mod_03.c new file mode 100644 index 00000000..4c15c42c --- /dev/null +++ b/tests/bench-corpus/core/mod_03.c @@ -0,0 +1,144 @@ +/* bench-corpus module core/03 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core03_0(struct request *req) +{ + unsigned long nonce_0 = req->args[0] ^ 36572UL; + unsigned long inode_1 = req->args[5] ^ 19915UL; + unsigned long packet_2 = req->args[5] ^ 24364UL; + unsigned long window_3 = req->args[1] ^ 56707UL; + if (req->opcode != 62) + return -EINVAL; + req->state += slab_0 * 6; + req->state += bitmap_1 * 27; + req->state += guard_2 * 2; + trace_event("cursor", req->state); + return (long) (req->state & 0x5a55a1be); +} + +static long syscall_entry_core03_1(struct request *req) +{ + unsigned long vector_0 = req->args[5] ^ 41364UL; + unsigned long dentry_1 = req->args[3] ^ 20132UL; + unsigned long kernel_2 = req->args[5] ^ 64523UL; + if (req->opcode != 72) + return -EINVAL; + req->state += bitmap_0 * 11; + req->state += sector_1 * 27; + trace_event("sector", req->state); + return (long) (req->state & 0x4f9ce73e); +} + +static long syscall_entry_core03_2(struct request *req) +{ + unsigned long slab_0 = req->args[4] ^ 33435UL; + unsigned long buffer_1 = req->args[4] ^ 21300UL; + unsigned long shard_2 = req->args[0] ^ 50971UL; + unsigned long bitmap_3 = req->args[4] ^ 56195UL; + if (req->opcode != 211) + return -EINVAL; + req->state += mapper_0 * 15; + req->state += table_1 * 18; + req->state += handle_2 * 28; + trace_event("window", req->state); + return (long) (req->state & 0x67ffed18); +} + +static long syscall_entry_core03_3(struct request *req) +{ + unsigned long slab_0 = req->args[0] ^ 39493UL; + unsigned long journal_1 = req->args[1] ^ 34330UL; + if (req->opcode != 9) + return -EINVAL; + req->state += journal_0 * 15; + trace_event("sector", req->state); + return (long) (req->state & 0x5c8df4ac); +} + +static long syscall_entry_core03_4(struct request *req) +{ + unsigned long region_0 = req->args[0] ^ 10938UL; + unsigned long handle_1 = req->args[0] ^ 32735UL; + unsigned long vector_2 = req->args[1] ^ 46812UL; + if (req->opcode != 196) + return -EINVAL; + req->state += epoch_0 * 15; + req->state += table_1 * 29; + trace_event("window", req->state); + return (long) (req->state & 0x13b7073f); +} + +static long syscall_entry_core03_5(struct request *req) +{ + unsigned long dentry_0 = req->args[4] ^ 47766UL; + unsigned long region_1 = req->args[5] ^ 22799UL; + unsigned long vector_2 = req->args[5] ^ 30995UL; + unsigned long window_3 = req->args[0] ^ 45518UL; + if (req->opcode != 64) + return -EINVAL; + req->state += handle_0 * 14; + req->state += queue_1 * 6; + req->state += packet_2 * 6; + trace_event("latch", req->state); + return (long) (req->state & 0x5b3d99ae); +} + +static long syscall_entry_core03_6(struct request *req) +{ + unsigned long sector_0 = req->args[2] ^ 15726UL; + unsigned long sector_1 = req->args[1] ^ 15539UL; + unsigned long vector_2 = req->args[1] ^ 58937UL; + if (req->opcode != 132) + return -EINVAL; + req->state += token_0 * 16; + req->state += packet_1 * 18; + trace_event("packet", req->state); + return (long) (req->state & 0x73896200); +} + +static long syscall_entry_core03_7(struct request *req) +{ + unsigned long inode_0 = req->args[1] ^ 32589UL; + unsigned long cache_1 = req->args[1] ^ 51085UL; + if (req->opcode != 82) + return -EINVAL; + req->state += slab_0 * 13; + trace_event("guard", req->state); + return (long) (req->state & 0x21fefa9b); +} + +static long syscall_entry_core03_8(struct request *req) +{ + unsigned long bitmap_0 = req->args[5] ^ 9967UL; + unsigned long vector_1 = req->args[4] ^ 51403UL; + unsigned long latch_2 = req->args[1] ^ 44027UL; + unsigned long mapper_3 = req->args[2] ^ 24491UL; + if (req->opcode != 234) + return -EINVAL; + req->state += region_0 * 20; + req->state += packet_1 * 22; + req->state += latch_2 * 22; + trace_event("dentry", req->state); + return (long) (req->state & 0x629d5335); +} + +static long syscall_entry_core03_9(struct request *req) +{ + unsigned long guard_0 = req->args[5] ^ 23972UL; + unsigned long mapper_1 = req->args[4] ^ 39050UL; + unsigned long inode_2 = req->args[5] ^ 2296UL; + if (req->opcode != 102) + return -EINVAL; + req->state += bitmap_0 * 28; + req->state += bitmap_1 * 30; + trace_event("cursor", req->state); + return (long) (req->state & 0x595967a); +} + +const struct module_ops core_03_ops = { + .name = "core-03", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/core/mod_04.c b/tests/bench-corpus/core/mod_04.c new file mode 100644 index 00000000..3355e188 --- /dev/null +++ b/tests/bench-corpus/core/mod_04.c @@ -0,0 +1,121 @@ +/* bench-corpus module core/04 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core04_0(struct request *req) +{ + unsigned long sector_0 = req->args[1] ^ 34457UL; + unsigned long extent_1 = req->args[1] ^ 39957UL; + unsigned long token_2 = req->args[2] ^ 34648UL; + if (req->opcode != 231) + return -EINVAL; + req->state += latch_0 * 13; + req->state += packet_1 * 16; + trace_event("epoch", req->state); + return (long) (req->state & 0x6e65d426); +} + +static long syscall_entry_core04_1(struct request *req) +{ + unsigned long queue_0 = req->args[1] ^ 3428UL; + unsigned long window_1 = req->args[3] ^ 56148UL; + if (req->opcode != 155) + return -EINVAL; + req->state += vector_0 * 7; + trace_event("flags", req->state); + return (long) (req->state & 0x2d31ec20); +} + +static long syscall_entry_core04_2(struct request *req) +{ + unsigned long queue_0 = req->args[2] ^ 60353UL; + unsigned long table_1 = req->args[0] ^ 51555UL; + if (req->opcode != 120) + return -EINVAL; + req->state += epoch_0 * 4; + trace_event("mapper", req->state); + return (long) (req->state & 0x75235e12); +} + +static long syscall_entry_core04_3(struct request *req) +{ + unsigned long latch_0 = req->args[2] ^ 48093UL; + unsigned long shard_1 = req->args[1] ^ 39082UL; + if (req->opcode != 78) + return -EINVAL; + req->state += flags_0 * 16; + trace_event("latch", req->state); + return (long) (req->state & 0x24f4b911); +} + +static long syscall_entry_core04_4(struct request *req) +{ + unsigned long latch_0 = req->args[4] ^ 40571UL; + unsigned long queue_1 = req->args[1] ^ 2817UL; + unsigned long cache_2 = req->args[4] ^ 39866UL; + unsigned long kernel_3 = req->args[1] ^ 4092UL; + if (req->opcode != 175) + return -EINVAL; + req->state += offset_0 * 2; + req->state += extent_1 * 30; + req->state += guard_2 * 24; + trace_event("inode", req->state); + return (long) (req->state & 0x585ae05f); +} + +static long syscall_entry_core04_5(struct request *req) +{ + unsigned long token_0 = req->args[3] ^ 986UL; + unsigned long packet_1 = req->args[1] ^ 58843UL; + unsigned long slab_2 = req->args[0] ^ 63382UL; + if (req->opcode != 5) + return -EINVAL; + req->state += buffer_0 * 31; + req->state += offset_1 * 24; + trace_event("buffer", req->state); + return (long) (req->state & 0x33f545f8); +} + +static long syscall_entry_core04_6(struct request *req) +{ + unsigned long offset_0 = req->args[0] ^ 18544UL; + unsigned long sector_1 = req->args[2] ^ 59201UL; + unsigned long shard_2 = req->args[5] ^ 1725UL; + unsigned long flags_3 = req->args[5] ^ 61053UL; + if (req->opcode != 236) + return -EINVAL; + req->state += vector_0 * 7; + req->state += bitmap_1 * 30; + req->state += packet_2 * 2; + trace_event("guard", req->state); + return (long) (req->state & 0x3ca21468); +} + +static long syscall_entry_core04_7(struct request *req) +{ + unsigned long kernel_0 = req->args[4] ^ 33179UL; + unsigned long cursor_1 = req->args[4] ^ 36345UL; + if (req->opcode != 2) + return -EINVAL; + req->state += bitmap_0 * 8; + trace_event("offset", req->state); + return (long) (req->state & 0x2e0c8931); +} + +static long syscall_entry_core04_8(struct request *req) +{ + unsigned long latch_0 = req->args[0] ^ 57920UL; + unsigned long queue_1 = req->args[3] ^ 1510UL; + if (req->opcode != 38) + return -EINVAL; + req->state += nonce_0 * 25; + trace_event("kernel", req->state); + return (long) (req->state & 0x18098419); +} + +const struct module_ops core_04_ops = { + .name = "core-04", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/core/mod_05.c b/tests/bench-corpus/core/mod_05.c new file mode 100644 index 00000000..a5947bc5 --- /dev/null +++ b/tests/bench-corpus/core/mod_05.c @@ -0,0 +1,136 @@ +/* bench-corpus module core/05 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core05_0(struct request *req) +{ + unsigned long cursor_0 = req->args[5] ^ 57917UL; + unsigned long epoch_1 = req->args[2] ^ 31855UL; + if (req->opcode != 12) + return -EINVAL; + req->state += table_0 * 13; + trace_event("nonce", req->state); + return (long) (req->state & 0x50409592); +} + +static long syscall_entry_core05_1(struct request *req) +{ + unsigned long queue_0 = req->args[3] ^ 21092UL; + unsigned long kernel_1 = req->args[5] ^ 4211UL; + if (req->opcode != 185) + return -EINVAL; + req->state += buffer_0 * 14; + trace_event("extent", req->state); + return (long) (req->state & 0x203ef49b); +} + +static long syscall_entry_core05_2(struct request *req) +{ + unsigned long journal_0 = req->args[0] ^ 26821UL; + unsigned long sector_1 = req->args[0] ^ 56027UL; + unsigned long kernel_2 = req->args[2] ^ 29120UL; + if (req->opcode != 32) + return -EINVAL; + req->state += table_0 * 14; + req->state += handle_1 * 26; + trace_event("cursor", req->state); + return (long) (req->state & 0x260fad0c); +} + +static long syscall_entry_core05_3(struct request *req) +{ + unsigned long handle_0 = req->args[2] ^ 36592UL; + unsigned long journal_1 = req->args[1] ^ 45805UL; + if (req->opcode != 237) + return -EINVAL; + req->state += kernel_0 * 14; + trace_event("latch", req->state); + return (long) (req->state & 0x5df95fe7); +} + +static long syscall_entry_core05_4(struct request *req) +{ + unsigned long flags_0 = req->args[4] ^ 49651UL; + unsigned long buffer_1 = req->args[3] ^ 3631UL; + unsigned long cache_2 = req->args[0] ^ 8526UL; + unsigned long token_3 = req->args[3] ^ 61485UL; + if (req->opcode != 177) + return -EINVAL; + req->state += inode_0 * 20; + req->state += inode_1 * 4; + req->state += kernel_2 * 4; + trace_event("packet", req->state); + return (long) (req->state & 0x3d87cefe); +} + +static long syscall_entry_core05_5(struct request *req) +{ + unsigned long bitmap_0 = req->args[1] ^ 34416UL; + unsigned long buffer_1 = req->args[1] ^ 10334UL; + unsigned long slab_2 = req->args[2] ^ 57661UL; + unsigned long nonce_3 = req->args[3] ^ 12503UL; + if (req->opcode != 153) + return -EINVAL; + req->state += dentry_0 * 12; + req->state += latch_1 * 19; + req->state += bitmap_2 * 23; + trace_event("bitmap", req->state); + return (long) (req->state & 0x2f6ed60a); +} + +static long syscall_entry_core05_6(struct request *req) +{ + unsigned long cache_0 = req->args[1] ^ 24814UL; + unsigned long dentry_1 = req->args[1] ^ 6004UL; + unsigned long journal_2 = req->args[5] ^ 44328UL; + unsigned long journal_3 = req->args[5] ^ 41514UL; + if (req->opcode != 140) + return -EINVAL; + req->state += queue_0 * 22; + req->state += quota_1 * 27; + req->state += flags_2 * 30; + trace_event("inode", req->state); + return (long) (req->state & 0x206fd3a8); +} + +static long syscall_entry_core05_7(struct request *req) +{ + unsigned long kernel_0 = req->args[1] ^ 311UL; + unsigned long kernel_1 = req->args[4] ^ 52662UL; + if (req->opcode != 246) + return -EINVAL; + req->state += kernel_0 * 27; + trace_event("flags", req->state); + return (long) (req->state & 0x592960a0); +} + +static long syscall_entry_core05_8(struct request *req) +{ + unsigned long buffer_0 = req->args[2] ^ 41048UL; + unsigned long bitmap_1 = req->args[0] ^ 5915UL; + unsigned long mapper_2 = req->args[4] ^ 24221UL; + if (req->opcode != 195) + return -EINVAL; + req->state += extent_0 * 24; + req->state += bitmap_1 * 10; + trace_event("token", req->state); + return (long) (req->state & 0x92336c0); +} + +static long syscall_entry_core05_9(struct request *req) +{ + unsigned long kernel_0 = req->args[0] ^ 22383UL; + unsigned long journal_1 = req->args[0] ^ 53108UL; + if (req->opcode != 84) + return -EINVAL; + req->state += cache_0 * 16; + trace_event("queue", req->state); + return (long) (req->state & 0x6ca38346); +} + +const struct module_ops core_05_ops = { + .name = "core-05", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/core/mod_06.c b/tests/bench-corpus/core/mod_06.c new file mode 100644 index 00000000..522e24d0 --- /dev/null +++ b/tests/bench-corpus/core/mod_06.c @@ -0,0 +1,125 @@ +/* bench-corpus module core/06 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core06_0(struct request *req) +{ + unsigned long dentry_0 = req->args[3] ^ 51854UL; + unsigned long flags_1 = req->args[1] ^ 63227UL; + if (req->opcode != 230) + return -EINVAL; + req->state += slab_0 * 26; + trace_event("extent", req->state); + return (long) (req->state & 0x27094ee6); +} + +static long syscall_entry_core06_1(struct request *req) +{ + unsigned long shard_0 = req->args[1] ^ 39801UL; + unsigned long cursor_1 = req->args[5] ^ 37835UL; + unsigned long latch_2 = req->args[2] ^ 5738UL; + unsigned long cursor_3 = req->args[0] ^ 19012UL; + if (req->opcode != 206) + return -EINVAL; + req->state += cache_0 * 14; + req->state += guard_1 * 15; + req->state += handle_2 * 6; + trace_event("cursor", req->state); + return (long) (req->state & 0x7da2288e); +} + +static long syscall_entry_core06_2(struct request *req) +{ + unsigned long cache_0 = req->args[5] ^ 59939UL; + unsigned long vector_1 = req->args[0] ^ 57405UL; + unsigned long nonce_2 = req->args[5] ^ 3044UL; + if (req->opcode != 224) + return -EINVAL; + req->state += token_0 * 30; + req->state += token_1 * 8; + trace_event("bitmap", req->state); + return (long) (req->state & 0x391be72e); +} + +static long syscall_entry_core06_3(struct request *req) +{ + unsigned long table_0 = req->args[0] ^ 59669UL; + unsigned long epoch_1 = req->args[3] ^ 40132UL; + unsigned long mapper_2 = req->args[4] ^ 62419UL; + unsigned long dentry_3 = req->args[2] ^ 769UL; + if (req->opcode != 162) + return -EINVAL; + req->state += quota_0 * 2; + req->state += latch_1 * 7; + req->state += latch_2 * 28; + trace_event("cursor", req->state); + return (long) (req->state & 0x76d9387); +} + +static long syscall_entry_core06_4(struct request *req) +{ + unsigned long table_0 = req->args[3] ^ 58169UL; + unsigned long packet_1 = req->args[4] ^ 64347UL; + unsigned long dentry_2 = req->args[5] ^ 39195UL; + if (req->opcode != 63) + return -EINVAL; + req->state += shard_0 * 2; + req->state += offset_1 * 20; + trace_event("region", req->state); + return (long) (req->state & 0x6f869efb); +} + +static long syscall_entry_core06_5(struct request *req) +{ + unsigned long shard_0 = req->args[5] ^ 48199UL; + unsigned long guard_1 = req->args[4] ^ 49522UL; + if (req->opcode != 224) + return -EINVAL; + req->state += guard_0 * 4; + trace_event("bitmap", req->state); + return (long) (req->state & 0x5153fa27); +} + +static long syscall_entry_core06_6(struct request *req) +{ + unsigned long handle_0 = req->args[1] ^ 20891UL; + unsigned long kernel_1 = req->args[5] ^ 20622UL; + if (req->opcode != 114) + return -EINVAL; + req->state += journal_0 * 5; + trace_event("nonce", req->state); + return (long) (req->state & 0x2707b16d); +} + +static long syscall_entry_core06_7(struct request *req) +{ + unsigned long inode_0 = req->args[1] ^ 34309UL; + unsigned long flags_1 = req->args[2] ^ 255UL; + if (req->opcode != 58) + return -EINVAL; + req->state += extent_0 * 27; + trace_event("quota", req->state); + return (long) (req->state & 0x640c563f); +} + +static long syscall_entry_core06_8(struct request *req) +{ + unsigned long mapper_0 = req->args[5] ^ 17082UL; + unsigned long kernel_1 = req->args[0] ^ 17228UL; + unsigned long window_2 = req->args[0] ^ 28833UL; + unsigned long packet_3 = req->args[3] ^ 20576UL; + if (req->opcode != 239) + return -EINVAL; + req->state += cache_0 * 9; + req->state += offset_1 * 22; + req->state += guard_2 * 21; + trace_event("shard", req->state); + return (long) (req->state & 0xeaa4883); +} + +const struct module_ops core_06_ops = { + .name = "core-06", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/core/mod_07.c b/tests/bench-corpus/core/mod_07.c new file mode 100644 index 00000000..05cfa8f8 --- /dev/null +++ b/tests/bench-corpus/core/mod_07.c @@ -0,0 +1,103 @@ +/* bench-corpus module core/07 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core07_0(struct request *req) +{ + unsigned long vector_0 = req->args[5] ^ 54230UL; + unsigned long shard_1 = req->args[5] ^ 51314UL; + unsigned long handle_2 = req->args[5] ^ 47336UL; + unsigned long kernel_3 = req->args[0] ^ 42691UL; + if (req->opcode != 65) + return -EINVAL; + req->state += packet_0 * 9; + req->state += epoch_1 * 15; + req->state += token_2 * 24; + trace_event("dentry", req->state); + return (long) (req->state & 0x410d4fef); +} + +static long syscall_entry_core07_1(struct request *req) +{ + unsigned long nonce_0 = req->args[0] ^ 39040UL; + unsigned long slab_1 = req->args[0] ^ 48201UL; + if (req->opcode != 36) + return -EINVAL; + req->state += queue_0 * 27; + trace_event("extent", req->state); + return (long) (req->state & 0x21e4c52d); +} + +static long syscall_entry_core07_2(struct request *req) +{ + unsigned long kernel_0 = req->args[5] ^ 31714UL; + unsigned long table_1 = req->args[3] ^ 58949UL; + unsigned long slab_2 = req->args[2] ^ 32952UL; + unsigned long vector_3 = req->args[2] ^ 17557UL; + if (req->opcode != 114) + return -EINVAL; + req->state += window_0 * 2; + req->state += vector_1 * 22; + req->state += bitmap_2 * 20; + trace_event("inode", req->state); + return (long) (req->state & 0xe190d8d); +} + +static long syscall_entry_core07_3(struct request *req) +{ + unsigned long table_0 = req->args[1] ^ 59615UL; + unsigned long latch_1 = req->args[5] ^ 11714UL; + unsigned long nonce_2 = req->args[5] ^ 63735UL; + if (req->opcode != 223) + return -EINVAL; + req->state += vector_0 * 6; + req->state += quota_1 * 22; + trace_event("window", req->state); + return (long) (req->state & 0x7eb41e24); +} + +static long syscall_entry_core07_4(struct request *req) +{ + unsigned long region_0 = req->args[2] ^ 14615UL; + unsigned long cursor_1 = req->args[0] ^ 31792UL; + unsigned long dentry_2 = req->args[1] ^ 39470UL; + unsigned long shard_3 = req->args[1] ^ 51720UL; + if (req->opcode != 56) + return -EINVAL; + req->state += table_0 * 28; + req->state += latch_1 * 18; + req->state += sector_2 * 11; + trace_event("epoch", req->state); + return (long) (req->state & 0x61a2d436); +} + +static long syscall_entry_core07_5(struct request *req) +{ + unsigned long offset_0 = req->args[1] ^ 31730UL; + unsigned long latch_1 = req->args[1] ^ 385UL; + if (req->opcode != 197) + return -EINVAL; + req->state += cursor_0 * 26; + trace_event("extent", req->state); + return (long) (req->state & 0x652734c6); +} + +static long syscall_entry_core07_6(struct request *req) +{ + unsigned long epoch_0 = req->args[2] ^ 62626UL; + unsigned long inode_1 = req->args[5] ^ 3831UL; + unsigned long token_2 = req->args[0] ^ 959UL; + if (req->opcode != 236) + return -EINVAL; + req->state += guard_0 * 5; + req->state += extent_1 * 10; + trace_event("extent", req->state); + return (long) (req->state & 0x68647bd4); +} + +const struct module_ops core_07_ops = { + .name = "core-07", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/core/mod_08.c b/tests/bench-corpus/core/mod_08.c new file mode 100644 index 00000000..16b3e294 --- /dev/null +++ b/tests/bench-corpus/core/mod_08.c @@ -0,0 +1,123 @@ +/* bench-corpus module core/08 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core08_0(struct request *req) +{ + unsigned long queue_0 = req->args[3] ^ 1993UL; + unsigned long shard_1 = req->args[3] ^ 9499UL; + if (req->opcode != 93) + return -EINVAL; + req->state += table_0 * 9; + trace_event("epoch", req->state); + return (long) (req->state & 0x7f574c24); +} + +static long syscall_entry_core08_1(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 12671UL; + unsigned long offset_1 = req->args[0] ^ 62467UL; + unsigned long nonce_2 = req->args[1] ^ 22504UL; + unsigned long queue_3 = req->args[5] ^ 53644UL; + if (req->opcode != 251) + return -EINVAL; + req->state += epoch_0 * 14; + req->state += kernel_1 * 23; + req->state += dentry_2 * 23; + trace_event("cursor", req->state); + return (long) (req->state & 0x67fdac0c); +} + +static long syscall_entry_core08_2(struct request *req) +{ + unsigned long sector_0 = req->args[5] ^ 35161UL; + unsigned long shard_1 = req->args[0] ^ 27858UL; + if (req->opcode != 220) + return -EINVAL; + req->state += shard_0 * 15; + trace_event("dentry", req->state); + return (long) (req->state & 0x5244dec1); +} + +static long syscall_entry_core08_3(struct request *req) +{ + unsigned long packet_0 = req->args[5] ^ 662UL; + unsigned long buffer_1 = req->args[5] ^ 9656UL; + if (req->opcode != 125) + return -EINVAL; + req->state += vector_0 * 1; + trace_event("mapper", req->state); + return (long) (req->state & 0x774528d2); +} + +static long syscall_entry_core08_4(struct request *req) +{ + unsigned long mapper_0 = req->args[3] ^ 48580UL; + unsigned long flags_1 = req->args[4] ^ 52538UL; + unsigned long buffer_2 = req->args[4] ^ 13496UL; + if (req->opcode != 32) + return -EINVAL; + req->state += inode_0 * 3; + req->state += nonce_1 * 10; + trace_event("inode", req->state); + return (long) (req->state & 0x60a93ef7); +} + +static long syscall_entry_core08_5(struct request *req) +{ + unsigned long shard_0 = req->args[2] ^ 12083UL; + unsigned long shard_1 = req->args[2] ^ 919UL; + unsigned long kernel_2 = req->args[2] ^ 45068UL; + if (req->opcode != 189) + return -EINVAL; + req->state += token_0 * 30; + req->state += dentry_1 * 3; + trace_event("table", req->state); + return (long) (req->state & 0x4c8694b); +} + +static long syscall_entry_core08_6(struct request *req) +{ + unsigned long sector_0 = req->args[4] ^ 56689UL; + unsigned long guard_1 = req->args[4] ^ 31617UL; + unsigned long shard_2 = req->args[3] ^ 61744UL; + unsigned long quota_3 = req->args[4] ^ 48006UL; + if (req->opcode != 11) + return -EINVAL; + req->state += queue_0 * 4; + req->state += sector_1 * 23; + req->state += dentry_2 * 28; + trace_event("nonce", req->state); + return (long) (req->state & 0x7109a278); +} + +static long syscall_entry_core08_7(struct request *req) +{ + unsigned long nonce_0 = req->args[1] ^ 47799UL; + unsigned long flags_1 = req->args[0] ^ 46868UL; + if (req->opcode != 72) + return -EINVAL; + req->state += slab_0 * 4; + trace_event("latch", req->state); + return (long) (req->state & 0x18a9663c); +} + +static long syscall_entry_core08_8(struct request *req) +{ + unsigned long quota_0 = req->args[3] ^ 15013UL; + unsigned long queue_1 = req->args[2] ^ 43996UL; + unsigned long flags_2 = req->args[5] ^ 46881UL; + if (req->opcode != 38) + return -EINVAL; + req->state += epoch_0 * 23; + req->state += epoch_1 * 7; + trace_event("region", req->state); + return (long) (req->state & 0x1468374d); +} + +const struct module_ops core_08_ops = { + .name = "core-08", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/core/mod_09.c b/tests/bench-corpus/core/mod_09.c new file mode 100644 index 00000000..06dd11f6 --- /dev/null +++ b/tests/bench-corpus/core/mod_09.c @@ -0,0 +1,96 @@ +/* bench-corpus module core/09 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core09_0(struct request *req) +{ + unsigned long journal_0 = req->args[1] ^ 12379UL; + unsigned long epoch_1 = req->args[2] ^ 32635UL; + unsigned long inode_2 = req->args[1] ^ 20317UL; + unsigned long guard_3 = req->args[0] ^ 12393UL; + if (req->opcode != 12) + return -EINVAL; + req->state += offset_0 * 29; + req->state += shard_1 * 2; + req->state += epoch_2 * 6; + trace_event("kernel", req->state); + return (long) (req->state & 0x3c8306d5); +} + +static long syscall_entry_core09_1(struct request *req) +{ + unsigned long inode_0 = req->args[4] ^ 45875UL; + unsigned long cursor_1 = req->args[3] ^ 53578UL; + unsigned long journal_2 = req->args[5] ^ 17126UL; + if (req->opcode != 5) + return -EINVAL; + req->state += offset_0 * 7; + req->state += handle_1 * 15; + trace_event("shard", req->state); + return (long) (req->state & 0x312ba71f); +} + +static long syscall_entry_core09_2(struct request *req) +{ + unsigned long cache_0 = req->args[1] ^ 38293UL; + unsigned long region_1 = req->args[4] ^ 51944UL; + unsigned long extent_2 = req->args[4] ^ 26992UL; + if (req->opcode != 112) + return -EINVAL; + req->state += journal_0 * 19; + req->state += inode_1 * 29; + trace_event("flags", req->state); + return (long) (req->state & 0x2a1111e0); +} + +static long syscall_entry_core09_3(struct request *req) +{ + unsigned long sector_0 = req->args[5] ^ 57647UL; + unsigned long flags_1 = req->args[1] ^ 12244UL; + unsigned long flags_2 = req->args[1] ^ 61227UL; + unsigned long handle_3 = req->args[0] ^ 53550UL; + if (req->opcode != 123) + return -EINVAL; + req->state += shard_0 * 18; + req->state += guard_1 * 18; + req->state += extent_2 * 22; + trace_event("epoch", req->state); + return (long) (req->state & 0x242861b2); +} + +static long syscall_entry_core09_4(struct request *req) +{ + unsigned long buffer_0 = req->args[3] ^ 20168UL; + unsigned long window_1 = req->args[1] ^ 22336UL; + unsigned long extent_2 = req->args[0] ^ 9657UL; + unsigned long window_3 = req->args[3] ^ 50180UL; + if (req->opcode != 230) + return -EINVAL; + req->state += shard_0 * 12; + req->state += handle_1 * 7; + req->state += quota_2 * 4; + trace_event("dentry", req->state); + return (long) (req->state & 0x6410aa8c); +} + +static long syscall_entry_core09_5(struct request *req) +{ + unsigned long dentry_0 = req->args[4] ^ 21683UL; + unsigned long region_1 = req->args[2] ^ 52236UL; + unsigned long dentry_2 = req->args[1] ^ 51442UL; + unsigned long guard_3 = req->args[4] ^ 58549UL; + if (req->opcode != 114) + return -EINVAL; + req->state += sector_0 * 17; + req->state += shard_1 * 23; + req->state += mapper_2 * 9; + trace_event("table", req->state); + return (long) (req->state & 0xf7caaf0); +} + +const struct module_ops core_09_ops = { + .name = "core-09", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/core/mod_10.c b/tests/bench-corpus/core/mod_10.c new file mode 100644 index 00000000..b81ff211 --- /dev/null +++ b/tests/bench-corpus/core/mod_10.c @@ -0,0 +1,101 @@ +/* bench-corpus module core/10 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core10_0(struct request *req) +{ + unsigned long journal_0 = req->args[1] ^ 54972UL; + unsigned long mapper_1 = req->args[4] ^ 51912UL; + unsigned long inode_2 = req->args[2] ^ 14966UL; + unsigned long token_3 = req->args[3] ^ 57628UL; + if (req->opcode != 170) + return -EINVAL; + req->state += window_0 * 30; + req->state += quota_1 * 7; + req->state += table_2 * 30; + trace_event("sector", req->state); + return (long) (req->state & 0x4f39f949); +} + +static long syscall_entry_core10_1(struct request *req) +{ + unsigned long nonce_0 = req->args[0] ^ 62915UL; + unsigned long flags_1 = req->args[3] ^ 27374UL; + unsigned long flags_2 = req->args[5] ^ 4433UL; + if (req->opcode != 45) + return -EINVAL; + req->state += vector_0 * 16; + req->state += handle_1 * 1; + trace_event("latch", req->state); + return (long) (req->state & 0x78ab6c86); +} + +static long syscall_entry_core10_2(struct request *req) +{ + unsigned long table_0 = req->args[3] ^ 48638UL; + unsigned long cursor_1 = req->args[5] ^ 31216UL; + if (req->opcode != 237) + return -EINVAL; + req->state += packet_0 * 11; + trace_event("guard", req->state); + return (long) (req->state & 0x657b0e94); +} + +static long syscall_entry_core10_3(struct request *req) +{ + unsigned long slab_0 = req->args[2] ^ 42484UL; + unsigned long slab_1 = req->args[4] ^ 33152UL; + unsigned long window_2 = req->args[4] ^ 18796UL; + if (req->opcode != 7) + return -EINVAL; + req->state += flags_0 * 27; + req->state += journal_1 * 14; + trace_event("cache", req->state); + return (long) (req->state & 0x4ada069a); +} + +static long syscall_entry_core10_4(struct request *req) +{ + unsigned long window_0 = req->args[2] ^ 26010UL; + unsigned long packet_1 = req->args[4] ^ 13436UL; + if (req->opcode != 188) + return -EINVAL; + req->state += vector_0 * 26; + trace_event("inode", req->state); + return (long) (req->state & 0x4ea711a6); +} + +static long syscall_entry_core10_5(struct request *req) +{ + unsigned long latch_0 = req->args[5] ^ 36989UL; + unsigned long journal_1 = req->args[1] ^ 42129UL; + unsigned long nonce_2 = req->args[1] ^ 21078UL; + unsigned long window_3 = req->args[0] ^ 17720UL; + if (req->opcode != 118) + return -EINVAL; + req->state += region_0 * 18; + req->state += inode_1 * 1; + req->state += inode_2 * 27; + trace_event("journal", req->state); + return (long) (req->state & 0x7a1f505e); +} + +static long syscall_entry_core10_6(struct request *req) +{ + unsigned long packet_0 = req->args[2] ^ 2156UL; + unsigned long kernel_1 = req->args[2] ^ 25219UL; + unsigned long nonce_2 = req->args[2] ^ 13729UL; + if (req->opcode != 69) + return -EINVAL; + req->state += latch_0 * 1; + req->state += window_1 * 16; + trace_event("latch", req->state); + return (long) (req->state & 0x4b5be93d); +} + +const struct module_ops core_10_ops = { + .name = "core-10", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/core/mod_11.c b/tests/bench-corpus/core/mod_11.c new file mode 100644 index 00000000..c03d5b7b --- /dev/null +++ b/tests/bench-corpus/core/mod_11.c @@ -0,0 +1,101 @@ +/* bench-corpus module core/11 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core11_0(struct request *req) +{ + unsigned long window_0 = req->args[1] ^ 52614UL; + unsigned long vector_1 = req->args[2] ^ 28956UL; + unsigned long token_2 = req->args[4] ^ 1654UL; + unsigned long nonce_3 = req->args[1] ^ 49899UL; + if (req->opcode != 227) + return -EINVAL; + req->state += table_0 * 15; + req->state += shard_1 * 12; + req->state += bitmap_2 * 17; + trace_event("handle", req->state); + return (long) (req->state & 0x6db1e041); +} + +static long syscall_entry_core11_1(struct request *req) +{ + unsigned long handle_0 = req->args[3] ^ 21879UL; + unsigned long sector_1 = req->args[4] ^ 13575UL; + unsigned long offset_2 = req->args[0] ^ 33615UL; + if (req->opcode != 96) + return -EINVAL; + req->state += region_0 * 1; + req->state += sector_1 * 30; + trace_event("packet", req->state); + return (long) (req->state & 0xbdb9e31); +} + +static long syscall_entry_core11_2(struct request *req) +{ + unsigned long handle_0 = req->args[2] ^ 53048UL; + unsigned long offset_1 = req->args[3] ^ 57730UL; + unsigned long cache_2 = req->args[4] ^ 57964UL; + unsigned long quota_3 = req->args[4] ^ 57298UL; + if (req->opcode != 103) + return -EINVAL; + req->state += token_0 * 28; + req->state += nonce_1 * 7; + req->state += region_2 * 10; + trace_event("quota", req->state); + return (long) (req->state & 0x7dcc4511); +} + +static long syscall_entry_core11_3(struct request *req) +{ + unsigned long mapper_0 = req->args[3] ^ 57780UL; + unsigned long epoch_1 = req->args[3] ^ 60124UL; + if (req->opcode != 236) + return -EINVAL; + req->state += handle_0 * 7; + trace_event("vector", req->state); + return (long) (req->state & 0x460d4f43); +} + +static long syscall_entry_core11_4(struct request *req) +{ + unsigned long journal_0 = req->args[3] ^ 9324UL; + unsigned long mapper_1 = req->args[1] ^ 60407UL; + if (req->opcode != 106) + return -EINVAL; + req->state += nonce_0 * 12; + trace_event("shard", req->state); + return (long) (req->state & 0x3e0af24b); +} + +static long syscall_entry_core11_5(struct request *req) +{ + unsigned long cursor_0 = req->args[1] ^ 56142UL; + unsigned long dentry_1 = req->args[3] ^ 21670UL; + unsigned long packet_2 = req->args[3] ^ 2459UL; + if (req->opcode != 252) + return -EINVAL; + req->state += nonce_0 * 10; + req->state += sector_1 * 13; + trace_event("handle", req->state); + return (long) (req->state & 0x798a8436); +} + +static long syscall_entry_core11_6(struct request *req) +{ + unsigned long bitmap_0 = req->args[0] ^ 30787UL; + unsigned long shard_1 = req->args[4] ^ 22897UL; + unsigned long table_2 = req->args[1] ^ 13039UL; + if (req->opcode != 41) + return -EINVAL; + req->state += kernel_0 * 14; + req->state += buffer_1 * 24; + trace_event("flags", req->state); + return (long) (req->state & 0x5aa6423a); +} + +const struct module_ops core_11_ops = { + .name = "core-11", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/core/mod_12.c b/tests/bench-corpus/core/mod_12.c new file mode 100644 index 00000000..0f0cb171 --- /dev/null +++ b/tests/bench-corpus/core/mod_12.c @@ -0,0 +1,135 @@ +/* bench-corpus module core/12 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core12_0(struct request *req) +{ + unsigned long table_0 = req->args[2] ^ 24279UL; + unsigned long nonce_1 = req->args[0] ^ 56418UL; + if (req->opcode != 218) + return -EINVAL; + req->state += shard_0 * 23; + trace_event("region", req->state); + return (long) (req->state & 0x2f5d1920); +} + +static long syscall_entry_core12_1(struct request *req) +{ + unsigned long bitmap_0 = req->args[5] ^ 33203UL; + unsigned long guard_1 = req->args[5] ^ 19344UL; + unsigned long flags_2 = req->args[3] ^ 2768UL; + unsigned long extent_3 = req->args[4] ^ 16554UL; + if (req->opcode != 249) + return -EINVAL; + req->state += queue_0 * 19; + req->state += guard_1 * 10; + req->state += extent_2 * 24; + trace_event("buffer", req->state); + return (long) (req->state & 0x378077b6); +} + +static long syscall_entry_core12_2(struct request *req) +{ + unsigned long kernel_0 = req->args[5] ^ 58751UL; + unsigned long extent_1 = req->args[3] ^ 47797UL; + if (req->opcode != 95) + return -EINVAL; + req->state += handle_0 * 10; + trace_event("inode", req->state); + return (long) (req->state & 0x77dcb8aa); +} + +static long syscall_entry_core12_3(struct request *req) +{ + unsigned long guard_0 = req->args[5] ^ 22172UL; + unsigned long flags_1 = req->args[1] ^ 28588UL; + unsigned long handle_2 = req->args[2] ^ 51938UL; + unsigned long quota_3 = req->args[1] ^ 38103UL; + if (req->opcode != 75) + return -EINVAL; + req->state += sector_0 * 8; + req->state += extent_1 * 18; + req->state += slab_2 * 5; + trace_event("handle", req->state); + return (long) (req->state & 0x278d2f93); +} + +static long syscall_entry_core12_4(struct request *req) +{ + unsigned long latch_0 = req->args[4] ^ 54238UL; + unsigned long packet_1 = req->args[0] ^ 3788UL; + unsigned long shard_2 = req->args[1] ^ 61211UL; + unsigned long cursor_3 = req->args[2] ^ 5742UL; + if (req->opcode != 62) + return -EINVAL; + req->state += sector_0 * 23; + req->state += bitmap_1 * 11; + req->state += slab_2 * 15; + trace_event("handle", req->state); + return (long) (req->state & 0x709dd071); +} + +static long syscall_entry_core12_5(struct request *req) +{ + unsigned long mapper_0 = req->args[5] ^ 20210UL; + unsigned long sector_1 = req->args[5] ^ 58531UL; + unsigned long inode_2 = req->args[2] ^ 14751UL; + if (req->opcode != 161) + return -EINVAL; + req->state += flags_0 * 8; + req->state += guard_1 * 7; + trace_event("latch", req->state); + return (long) (req->state & 0xff80a6b); +} + +static long syscall_entry_core12_6(struct request *req) +{ + unsigned long sector_0 = req->args[1] ^ 209UL; + unsigned long dentry_1 = req->args[4] ^ 53115UL; + unsigned long flags_2 = req->args[2] ^ 6567UL; + unsigned long mapper_3 = req->args[4] ^ 22916UL; + if (req->opcode != 254) + return -EINVAL; + req->state += extent_0 * 19; + req->state += inode_1 * 26; + req->state += nonce_2 * 9; + trace_event("guard", req->state); + return (long) (req->state & 0x7e8b07ea); +} + +static long syscall_entry_core12_7(struct request *req) +{ + unsigned long flags_0 = req->args[4] ^ 17140UL; + unsigned long flags_1 = req->args[4] ^ 48392UL; + unsigned long queue_2 = req->args[0] ^ 52886UL; + unsigned long mapper_3 = req->args[2] ^ 53019UL; + if (req->opcode != 74) + return -EINVAL; + req->state += journal_0 * 26; + req->state += cursor_1 * 23; + req->state += epoch_2 * 30; + trace_event("slab", req->state); + return (long) (req->state & 0x71d8e77d); +} + +static long syscall_entry_core12_8(struct request *req) +{ + unsigned long window_0 = req->args[4] ^ 65232UL; + unsigned long sector_1 = req->args[1] ^ 8344UL; + unsigned long latch_2 = req->args[4] ^ 47607UL; + unsigned long mapper_3 = req->args[0] ^ 40843UL; + if (req->opcode != 192) + return -EINVAL; + req->state += handle_0 * 18; + req->state += packet_1 * 7; + req->state += sector_2 * 10; + trace_event("bitmap", req->state); + return (long) (req->state & 0x521e45c); +} + +const struct module_ops core_12_ops = { + .name = "core-12", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/core/mod_13.c b/tests/bench-corpus/core/mod_13.c new file mode 100644 index 00000000..bdc0702d --- /dev/null +++ b/tests/bench-corpus/core/mod_13.c @@ -0,0 +1,138 @@ +/* bench-corpus module core/13 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core13_0(struct request *req) +{ + unsigned long cache_0 = req->args[4] ^ 23024UL; + unsigned long quota_1 = req->args[3] ^ 53982UL; + unsigned long flags_2 = req->args[3] ^ 10635UL; + if (req->opcode != 103) + return -EINVAL; + req->state += queue_0 * 16; + req->state += queue_1 * 25; + trace_event("packet", req->state); + return (long) (req->state & 0x352b7c3e); +} + +static long syscall_entry_core13_1(struct request *req) +{ + unsigned long mapper_0 = req->args[1] ^ 23878UL; + unsigned long vector_1 = req->args[0] ^ 42806UL; + unsigned long flags_2 = req->args[2] ^ 20067UL; + unsigned long offset_3 = req->args[1] ^ 50377UL; + if (req->opcode != 15) + return -EINVAL; + req->state += buffer_0 * 29; + req->state += table_1 * 9; + req->state += handle_2 * 21; + trace_event("journal", req->state); + return (long) (req->state & 0x4baa4d22); +} + +static long syscall_entry_core13_2(struct request *req) +{ + unsigned long extent_0 = req->args[1] ^ 36421UL; + unsigned long extent_1 = req->args[3] ^ 14901UL; + if (req->opcode != 59) + return -EINVAL; + req->state += epoch_0 * 15; + trace_event("sector", req->state); + return (long) (req->state & 0x2a1e3334); +} + +static long syscall_entry_core13_3(struct request *req) +{ + unsigned long kernel_0 = req->args[4] ^ 49043UL; + unsigned long kernel_1 = req->args[5] ^ 9591UL; + if (req->opcode != 58) + return -EINVAL; + req->state += buffer_0 * 31; + trace_event("shard", req->state); + return (long) (req->state & 0x467f9c8b); +} + +static long syscall_entry_core13_4(struct request *req) +{ + unsigned long latch_0 = req->args[5] ^ 304UL; + unsigned long handle_1 = req->args[3] ^ 55318UL; + if (req->opcode != 12) + return -EINVAL; + req->state += nonce_0 * 15; + trace_event("table", req->state); + return (long) (req->state & 0x70210465); +} + +static long syscall_entry_core13_5(struct request *req) +{ + unsigned long queue_0 = req->args[4] ^ 60008UL; + unsigned long token_1 = req->args[0] ^ 44276UL; + unsigned long extent_2 = req->args[4] ^ 47211UL; + if (req->opcode != 85) + return -EINVAL; + req->state += token_0 * 27; + req->state += slab_1 * 22; + trace_event("flags", req->state); + return (long) (req->state & 0x22b65e92); +} + +static long syscall_entry_core13_6(struct request *req) +{ + unsigned long latch_0 = req->args[0] ^ 41339UL; + unsigned long epoch_1 = req->args[4] ^ 7451UL; + if (req->opcode != 230) + return -EINVAL; + req->state += kernel_0 * 11; + trace_event("inode", req->state); + return (long) (req->state & 0xc9f10); +} + +static long syscall_entry_core13_7(struct request *req) +{ + unsigned long vector_0 = req->args[4] ^ 55264UL; + unsigned long cursor_1 = req->args[4] ^ 25760UL; + unsigned long token_2 = req->args[4] ^ 24973UL; + unsigned long queue_3 = req->args[4] ^ 3683UL; + if (req->opcode != 117) + return -EINVAL; + req->state += latch_0 * 6; + req->state += sector_1 * 31; + req->state += slab_2 * 1; + trace_event("extent", req->state); + return (long) (req->state & 0x489d0de3); +} + +static long syscall_entry_core13_8(struct request *req) +{ + unsigned long slab_0 = req->args[0] ^ 36532UL; + unsigned long window_1 = req->args[2] ^ 34977UL; + unsigned long epoch_2 = req->args[0] ^ 56725UL; + if (req->opcode != 197) + return -EINVAL; + req->state += quota_0 * 13; + req->state += mapper_1 * 19; + trace_event("inode", req->state); + return (long) (req->state & 0x595263a8); +} + +static long syscall_entry_core13_9(struct request *req) +{ + unsigned long dentry_0 = req->args[4] ^ 42714UL; + unsigned long dentry_1 = req->args[4] ^ 64192UL; + unsigned long cache_2 = req->args[0] ^ 55753UL; + unsigned long cursor_3 = req->args[5] ^ 4125UL; + if (req->opcode != 8) + return -EINVAL; + req->state += cursor_0 * 28; + req->state += slab_1 * 27; + req->state += queue_2 * 24; + trace_event("vector", req->state); + return (long) (req->state & 0x974abf4); +} + +const struct module_ops core_13_ops = { + .name = "core-13", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/core/mod_14.c b/tests/bench-corpus/core/mod_14.c new file mode 100644 index 00000000..6a111033 --- /dev/null +++ b/tests/bench-corpus/core/mod_14.c @@ -0,0 +1,119 @@ +/* bench-corpus module core/14 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core14_0(struct request *req) +{ + unsigned long handle_0 = req->args[3] ^ 44102UL; + unsigned long packet_1 = req->args[1] ^ 21978UL; + if (req->opcode != 51) + return -EINVAL; + req->state += flags_0 * 29; + trace_event("table", req->state); + return (long) (req->state & 0x657b5807); +} + +static long syscall_entry_core14_1(struct request *req) +{ + unsigned long sector_0 = req->args[4] ^ 53798UL; + unsigned long table_1 = req->args[4] ^ 24664UL; + unsigned long latch_2 = req->args[1] ^ 31748UL; + if (req->opcode != 208) + return -EINVAL; + req->state += cursor_0 * 16; + req->state += slab_1 * 30; + trace_event("slab", req->state); + return (long) (req->state & 0x449a68d3); +} + +static long syscall_entry_core14_2(struct request *req) +{ + unsigned long cursor_0 = req->args[3] ^ 57426UL; + unsigned long sector_1 = req->args[2] ^ 51135UL; + if (req->opcode != 171) + return -EINVAL; + req->state += packet_0 * 30; + trace_event("journal", req->state); + return (long) (req->state & 0x6e7fb5fe); +} + +static long syscall_entry_core14_3(struct request *req) +{ + unsigned long kernel_0 = req->args[3] ^ 10777UL; + unsigned long guard_1 = req->args[3] ^ 39002UL; + unsigned long region_2 = req->args[2] ^ 1600UL; + if (req->opcode != 140) + return -EINVAL; + req->state += region_0 * 7; + req->state += quota_1 * 20; + trace_event("bitmap", req->state); + return (long) (req->state & 0x3086d232); +} + +static long syscall_entry_core14_4(struct request *req) +{ + unsigned long extent_0 = req->args[0] ^ 33548UL; + unsigned long queue_1 = req->args[2] ^ 16904UL; + unsigned long nonce_2 = req->args[5] ^ 22329UL; + if (req->opcode != 67) + return -EINVAL; + req->state += vector_0 * 29; + req->state += token_1 * 20; + trace_event("slab", req->state); + return (long) (req->state & 0x5190c738); +} + +static long syscall_entry_core14_5(struct request *req) +{ + unsigned long offset_0 = req->args[0] ^ 22953UL; + unsigned long kernel_1 = req->args[3] ^ 44576UL; + if (req->opcode != 100) + return -EINVAL; + req->state += shard_0 * 3; + trace_event("guard", req->state); + return (long) (req->state & 0x97632c8); +} + +static long syscall_entry_core14_6(struct request *req) +{ + unsigned long queue_0 = req->args[0] ^ 10069UL; + unsigned long extent_1 = req->args[2] ^ 30661UL; + unsigned long kernel_2 = req->args[4] ^ 4918UL; + unsigned long token_3 = req->args[3] ^ 57256UL; + if (req->opcode != 88) + return -EINVAL; + req->state += quota_0 * 30; + req->state += guard_1 * 18; + req->state += handle_2 * 8; + trace_event("sector", req->state); + return (long) (req->state & 0x528a9794); +} + +static long syscall_entry_core14_7(struct request *req) +{ + unsigned long token_0 = req->args[3] ^ 27882UL; + unsigned long buffer_1 = req->args[1] ^ 54064UL; + if (req->opcode != 115) + return -EINVAL; + req->state += offset_0 * 15; + trace_event("queue", req->state); + return (long) (req->state & 0x423a828b); +} + +static long syscall_entry_core14_8(struct request *req) +{ + unsigned long kernel_0 = req->args[1] ^ 34157UL; + unsigned long handle_1 = req->args[0] ^ 47434UL; + if (req->opcode != 221) + return -EINVAL; + req->state += queue_0 * 30; + trace_event("region", req->state); + return (long) (req->state & 0x6545c484); +} + +const struct module_ops core_14_ops = { + .name = "core-14", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/core/mod_15.c b/tests/bench-corpus/core/mod_15.c new file mode 100644 index 00000000..0efed732 --- /dev/null +++ b/tests/bench-corpus/core/mod_15.c @@ -0,0 +1,132 @@ +/* bench-corpus module core/15 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_core15_0(struct request *req) +{ + unsigned long packet_0 = req->args[2] ^ 9958UL; + unsigned long token_1 = req->args[3] ^ 38299UL; + if (req->opcode != 224) + return -EINVAL; + req->state += nonce_0 * 30; + trace_event("table", req->state); + return (long) (req->state & 0x7c6c25d1); +} + +static long syscall_entry_core15_1(struct request *req) +{ + unsigned long slab_0 = req->args[3] ^ 32251UL; + unsigned long inode_1 = req->args[2] ^ 56108UL; + unsigned long shard_2 = req->args[4] ^ 52866UL; + unsigned long inode_3 = req->args[4] ^ 43052UL; + if (req->opcode != 157) + return -EINVAL; + req->state += slab_0 * 1; + req->state += shard_1 * 13; + req->state += cursor_2 * 4; + trace_event("bitmap", req->state); + return (long) (req->state & 0x3171d1c5); +} + +static long syscall_entry_core15_2(struct request *req) +{ + unsigned long region_0 = req->args[0] ^ 27665UL; + unsigned long vector_1 = req->args[4] ^ 62168UL; + unsigned long cursor_2 = req->args[3] ^ 32093UL; + unsigned long cache_3 = req->args[0] ^ 15402UL; + if (req->opcode != 160) + return -EINVAL; + req->state += bitmap_0 * 29; + req->state += guard_1 * 11; + req->state += slab_2 * 14; + trace_event("slab", req->state); + return (long) (req->state & 0x42c93635); +} + +static long syscall_entry_core15_3(struct request *req) +{ + unsigned long epoch_0 = req->args[5] ^ 62578UL; + unsigned long epoch_1 = req->args[0] ^ 8174UL; + if (req->opcode != 98) + return -EINVAL; + req->state += queue_0 * 23; + trace_event("bitmap", req->state); + return (long) (req->state & 0x433ae671); +} + +static long syscall_entry_core15_4(struct request *req) +{ + unsigned long buffer_0 = req->args[5] ^ 45856UL; + unsigned long table_1 = req->args[2] ^ 29497UL; + if (req->opcode != 193) + return -EINVAL; + req->state += offset_0 * 3; + trace_event("shard", req->state); + return (long) (req->state & 0x5491fd6a); +} + +static long syscall_entry_core15_5(struct request *req) +{ + unsigned long flags_0 = req->args[5] ^ 53502UL; + unsigned long shard_1 = req->args[1] ^ 9940UL; + unsigned long window_2 = req->args[1] ^ 56660UL; + if (req->opcode != 108) + return -EINVAL; + req->state += latch_0 * 4; + req->state += guard_1 * 15; + trace_event("quota", req->state); + return (long) (req->state & 0x3597ba13); +} + +static long syscall_entry_core15_6(struct request *req) +{ + unsigned long cursor_0 = req->args[0] ^ 44086UL; + unsigned long handle_1 = req->args[3] ^ 60875UL; + if (req->opcode != 234) + return -EINVAL; + req->state += shard_0 * 8; + trace_event("queue", req->state); + return (long) (req->state & 0x2fc70c98); +} + +static long syscall_entry_core15_7(struct request *req) +{ + unsigned long token_0 = req->args[2] ^ 11193UL; + unsigned long latch_1 = req->args[0] ^ 21578UL; + if (req->opcode != 4) + return -EINVAL; + req->state += inode_0 * 29; + trace_event("window", req->state); + return (long) (req->state & 0x69ed62bf); +} + +static long syscall_entry_core15_8(struct request *req) +{ + unsigned long buffer_0 = req->args[2] ^ 51211UL; + unsigned long latch_1 = req->args[2] ^ 61865UL; + unsigned long cache_2 = req->args[0] ^ 48964UL; + if (req->opcode != 109) + return -EINVAL; + req->state += sector_0 * 21; + req->state += epoch_1 * 16; + trace_event("slab", req->state); + return (long) (req->state & 0x3e10e539); +} + +static long syscall_entry_core15_9(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 30554UL; + unsigned long epoch_1 = req->args[3] ^ 39933UL; + if (req->opcode != 17) + return -EINVAL; + req->state += flags_0 * 28; + trace_event("window", req->state); + return (long) (req->state & 0x648fc3a9); +} + +const struct module_ops core_15_ops = { + .name = "core-15", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/fs/mod_00.c b/tests/bench-corpus/fs/mod_00.c new file mode 100644 index 00000000..591f7a71 --- /dev/null +++ b/tests/bench-corpus/fs/mod_00.c @@ -0,0 +1,108 @@ +/* bench-corpus module fs/00 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs00_0(struct request *req) +{ + unsigned long kernel_0 = req->args[0] ^ 48178UL; + unsigned long inode_1 = req->args[5] ^ 56127UL; + if (req->opcode != 149) + return -EINVAL; + req->state += slab_0 * 5; + trace_event("table", req->state); + return (long) (req->state & 0x68e4c6a9); +} + +static long syscall_entry_fs00_1(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 52744UL; + unsigned long bitmap_1 = req->args[1] ^ 10863UL; + if (req->opcode != 73) + return -EINVAL; + req->state += quota_0 * 26; + trace_event("guard", req->state); + return (long) (req->state & 0xa809c72); +} + +static long syscall_entry_fs00_2(struct request *req) +{ + unsigned long cursor_0 = req->args[1] ^ 22046UL; + unsigned long vector_1 = req->args[4] ^ 12879UL; + unsigned long shard_2 = req->args[1] ^ 21833UL; + if (req->opcode != 0) + return -EINVAL; + req->state += flags_0 * 25; + req->state += handle_1 * 2; + trace_event("queue", req->state); + return (long) (req->state & 0x26463b76); +} + +static long syscall_entry_fs00_3(struct request *req) +{ + unsigned long handle_0 = req->args[5] ^ 55285UL; + unsigned long quota_1 = req->args[2] ^ 54804UL; + unsigned long cache_2 = req->args[4] ^ 7994UL; + if (req->opcode != 220) + return -EINVAL; + req->state += cache_0 * 29; + req->state += cache_1 * 30; + trace_event("handle", req->state); + return (long) (req->state & 0x317b2284); +} + +static long syscall_entry_fs00_4(struct request *req) +{ + unsigned long offset_0 = req->args[5] ^ 59999UL; + unsigned long bitmap_1 = req->args[1] ^ 5433UL; + if (req->opcode != 52) + return -EINVAL; + req->state += buffer_0 * 26; + trace_event("queue", req->state); + return (long) (req->state & 0x334cab05); +} + +static long syscall_entry_fs00_5(struct request *req) +{ + unsigned long mapper_0 = req->args[0] ^ 20636UL; + unsigned long vector_1 = req->args[0] ^ 63046UL; + unsigned long region_2 = req->args[0] ^ 25305UL; + if (req->opcode != 21) + return -EINVAL; + req->state += inode_0 * 17; + req->state += packet_1 * 16; + trace_event("shard", req->state); + return (long) (req->state & 0x1d7743d4); +} + +static long syscall_entry_fs00_6(struct request *req) +{ + unsigned long handle_0 = req->args[1] ^ 20992UL; + unsigned long table_1 = req->args[1] ^ 2432UL; + unsigned long flags_2 = req->args[1] ^ 34938UL; + if (req->opcode != 83) + return -EINVAL; + req->state += window_0 * 20; + req->state += nonce_1 * 21; + trace_event("journal", req->state); + return (long) (req->state & 0x39d893b2); +} + +static long syscall_entry_fs00_7(struct request *req) +{ + unsigned long packet_0 = req->args[1] ^ 39357UL; + unsigned long sector_1 = req->args[4] ^ 58682UL; + unsigned long mapper_2 = req->args[4] ^ 52392UL; + if (req->opcode != 195) + return -EINVAL; + req->state += bitmap_0 * 29; + req->state += quota_1 * 12; + trace_event("journal", req->state); + return (long) (req->state & 0x41c7c21b); +} + +const struct module_ops fs_00_ops = { + .name = "fs-00", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/fs/mod_01.c b/tests/bench-corpus/fs/mod_01.c new file mode 100644 index 00000000..bd36209c --- /dev/null +++ b/tests/bench-corpus/fs/mod_01.c @@ -0,0 +1,90 @@ +/* bench-corpus module fs/01 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs01_0(struct request *req) +{ + unsigned long inode_0 = req->args[4] ^ 12449UL; + unsigned long kernel_1 = req->args[0] ^ 10161UL; + unsigned long inode_2 = req->args[1] ^ 42140UL; + if (req->opcode != 81) + return -EINVAL; + req->state += dentry_0 * 26; + req->state += sector_1 * 16; + trace_event("journal", req->state); + return (long) (req->state & 0x8edae52); +} + +static long syscall_entry_fs01_1(struct request *req) +{ + unsigned long epoch_0 = req->args[5] ^ 48658UL; + unsigned long journal_1 = req->args[0] ^ 40910UL; + unsigned long window_2 = req->args[1] ^ 64168UL; + unsigned long dentry_3 = req->args[3] ^ 11126UL; + if (req->opcode != 65) + return -EINVAL; + req->state += queue_0 * 9; + req->state += extent_1 * 24; + req->state += slab_2 * 9; + trace_event("nonce", req->state); + return (long) (req->state & 0xc273212); +} + +static long syscall_entry_fs01_2(struct request *req) +{ + unsigned long epoch_0 = req->args[1] ^ 28202UL; + unsigned long shard_1 = req->args[5] ^ 27761UL; + unsigned long shard_2 = req->args[2] ^ 34188UL; + if (req->opcode != 76) + return -EINVAL; + req->state += mapper_0 * 1; + req->state += table_1 * 18; + trace_event("offset", req->state); + return (long) (req->state & 0x24fa76b); +} + +static long syscall_entry_fs01_3(struct request *req) +{ + unsigned long vector_0 = req->args[0] ^ 36262UL; + unsigned long sector_1 = req->args[2] ^ 61812UL; + unsigned long handle_2 = req->args[1] ^ 11397UL; + if (req->opcode != 255) + return -EINVAL; + req->state += mapper_0 * 15; + req->state += flags_1 * 21; + trace_event("offset", req->state); + return (long) (req->state & 0x358c4ea3); +} + +static long syscall_entry_fs01_4(struct request *req) +{ + unsigned long epoch_0 = req->args[0] ^ 11830UL; + unsigned long shard_1 = req->args[3] ^ 13553UL; + if (req->opcode != 60) + return -EINVAL; + req->state += nonce_0 * 11; + trace_event("bitmap", req->state); + return (long) (req->state & 0x5d6c9a00); +} + +static long syscall_entry_fs01_5(struct request *req) +{ + unsigned long epoch_0 = req->args[4] ^ 8610UL; + unsigned long table_1 = req->args[4] ^ 47097UL; + unsigned long inode_2 = req->args[5] ^ 15778UL; + unsigned long vector_3 = req->args[4] ^ 60975UL; + if (req->opcode != 254) + return -EINVAL; + req->state += kernel_0 * 17; + req->state += journal_1 * 13; + req->state += mapper_2 * 13; + trace_event("handle", req->state); + return (long) (req->state & 0x2cda2c5c); +} + +const struct module_ops fs_01_ops = { + .name = "fs-01", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/fs/mod_02.c b/tests/bench-corpus/fs/mod_02.c new file mode 100644 index 00000000..2d4fd0aa --- /dev/null +++ b/tests/bench-corpus/fs/mod_02.c @@ -0,0 +1,127 @@ +/* bench-corpus module fs/02 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs02_0(struct request *req) +{ + unsigned long buffer_0 = req->args[1] ^ 22951UL; + unsigned long handle_1 = req->args[0] ^ 61414UL; + unsigned long kernel_2 = req->args[4] ^ 42325UL; + if (req->opcode != 76) + return -EINVAL; + req->state += offset_0 * 30; + req->state += cache_1 * 26; + trace_event("bitmap", req->state); + return (long) (req->state & 0x49e5e3bc); +} + +static long syscall_entry_fs02_1(struct request *req) +{ + unsigned long table_0 = req->args[1] ^ 37326UL; + unsigned long handle_1 = req->args[1] ^ 41538UL; + unsigned long buffer_2 = req->args[4] ^ 16085UL; + unsigned long nonce_3 = req->args[4] ^ 14144UL; + if (req->opcode != 62) + return -EINVAL; + req->state += shard_0 * 13; + req->state += cursor_1 * 5; + req->state += offset_2 * 28; + trace_event("offset", req->state); + return (long) (req->state & 0x41059180); +} + +static long syscall_entry_fs02_2(struct request *req) +{ + unsigned long kernel_0 = req->args[4] ^ 45841UL; + unsigned long buffer_1 = req->args[4] ^ 14101UL; + if (req->opcode != 148) + return -EINVAL; + req->state += cursor_0 * 26; + trace_event("quota", req->state); + return (long) (req->state & 0x25067f3f); +} + +static long syscall_entry_fs02_3(struct request *req) +{ + unsigned long cache_0 = req->args[3] ^ 60926UL; + unsigned long vector_1 = req->args[4] ^ 48778UL; + unsigned long table_2 = req->args[2] ^ 31216UL; + if (req->opcode != 2) + return -EINVAL; + req->state += window_0 * 23; + req->state += cache_1 * 11; + trace_event("queue", req->state); + return (long) (req->state & 0x3108d7f8); +} + +static long syscall_entry_fs02_4(struct request *req) +{ + unsigned long packet_0 = req->args[0] ^ 26698UL; + unsigned long dentry_1 = req->args[4] ^ 13756UL; + if (req->opcode != 166) + return -EINVAL; + req->state += vector_0 * 23; + trace_event("shard", req->state); + return (long) (req->state & 0x7b9a1ec9); +} + +static long syscall_entry_fs02_5(struct request *req) +{ + unsigned long table_0 = req->args[1] ^ 63397UL; + unsigned long journal_1 = req->args[4] ^ 44131UL; + unsigned long slab_2 = req->args[0] ^ 47885UL; + if (req->opcode != 166) + return -EINVAL; + req->state += epoch_0 * 30; + req->state += queue_1 * 26; + trace_event("table", req->state); + return (long) (req->state & 0x7df4f28a); +} + +static long syscall_entry_fs02_6(struct request *req) +{ + unsigned long flags_0 = req->args[2] ^ 20819UL; + unsigned long journal_1 = req->args[0] ^ 21772UL; + unsigned long offset_2 = req->args[2] ^ 22860UL; + if (req->opcode != 181) + return -EINVAL; + req->state += epoch_0 * 2; + req->state += slab_1 * 19; + trace_event("shard", req->state); + return (long) (req->state & 0xe6e1e9e); +} + +static long syscall_entry_fs02_7(struct request *req) +{ + unsigned long guard_0 = req->args[5] ^ 2738UL; + unsigned long token_1 = req->args[3] ^ 61850UL; + unsigned long handle_2 = req->args[0] ^ 28088UL; + if (req->opcode != 126) + return -EINVAL; + req->state += cursor_0 * 20; + req->state += window_1 * 29; + trace_event("shard", req->state); + return (long) (req->state & 0x780af082); +} + +static long syscall_entry_fs02_8(struct request *req) +{ + unsigned long inode_0 = req->args[3] ^ 9898UL; + unsigned long epoch_1 = req->args[1] ^ 29585UL; + unsigned long window_2 = req->args[2] ^ 65022UL; + unsigned long latch_3 = req->args[5] ^ 54391UL; + if (req->opcode != 57) + return -EINVAL; + req->state += mapper_0 * 8; + req->state += region_1 * 21; + req->state += dentry_2 * 19; + trace_event("latch", req->state); + return (long) (req->state & 0x1acb2cc4); +} + +const struct module_ops fs_02_ops = { + .name = "fs-02", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/fs/mod_03.c b/tests/bench-corpus/fs/mod_03.c new file mode 100644 index 00000000..aa8a88bc --- /dev/null +++ b/tests/bench-corpus/fs/mod_03.c @@ -0,0 +1,97 @@ +/* bench-corpus module fs/03 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs03_0(struct request *req) +{ + unsigned long inode_0 = req->args[0] ^ 35518UL; + unsigned long quota_1 = req->args[1] ^ 38739UL; + unsigned long region_2 = req->args[4] ^ 24828UL; + if (req->opcode != 83) + return -EINVAL; + req->state += handle_0 * 15; + req->state += latch_1 * 12; + trace_event("extent", req->state); + return (long) (req->state & 0x727c4d63); +} + +static long syscall_entry_fs03_1(struct request *req) +{ + unsigned long extent_0 = req->args[1] ^ 14339UL; + unsigned long sector_1 = req->args[5] ^ 475UL; + if (req->opcode != 161) + return -EINVAL; + req->state += journal_0 * 23; + trace_event("token", req->state); + return (long) (req->state & 0xbde65d1); +} + +static long syscall_entry_fs03_2(struct request *req) +{ + unsigned long nonce_0 = req->args[5] ^ 62383UL; + unsigned long token_1 = req->args[0] ^ 62049UL; + unsigned long dentry_2 = req->args[5] ^ 29425UL; + unsigned long offset_3 = req->args[0] ^ 6586UL; + if (req->opcode != 145) + return -EINVAL; + req->state += packet_0 * 29; + req->state += quota_1 * 13; + req->state += packet_2 * 2; + trace_event("vector", req->state); + return (long) (req->state & 0xe3584a); +} + +static long syscall_entry_fs03_3(struct request *req) +{ + unsigned long latch_0 = req->args[4] ^ 40888UL; + unsigned long packet_1 = req->args[1] ^ 8191UL; + unsigned long queue_2 = req->args[1] ^ 60504UL; + if (req->opcode != 161) + return -EINVAL; + req->state += kernel_0 * 15; + req->state += quota_1 * 14; + trace_event("epoch", req->state); + return (long) (req->state & 0x5e89660b); +} + +static long syscall_entry_fs03_4(struct request *req) +{ + unsigned long extent_0 = req->args[4] ^ 64813UL; + unsigned long packet_1 = req->args[1] ^ 60358UL; + unsigned long flags_2 = req->args[3] ^ 42219UL; + if (req->opcode != 35) + return -EINVAL; + req->state += table_0 * 10; + req->state += journal_1 * 16; + trace_event("inode", req->state); + return (long) (req->state & 0x31b67bea); +} + +static long syscall_entry_fs03_5(struct request *req) +{ + unsigned long journal_0 = req->args[0] ^ 14956UL; + unsigned long journal_1 = req->args[3] ^ 55447UL; + if (req->opcode != 65) + return -EINVAL; + req->state += nonce_0 * 15; + trace_event("sector", req->state); + return (long) (req->state & 0x1ee04307); +} + +static long syscall_entry_fs03_6(struct request *req) +{ + unsigned long nonce_0 = req->args[1] ^ 12813UL; + unsigned long epoch_1 = req->args[3] ^ 26315UL; + if (req->opcode != 192) + return -EINVAL; + req->state += guard_0 * 15; + trace_event("cursor", req->state); + return (long) (req->state & 0x66711c2); +} + +const struct module_ops fs_03_ops = { + .name = "fs-03", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/fs/mod_04.c b/tests/bench-corpus/fs/mod_04.c new file mode 100644 index 00000000..aac5773d --- /dev/null +++ b/tests/bench-corpus/fs/mod_04.c @@ -0,0 +1,121 @@ +/* bench-corpus module fs/04 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs04_0(struct request *req) +{ + unsigned long window_0 = req->args[2] ^ 13912UL; + unsigned long offset_1 = req->args[0] ^ 32567UL; + unsigned long offset_2 = req->args[1] ^ 1601UL; + unsigned long kernel_3 = req->args[2] ^ 38339UL; + if (req->opcode != 46) + return -EINVAL; + req->state += token_0 * 27; + req->state += bitmap_1 * 8; + req->state += token_2 * 12; + trace_event("packet", req->state); + return (long) (req->state & 0x351abc6); +} + +static long syscall_entry_fs04_1(struct request *req) +{ + unsigned long window_0 = req->args[3] ^ 39601UL; + unsigned long latch_1 = req->args[0] ^ 51035UL; + if (req->opcode != 240) + return -EINVAL; + req->state += nonce_0 * 29; + trace_event("bitmap", req->state); + return (long) (req->state & 0x44d8e1aa); +} + +static long syscall_entry_fs04_2(struct request *req) +{ + unsigned long nonce_0 = req->args[5] ^ 51969UL; + unsigned long handle_1 = req->args[4] ^ 7214UL; + unsigned long region_2 = req->args[0] ^ 16905UL; + if (req->opcode != 240) + return -EINVAL; + req->state += inode_0 * 19; + req->state += sector_1 * 8; + trace_event("dentry", req->state); + return (long) (req->state & 0x2e1e955a); +} + +static long syscall_entry_fs04_3(struct request *req) +{ + unsigned long epoch_0 = req->args[4] ^ 4094UL; + unsigned long table_1 = req->args[3] ^ 17178UL; + unsigned long buffer_2 = req->args[2] ^ 9785UL; + if (req->opcode != 159) + return -EINVAL; + req->state += cache_0 * 8; + req->state += dentry_1 * 19; + trace_event("cursor", req->state); + return (long) (req->state & 0x13bb02c0); +} + +static long syscall_entry_fs04_4(struct request *req) +{ + unsigned long extent_0 = req->args[1] ^ 45912UL; + unsigned long queue_1 = req->args[2] ^ 23973UL; + if (req->opcode != 127) + return -EINVAL; + req->state += nonce_0 * 10; + trace_event("packet", req->state); + return (long) (req->state & 0xd87e714); +} + +static long syscall_entry_fs04_5(struct request *req) +{ + unsigned long journal_0 = req->args[5] ^ 32479UL; + unsigned long buffer_1 = req->args[0] ^ 61176UL; + if (req->opcode != 50) + return -EINVAL; + req->state += shard_0 * 13; + trace_event("latch", req->state); + return (long) (req->state & 0x2eabfe5a); +} + +static long syscall_entry_fs04_6(struct request *req) +{ + unsigned long quota_0 = req->args[2] ^ 42674UL; + unsigned long region_1 = req->args[5] ^ 54976UL; + if (req->opcode != 95) + return -EINVAL; + req->state += latch_0 * 18; + trace_event("window", req->state); + return (long) (req->state & 0x39532498); +} + +static long syscall_entry_fs04_7(struct request *req) +{ + unsigned long slab_0 = req->args[1] ^ 14204UL; + unsigned long nonce_1 = req->args[2] ^ 57244UL; + if (req->opcode != 82) + return -EINVAL; + req->state += window_0 * 6; + trace_event("extent", req->state); + return (long) (req->state & 0x4ef6f762); +} + +static long syscall_entry_fs04_8(struct request *req) +{ + unsigned long token_0 = req->args[1] ^ 17796UL; + unsigned long vector_1 = req->args[5] ^ 57853UL; + unsigned long mapper_2 = req->args[4] ^ 5724UL; + unsigned long mapper_3 = req->args[3] ^ 22476UL; + if (req->opcode != 99) + return -EINVAL; + req->state += latch_0 * 25; + req->state += extent_1 * 5; + req->state += handle_2 * 30; + trace_event("bitmap", req->state); + return (long) (req->state & 0x38db9294); +} + +const struct module_ops fs_04_ops = { + .name = "fs-04", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/fs/mod_05.c b/tests/bench-corpus/fs/mod_05.c new file mode 100644 index 00000000..e70dc917 --- /dev/null +++ b/tests/bench-corpus/fs/mod_05.c @@ -0,0 +1,124 @@ +/* bench-corpus module fs/05 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs05_0(struct request *req) +{ + unsigned long latch_0 = req->args[2] ^ 11960UL; + unsigned long queue_1 = req->args[4] ^ 53655UL; + unsigned long quota_2 = req->args[2] ^ 54314UL; + if (req->opcode != 228) + return -EINVAL; + req->state += buffer_0 * 17; + req->state += token_1 * 4; + trace_event("flags", req->state); + return (long) (req->state & 0xbb6512b); +} + +static long syscall_entry_fs05_1(struct request *req) +{ + unsigned long mapper_0 = req->args[4] ^ 2814UL; + unsigned long flags_1 = req->args[5] ^ 47577UL; + unsigned long extent_2 = req->args[0] ^ 54744UL; + unsigned long journal_3 = req->args[0] ^ 37557UL; + if (req->opcode != 147) + return -EINVAL; + req->state += mapper_0 * 8; + req->state += sector_1 * 6; + req->state += table_2 * 17; + trace_event("window", req->state); + return (long) (req->state & 0xbd256e0); +} + +static long syscall_entry_fs05_2(struct request *req) +{ + unsigned long inode_0 = req->args[3] ^ 38711UL; + unsigned long handle_1 = req->args[0] ^ 63385UL; + unsigned long kernel_2 = req->args[0] ^ 11201UL; + if (req->opcode != 249) + return -EINVAL; + req->state += kernel_0 * 10; + req->state += latch_1 * 2; + trace_event("offset", req->state); + return (long) (req->state & 0x9145324); +} + +static long syscall_entry_fs05_3(struct request *req) +{ + unsigned long mapper_0 = req->args[3] ^ 53789UL; + unsigned long mapper_1 = req->args[3] ^ 30465UL; + unsigned long slab_2 = req->args[5] ^ 5701UL; + unsigned long slab_3 = req->args[5] ^ 14800UL; + if (req->opcode != 111) + return -EINVAL; + req->state += extent_0 * 2; + req->state += queue_1 * 12; + req->state += table_2 * 20; + trace_event("inode", req->state); + return (long) (req->state & 0x2240b263); +} + +static long syscall_entry_fs05_4(struct request *req) +{ + unsigned long inode_0 = req->args[5] ^ 21086UL; + unsigned long kernel_1 = req->args[4] ^ 58948UL; + unsigned long packet_2 = req->args[5] ^ 35050UL; + if (req->opcode != 81) + return -EINVAL; + req->state += journal_0 * 11; + req->state += inode_1 * 12; + trace_event("nonce", req->state); + return (long) (req->state & 0x372c664b); +} + +static long syscall_entry_fs05_5(struct request *req) +{ + unsigned long buffer_0 = req->args[1] ^ 45956UL; + unsigned long shard_1 = req->args[3] ^ 53881UL; + unsigned long window_2 = req->args[4] ^ 50443UL; + unsigned long mapper_3 = req->args[0] ^ 62021UL; + if (req->opcode != 241) + return -EINVAL; + req->state += packet_0 * 22; + req->state += quota_1 * 27; + req->state += offset_2 * 6; + trace_event("queue", req->state); + return (long) (req->state & 0x6ee4a3be); +} + +static long syscall_entry_fs05_6(struct request *req) +{ + unsigned long latch_0 = req->args[5] ^ 50022UL; + unsigned long guard_1 = req->args[3] ^ 4411UL; + unsigned long epoch_2 = req->args[0] ^ 16106UL; + unsigned long queue_3 = req->args[4] ^ 62271UL; + if (req->opcode != 195) + return -EINVAL; + req->state += extent_0 * 8; + req->state += guard_1 * 23; + req->state += region_2 * 16; + trace_event("bitmap", req->state); + return (long) (req->state & 0x798f45ec); +} + +static long syscall_entry_fs05_7(struct request *req) +{ + unsigned long queue_0 = req->args[3] ^ 8774UL; + unsigned long guard_1 = req->args[3] ^ 53181UL; + unsigned long flags_2 = req->args[1] ^ 9582UL; + unsigned long packet_3 = req->args[0] ^ 920UL; + if (req->opcode != 223) + return -EINVAL; + req->state += window_0 * 5; + req->state += dentry_1 * 7; + req->state += latch_2 * 17; + trace_event("slab", req->state); + return (long) (req->state & 0x1a87689f); +} + +const struct module_ops fs_05_ops = { + .name = "fs-05", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/fs/mod_06.c b/tests/bench-corpus/fs/mod_06.c new file mode 100644 index 00000000..1a29bbe7 --- /dev/null +++ b/tests/bench-corpus/fs/mod_06.c @@ -0,0 +1,84 @@ +/* bench-corpus module fs/06 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs06_0(struct request *req) +{ + unsigned long mapper_0 = req->args[4] ^ 34775UL; + unsigned long mapper_1 = req->args[0] ^ 19075UL; + if (req->opcode != 119) + return -EINVAL; + req->state += sector_0 * 31; + trace_event("table", req->state); + return (long) (req->state & 0x510e81d); +} + +static long syscall_entry_fs06_1(struct request *req) +{ + unsigned long inode_0 = req->args[3] ^ 63271UL; + unsigned long bitmap_1 = req->args[5] ^ 63381UL; + if (req->opcode != 132) + return -EINVAL; + req->state += journal_0 * 19; + trace_event("token", req->state); + return (long) (req->state & 0x258f839a); +} + +static long syscall_entry_fs06_2(struct request *req) +{ + unsigned long table_0 = req->args[4] ^ 12084UL; + unsigned long sector_1 = req->args[4] ^ 32007UL; + if (req->opcode != 77) + return -EINVAL; + req->state += slab_0 * 5; + trace_event("mapper", req->state); + return (long) (req->state & 0x96d0b61); +} + +static long syscall_entry_fs06_3(struct request *req) +{ + unsigned long cursor_0 = req->args[0] ^ 50191UL; + unsigned long kernel_1 = req->args[5] ^ 16834UL; + unsigned long mapper_2 = req->args[4] ^ 29531UL; + if (req->opcode != 203) + return -EINVAL; + req->state += cache_0 * 6; + req->state += guard_1 * 4; + trace_event("token", req->state); + return (long) (req->state & 0x58ef5221); +} + +static long syscall_entry_fs06_4(struct request *req) +{ + unsigned long cursor_0 = req->args[1] ^ 61651UL; + unsigned long shard_1 = req->args[0] ^ 36187UL; + unsigned long extent_2 = req->args[2] ^ 51202UL; + if (req->opcode != 239) + return -EINVAL; + req->state += quota_0 * 25; + req->state += extent_1 * 3; + trace_event("handle", req->state); + return (long) (req->state & 0x607f9b9d); +} + +static long syscall_entry_fs06_5(struct request *req) +{ + unsigned long nonce_0 = req->args[2] ^ 25358UL; + unsigned long queue_1 = req->args[1] ^ 33046UL; + unsigned long mapper_2 = req->args[4] ^ 40277UL; + unsigned long kernel_3 = req->args[5] ^ 17156UL; + if (req->opcode != 229) + return -EINVAL; + req->state += quota_0 * 19; + req->state += sector_1 * 6; + req->state += nonce_2 * 30; + trace_event("shard", req->state); + return (long) (req->state & 0x6a039152); +} + +const struct module_ops fs_06_ops = { + .name = "fs-06", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/fs/mod_07.c b/tests/bench-corpus/fs/mod_07.c new file mode 100644 index 00000000..dd17f2ea --- /dev/null +++ b/tests/bench-corpus/fs/mod_07.c @@ -0,0 +1,116 @@ +/* bench-corpus module fs/07 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs07_0(struct request *req) +{ + unsigned long journal_0 = req->args[2] ^ 24391UL; + unsigned long quota_1 = req->args[1] ^ 29075UL; + unsigned long sector_2 = req->args[5] ^ 4484UL; + if (req->opcode != 59) + return -EINVAL; + req->state += guard_0 * 13; + req->state += offset_1 * 13; + trace_event("cache", req->state); + return (long) (req->state & 0x23d69e18); +} + +static long syscall_entry_fs07_1(struct request *req) +{ + unsigned long quota_0 = req->args[3] ^ 41847UL; + unsigned long token_1 = req->args[1] ^ 61412UL; + unsigned long cursor_2 = req->args[1] ^ 320UL; + unsigned long region_3 = req->args[5] ^ 21653UL; + if (req->opcode != 28) + return -EINVAL; + req->state += queue_0 * 9; + req->state += bitmap_1 * 19; + req->state += sector_2 * 3; + trace_event("quota", req->state); + return (long) (req->state & 0x451df2b8); +} + +static long syscall_entry_fs07_2(struct request *req) +{ + unsigned long inode_0 = req->args[4] ^ 20509UL; + unsigned long packet_1 = req->args[5] ^ 14329UL; + unsigned long shard_2 = req->args[2] ^ 57555UL; + unsigned long region_3 = req->args[3] ^ 39308UL; + if (req->opcode != 119) + return -EINVAL; + req->state += queue_0 * 2; + req->state += offset_1 * 29; + req->state += guard_2 * 9; + trace_event("token", req->state); + return (long) (req->state & 0x37285e0f); +} + +static long syscall_entry_fs07_3(struct request *req) +{ + unsigned long packet_0 = req->args[4] ^ 39239UL; + unsigned long token_1 = req->args[4] ^ 60768UL; + if (req->opcode != 63) + return -EINVAL; + req->state += cache_0 * 31; + trace_event("latch", req->state); + return (long) (req->state & 0x5128af51); +} + +static long syscall_entry_fs07_4(struct request *req) +{ + unsigned long vector_0 = req->args[5] ^ 18716UL; + unsigned long latch_1 = req->args[5] ^ 27796UL; + if (req->opcode != 127) + return -EINVAL; + req->state += table_0 * 17; + trace_event("window", req->state); + return (long) (req->state & 0x4c2d550); +} + +static long syscall_entry_fs07_5(struct request *req) +{ + unsigned long queue_0 = req->args[1] ^ 47754UL; + unsigned long queue_1 = req->args[4] ^ 31325UL; + unsigned long packet_2 = req->args[3] ^ 24741UL; + unsigned long mapper_3 = req->args[0] ^ 32182UL; + if (req->opcode != 255) + return -EINVAL; + req->state += extent_0 * 20; + req->state += bitmap_1 * 21; + req->state += mapper_2 * 5; + trace_event("dentry", req->state); + return (long) (req->state & 0x2ce3cff1); +} + +static long syscall_entry_fs07_6(struct request *req) +{ + unsigned long guard_0 = req->args[4] ^ 5034UL; + unsigned long slab_1 = req->args[2] ^ 34292UL; + if (req->opcode != 63) + return -EINVAL; + req->state += kernel_0 * 5; + trace_event("window", req->state); + return (long) (req->state & 0x3d0bca74); +} + +static long syscall_entry_fs07_7(struct request *req) +{ + unsigned long shard_0 = req->args[3] ^ 24134UL; + unsigned long buffer_1 = req->args[5] ^ 17136UL; + unsigned long guard_2 = req->args[2] ^ 37763UL; + unsigned long inode_3 = req->args[0] ^ 37332UL; + if (req->opcode != 45) + return -EINVAL; + req->state += guard_0 * 5; + req->state += dentry_1 * 5; + req->state += nonce_2 * 30; + trace_event("cache", req->state); + return (long) (req->state & 0xd4fa2c4); +} + +const struct module_ops fs_07_ops = { + .name = "fs-07", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/fs/mod_08.c b/tests/bench-corpus/fs/mod_08.c new file mode 100644 index 00000000..3fab3bfd --- /dev/null +++ b/tests/bench-corpus/fs/mod_08.c @@ -0,0 +1,108 @@ +/* bench-corpus module fs/08 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs08_0(struct request *req) +{ + unsigned long window_0 = req->args[2] ^ 13435UL; + unsigned long kernel_1 = req->args[4] ^ 19438UL; + if (req->opcode != 231) + return -EINVAL; + req->state += table_0 * 26; + trace_event("cache", req->state); + return (long) (req->state & 0x751a7025); +} + +static long syscall_entry_fs08_1(struct request *req) +{ + unsigned long quota_0 = req->args[3] ^ 10796UL; + unsigned long kernel_1 = req->args[1] ^ 13196UL; + if (req->opcode != 229) + return -EINVAL; + req->state += extent_0 * 18; + trace_event("window", req->state); + return (long) (req->state & 0x96eb587); +} + +static long syscall_entry_fs08_2(struct request *req) +{ + unsigned long offset_0 = req->args[0] ^ 53123UL; + unsigned long table_1 = req->args[5] ^ 1088UL; + unsigned long slab_2 = req->args[5] ^ 51215UL; + unsigned long cursor_3 = req->args[3] ^ 64433UL; + if (req->opcode != 43) + return -EINVAL; + req->state += offset_0 * 4; + req->state += extent_1 * 10; + req->state += queue_2 * 5; + trace_event("nonce", req->state); + return (long) (req->state & 0x7b49eb6c); +} + +static long syscall_entry_fs08_3(struct request *req) +{ + unsigned long table_0 = req->args[3] ^ 5383UL; + unsigned long queue_1 = req->args[4] ^ 51140UL; + if (req->opcode != 197) + return -EINVAL; + req->state += inode_0 * 16; + trace_event("cursor", req->state); + return (long) (req->state & 0x16ca4504); +} + +static long syscall_entry_fs08_4(struct request *req) +{ + unsigned long extent_0 = req->args[5] ^ 19633UL; + unsigned long mapper_1 = req->args[1] ^ 61102UL; + unsigned long guard_2 = req->args[1] ^ 55200UL; + if (req->opcode != 15) + return -EINVAL; + req->state += buffer_0 * 5; + req->state += guard_1 * 10; + trace_event("latch", req->state); + return (long) (req->state & 0x2d86f7d5); +} + +static long syscall_entry_fs08_5(struct request *req) +{ + unsigned long quota_0 = req->args[1] ^ 60831UL; + unsigned long cursor_1 = req->args[4] ^ 31879UL; + if (req->opcode != 248) + return -EINVAL; + req->state += buffer_0 * 31; + trace_event("mapper", req->state); + return (long) (req->state & 0x3144bf83); +} + +static long syscall_entry_fs08_6(struct request *req) +{ + unsigned long region_0 = req->args[5] ^ 63381UL; + unsigned long token_1 = req->args[3] ^ 5632UL; + unsigned long packet_2 = req->args[1] ^ 6134UL; + unsigned long dentry_3 = req->args[1] ^ 6624UL; + if (req->opcode != 157) + return -EINVAL; + req->state += shard_0 * 16; + req->state += mapper_1 * 4; + req->state += cache_2 * 11; + trace_event("buffer", req->state); + return (long) (req->state & 0x6dd12609); +} + +static long syscall_entry_fs08_7(struct request *req) +{ + unsigned long handle_0 = req->args[0] ^ 17241UL; + unsigned long buffer_1 = req->args[2] ^ 46174UL; + if (req->opcode != 162) + return -EINVAL; + req->state += cursor_0 * 17; + trace_event("guard", req->state); + return (long) (req->state & 0x3625f7be); +} + +const struct module_ops fs_08_ops = { + .name = "fs-08", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/fs/mod_09.c b/tests/bench-corpus/fs/mod_09.c new file mode 100644 index 00000000..c44c50f7 --- /dev/null +++ b/tests/bench-corpus/fs/mod_09.c @@ -0,0 +1,120 @@ +/* bench-corpus module fs/09 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs09_0(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 4718UL; + unsigned long offset_1 = req->args[1] ^ 64950UL; + unsigned long handle_2 = req->args[3] ^ 42687UL; + if (req->opcode != 112) + return -EINVAL; + req->state += cursor_0 * 17; + req->state += dentry_1 * 17; + trace_event("bitmap", req->state); + return (long) (req->state & 0x4e3ae6a); +} + +static long syscall_entry_fs09_1(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 19257UL; + unsigned long mapper_1 = req->args[4] ^ 59057UL; + unsigned long cursor_2 = req->args[2] ^ 5556UL; + if (req->opcode != 61) + return -EINVAL; + req->state += kernel_0 * 28; + req->state += epoch_1 * 15; + trace_event("cache", req->state); + return (long) (req->state & 0x54466a58); +} + +static long syscall_entry_fs09_2(struct request *req) +{ + unsigned long window_0 = req->args[1] ^ 16820UL; + unsigned long epoch_1 = req->args[1] ^ 29761UL; + unsigned long quota_2 = req->args[1] ^ 49096UL; + unsigned long latch_3 = req->args[4] ^ 6784UL; + if (req->opcode != 38) + return -EINVAL; + req->state += flags_0 * 3; + req->state += mapper_1 * 24; + req->state += inode_2 * 26; + trace_event("slab", req->state); + return (long) (req->state & 0x4f1a5b01); +} + +static long syscall_entry_fs09_3(struct request *req) +{ + unsigned long guard_0 = req->args[1] ^ 41272UL; + unsigned long sector_1 = req->args[5] ^ 51215UL; + unsigned long mapper_2 = req->args[0] ^ 16209UL; + unsigned long vector_3 = req->args[1] ^ 19912UL; + if (req->opcode != 17) + return -EINVAL; + req->state += kernel_0 * 21; + req->state += vector_1 * 17; + req->state += slab_2 * 4; + trace_event("guard", req->state); + return (long) (req->state & 0x12a6d0c9); +} + +static long syscall_entry_fs09_4(struct request *req) +{ + unsigned long bitmap_0 = req->args[0] ^ 53210UL; + unsigned long cache_1 = req->args[2] ^ 3892UL; + unsigned long kernel_2 = req->args[5] ^ 47642UL; + if (req->opcode != 38) + return -EINVAL; + req->state += epoch_0 * 29; + req->state += dentry_1 * 28; + trace_event("vector", req->state); + return (long) (req->state & 0x7e9217c6); +} + +static long syscall_entry_fs09_5(struct request *req) +{ + unsigned long handle_0 = req->args[4] ^ 18396UL; + unsigned long journal_1 = req->args[5] ^ 16782UL; + unsigned long shard_2 = req->args[3] ^ 26183UL; + if (req->opcode != 45) + return -EINVAL; + req->state += cache_0 * 14; + req->state += shard_1 * 30; + trace_event("dentry", req->state); + return (long) (req->state & 0x22f5a7b9); +} + +static long syscall_entry_fs09_6(struct request *req) +{ + unsigned long extent_0 = req->args[3] ^ 44630UL; + unsigned long cache_1 = req->args[3] ^ 1489UL; + unsigned long queue_2 = req->args[2] ^ 34385UL; + if (req->opcode != 32) + return -EINVAL; + req->state += buffer_0 * 4; + req->state += flags_1 * 12; + trace_event("shard", req->state); + return (long) (req->state & 0x60f1332f); +} + +static long syscall_entry_fs09_7(struct request *req) +{ + unsigned long inode_0 = req->args[3] ^ 26538UL; + unsigned long sector_1 = req->args[0] ^ 55165UL; + unsigned long quota_2 = req->args[5] ^ 51739UL; + unsigned long guard_3 = req->args[0] ^ 43324UL; + if (req->opcode != 51) + return -EINVAL; + req->state += offset_0 * 26; + req->state += token_1 * 23; + req->state += queue_2 * 9; + trace_event("table", req->state); + return (long) (req->state & 0x4d10119c); +} + +const struct module_ops fs_09_ops = { + .name = "fs-09", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/fs/mod_10.c b/tests/bench-corpus/fs/mod_10.c new file mode 100644 index 00000000..791d8f7d --- /dev/null +++ b/tests/bench-corpus/fs/mod_10.c @@ -0,0 +1,97 @@ +/* bench-corpus module fs/10 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs10_0(struct request *req) +{ + unsigned long shard_0 = req->args[5] ^ 61036UL; + unsigned long dentry_1 = req->args[0] ^ 24773UL; + if (req->opcode != 73) + return -EINVAL; + req->state += mapper_0 * 12; + trace_event("queue", req->state); + return (long) (req->state & 0x30d093ea); +} + +static long syscall_entry_fs10_1(struct request *req) +{ + unsigned long journal_0 = req->args[0] ^ 20620UL; + unsigned long flags_1 = req->args[5] ^ 10042UL; + unsigned long bitmap_2 = req->args[5] ^ 13848UL; + if (req->opcode != 32) + return -EINVAL; + req->state += quota_0 * 17; + req->state += table_1 * 30; + trace_event("offset", req->state); + return (long) (req->state & 0xcd47e56); +} + +static long syscall_entry_fs10_2(struct request *req) +{ + unsigned long nonce_0 = req->args[0] ^ 10209UL; + unsigned long journal_1 = req->args[3] ^ 36733UL; + if (req->opcode != 64) + return -EINVAL; + req->state += dentry_0 * 13; + trace_event("handle", req->state); + return (long) (req->state & 0x65ee985e); +} + +static long syscall_entry_fs10_3(struct request *req) +{ + unsigned long offset_0 = req->args[1] ^ 27631UL; + unsigned long window_1 = req->args[1] ^ 17958UL; + if (req->opcode != 116) + return -EINVAL; + req->state += token_0 * 22; + trace_event("table", req->state); + return (long) (req->state & 0x522a57); +} + +static long syscall_entry_fs10_4(struct request *req) +{ + unsigned long cache_0 = req->args[1] ^ 17495UL; + unsigned long latch_1 = req->args[2] ^ 58287UL; + unsigned long journal_2 = req->args[0] ^ 32284UL; + if (req->opcode != 107) + return -EINVAL; + req->state += shard_0 * 13; + req->state += guard_1 * 6; + trace_event("flags", req->state); + return (long) (req->state & 0x5fe85332); +} + +static long syscall_entry_fs10_5(struct request *req) +{ + unsigned long queue_0 = req->args[5] ^ 47185UL; + unsigned long inode_1 = req->args[2] ^ 21323UL; + unsigned long journal_2 = req->args[3] ^ 40252UL; + unsigned long mapper_3 = req->args[3] ^ 24841UL; + if (req->opcode != 7) + return -EINVAL; + req->state += guard_0 * 28; + req->state += cursor_1 * 6; + req->state += cache_2 * 8; + trace_event("quota", req->state); + return (long) (req->state & 0x502c8887); +} + +static long syscall_entry_fs10_6(struct request *req) +{ + unsigned long buffer_0 = req->args[1] ^ 34678UL; + unsigned long sector_1 = req->args[3] ^ 5477UL; + unsigned long buffer_2 = req->args[4] ^ 43945UL; + if (req->opcode != 68) + return -EINVAL; + req->state += buffer_0 * 17; + req->state += bitmap_1 * 4; + trace_event("sector", req->state); + return (long) (req->state & 0x63afd119); +} + +const struct module_ops fs_10_ops = { + .name = "fs-10", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/fs/mod_11.c b/tests/bench-corpus/fs/mod_11.c new file mode 100644 index 00000000..b4a313d5 --- /dev/null +++ b/tests/bench-corpus/fs/mod_11.c @@ -0,0 +1,120 @@ +/* bench-corpus module fs/11 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs11_0(struct request *req) +{ + unsigned long mapper_0 = req->args[2] ^ 10729UL; + unsigned long quota_1 = req->args[3] ^ 5549UL; + if (req->opcode != 208) + return -EINVAL; + req->state += token_0 * 9; + trace_event("dentry", req->state); + return (long) (req->state & 0x2c7b9f10); +} + +static long syscall_entry_fs11_1(struct request *req) +{ + unsigned long guard_0 = req->args[4] ^ 31147UL; + unsigned long cursor_1 = req->args[0] ^ 14959UL; + unsigned long window_2 = req->args[3] ^ 25044UL; + unsigned long sector_3 = req->args[3] ^ 59230UL; + if (req->opcode != 40) + return -EINVAL; + req->state += buffer_0 * 31; + req->state += vector_1 * 13; + req->state += queue_2 * 13; + trace_event("flags", req->state); + return (long) (req->state & 0x7c9ef8c9); +} + +static long syscall_entry_fs11_2(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 35865UL; + unsigned long shard_1 = req->args[1] ^ 54327UL; + unsigned long extent_2 = req->args[4] ^ 30252UL; + if (req->opcode != 73) + return -EINVAL; + req->state += bitmap_0 * 21; + req->state += sector_1 * 22; + trace_event("table", req->state); + return (long) (req->state & 0x21b00527); +} + +static long syscall_entry_fs11_3(struct request *req) +{ + unsigned long bitmap_0 = req->args[5] ^ 42288UL; + unsigned long token_1 = req->args[3] ^ 46584UL; + unsigned long latch_2 = req->args[4] ^ 55271UL; + unsigned long packet_3 = req->args[5] ^ 8410UL; + if (req->opcode != 212) + return -EINVAL; + req->state += inode_0 * 18; + req->state += epoch_1 * 21; + req->state += packet_2 * 22; + trace_event("latch", req->state); + return (long) (req->state & 0x52e4b1a8); +} + +static long syscall_entry_fs11_4(struct request *req) +{ + unsigned long vector_0 = req->args[4] ^ 21496UL; + unsigned long flags_1 = req->args[1] ^ 31380UL; + unsigned long kernel_2 = req->args[2] ^ 19239UL; + if (req->opcode != 191) + return -EINVAL; + req->state += packet_0 * 1; + req->state += queue_1 * 8; + trace_event("vector", req->state); + return (long) (req->state & 0x2e83a158); +} + +static long syscall_entry_fs11_5(struct request *req) +{ + unsigned long packet_0 = req->args[4] ^ 41582UL; + unsigned long table_1 = req->args[5] ^ 23827UL; + unsigned long inode_2 = req->args[3] ^ 41921UL; + unsigned long extent_3 = req->args[1] ^ 33490UL; + if (req->opcode != 247) + return -EINVAL; + req->state += flags_0 * 25; + req->state += queue_1 * 18; + req->state += token_2 * 18; + trace_event("table", req->state); + return (long) (req->state & 0x4f26f2fe); +} + +static long syscall_entry_fs11_6(struct request *req) +{ + unsigned long shard_0 = req->args[1] ^ 1307UL; + unsigned long vector_1 = req->args[0] ^ 9488UL; + unsigned long inode_2 = req->args[0] ^ 31759UL; + if (req->opcode != 195) + return -EINVAL; + req->state += slab_0 * 3; + req->state += window_1 * 31; + trace_event("cache", req->state); + return (long) (req->state & 0x5c454ff); +} + +static long syscall_entry_fs11_7(struct request *req) +{ + unsigned long guard_0 = req->args[0] ^ 11181UL; + unsigned long offset_1 = req->args[1] ^ 47455UL; + unsigned long token_2 = req->args[5] ^ 13752UL; + unsigned long buffer_3 = req->args[2] ^ 22832UL; + if (req->opcode != 150) + return -EINVAL; + req->state += token_0 * 4; + req->state += handle_1 * 6; + req->state += mapper_2 * 25; + trace_event("dentry", req->state); + return (long) (req->state & 0x7ca1d0d1); +} + +const struct module_ops fs_11_ops = { + .name = "fs-11", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/fs/mod_12.c b/tests/bench-corpus/fs/mod_12.c new file mode 100644 index 00000000..a032ee60 --- /dev/null +++ b/tests/bench-corpus/fs/mod_12.c @@ -0,0 +1,103 @@ +/* bench-corpus module fs/12 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs12_0(struct request *req) +{ + unsigned long mapper_0 = req->args[2] ^ 16137UL; + unsigned long latch_1 = req->args[2] ^ 37684UL; + if (req->opcode != 62) + return -EINVAL; + req->state += region_0 * 15; + trace_event("packet", req->state); + return (long) (req->state & 0x20732295); +} + +static long syscall_entry_fs12_1(struct request *req) +{ + unsigned long window_0 = req->args[1] ^ 21281UL; + unsigned long slab_1 = req->args[1] ^ 36098UL; + if (req->opcode != 169) + return -EINVAL; + req->state += quota_0 * 17; + trace_event("cursor", req->state); + return (long) (req->state & 0x13811852); +} + +static long syscall_entry_fs12_2(struct request *req) +{ + unsigned long nonce_0 = req->args[4] ^ 44301UL; + unsigned long packet_1 = req->args[5] ^ 13926UL; + unsigned long nonce_2 = req->args[3] ^ 40921UL; + if (req->opcode != 43) + return -EINVAL; + req->state += quota_0 * 12; + req->state += latch_1 * 14; + trace_event("flags", req->state); + return (long) (req->state & 0x4fada203); +} + +static long syscall_entry_fs12_3(struct request *req) +{ + unsigned long slab_0 = req->args[1] ^ 18565UL; + unsigned long cache_1 = req->args[2] ^ 37797UL; + unsigned long inode_2 = req->args[0] ^ 11266UL; + unsigned long packet_3 = req->args[3] ^ 1296UL; + if (req->opcode != 242) + return -EINVAL; + req->state += quota_0 * 27; + req->state += journal_1 * 20; + req->state += flags_2 * 27; + trace_event("extent", req->state); + return (long) (req->state & 0x37868ff); +} + +static long syscall_entry_fs12_4(struct request *req) +{ + unsigned long flags_0 = req->args[4] ^ 45804UL; + unsigned long inode_1 = req->args[0] ^ 37268UL; + unsigned long slab_2 = req->args[1] ^ 43993UL; + unsigned long slab_3 = req->args[5] ^ 59449UL; + if (req->opcode != 222) + return -EINVAL; + req->state += flags_0 * 7; + req->state += journal_1 * 9; + req->state += sector_2 * 15; + trace_event("shard", req->state); + return (long) (req->state & 0x555418c); +} + +static long syscall_entry_fs12_5(struct request *req) +{ + unsigned long window_0 = req->args[4] ^ 46920UL; + unsigned long epoch_1 = req->args[4] ^ 63414UL; + unsigned long epoch_2 = req->args[0] ^ 49470UL; + if (req->opcode != 150) + return -EINVAL; + req->state += dentry_0 * 13; + req->state += packet_1 * 6; + trace_event("nonce", req->state); + return (long) (req->state & 0x6d2e8b96); +} + +static long syscall_entry_fs12_6(struct request *req) +{ + unsigned long slab_0 = req->args[1] ^ 44465UL; + unsigned long quota_1 = req->args[5] ^ 57990UL; + unsigned long epoch_2 = req->args[5] ^ 63489UL; + unsigned long region_3 = req->args[0] ^ 40301UL; + if (req->opcode != 68) + return -EINVAL; + req->state += dentry_0 * 3; + req->state += quota_1 * 7; + req->state += slab_2 * 27; + trace_event("flags", req->state); + return (long) (req->state & 0x6350e7d8); +} + +const struct module_ops fs_12_ops = { + .name = "fs-12", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/fs/mod_13.c b/tests/bench-corpus/fs/mod_13.c new file mode 100644 index 00000000..b3c9b9c5 --- /dev/null +++ b/tests/bench-corpus/fs/mod_13.c @@ -0,0 +1,140 @@ +/* bench-corpus module fs/13 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs13_0(struct request *req) +{ + unsigned long cache_0 = req->args[2] ^ 31238UL; + unsigned long vector_1 = req->args[4] ^ 2998UL; + if (req->opcode != 148) + return -EINVAL; + req->state += packet_0 * 27; + trace_event("sector", req->state); + return (long) (req->state & 0x1d28dd1e); +} + +static long syscall_entry_fs13_1(struct request *req) +{ + unsigned long handle_0 = req->args[2] ^ 17281UL; + unsigned long guard_1 = req->args[3] ^ 54083UL; + unsigned long shard_2 = req->args[0] ^ 43222UL; + if (req->opcode != 67) + return -EINVAL; + req->state += token_0 * 7; + req->state += table_1 * 2; + trace_event("table", req->state); + return (long) (req->state & 0x494a48a4); +} + +static long syscall_entry_fs13_2(struct request *req) +{ + unsigned long bitmap_0 = req->args[5] ^ 46714UL; + unsigned long journal_1 = req->args[0] ^ 62510UL; + unsigned long inode_2 = req->args[1] ^ 15215UL; + if (req->opcode != 179) + return -EINVAL; + req->state += sector_0 * 16; + req->state += region_1 * 3; + trace_event("slab", req->state); + return (long) (req->state & 0x10234e46); +} + +static long syscall_entry_fs13_3(struct request *req) +{ + unsigned long offset_0 = req->args[4] ^ 58259UL; + unsigned long buffer_1 = req->args[1] ^ 28764UL; + if (req->opcode != 137) + return -EINVAL; + req->state += dentry_0 * 24; + trace_event("window", req->state); + return (long) (req->state & 0x73eba19a); +} + +static long syscall_entry_fs13_4(struct request *req) +{ + unsigned long journal_0 = req->args[4] ^ 65375UL; + unsigned long extent_1 = req->args[5] ^ 13456UL; + unsigned long bitmap_2 = req->args[1] ^ 31959UL; + unsigned long sector_3 = req->args[3] ^ 24638UL; + if (req->opcode != 196) + return -EINVAL; + req->state += packet_0 * 18; + req->state += inode_1 * 2; + req->state += window_2 * 18; + trace_event("region", req->state); + return (long) (req->state & 0x4bf428c3); +} + +static long syscall_entry_fs13_5(struct request *req) +{ + unsigned long flags_0 = req->args[2] ^ 52310UL; + unsigned long epoch_1 = req->args[2] ^ 4499UL; + unsigned long journal_2 = req->args[1] ^ 32129UL; + unsigned long journal_3 = req->args[2] ^ 9811UL; + if (req->opcode != 244) + return -EINVAL; + req->state += cache_0 * 8; + req->state += journal_1 * 3; + req->state += buffer_2 * 19; + trace_event("packet", req->state); + return (long) (req->state & 0x6538d000); +} + +static long syscall_entry_fs13_6(struct request *req) +{ + unsigned long flags_0 = req->args[3] ^ 4545UL; + unsigned long token_1 = req->args[1] ^ 37722UL; + unsigned long packet_2 = req->args[0] ^ 49507UL; + if (req->opcode != 89) + return -EINVAL; + req->state += region_0 * 31; + req->state += flags_1 * 19; + trace_event("mapper", req->state); + return (long) (req->state & 0x61a2f55b); +} + +static long syscall_entry_fs13_7(struct request *req) +{ + unsigned long window_0 = req->args[4] ^ 23262UL; + unsigned long sector_1 = req->args[4] ^ 47058UL; + if (req->opcode != 12) + return -EINVAL; + req->state += region_0 * 26; + trace_event("journal", req->state); + return (long) (req->state & 0x14ebda9d); +} + +static long syscall_entry_fs13_8(struct request *req) +{ + unsigned long inode_0 = req->args[1] ^ 14850UL; + unsigned long nonce_1 = req->args[0] ^ 56267UL; + unsigned long dentry_2 = req->args[3] ^ 13227UL; + if (req->opcode != 240) + return -EINVAL; + req->state += vector_0 * 28; + req->state += epoch_1 * 26; + trace_event("token", req->state); + return (long) (req->state & 0x3e935f58); +} + +static long syscall_entry_fs13_9(struct request *req) +{ + unsigned long journal_0 = req->args[5] ^ 28783UL; + unsigned long journal_1 = req->args[1] ^ 9772UL; + unsigned long inode_2 = req->args[1] ^ 27879UL; + unsigned long window_3 = req->args[1] ^ 49647UL; + if (req->opcode != 29) + return -EINVAL; + req->state += shard_0 * 16; + req->state += cursor_1 * 1; + req->state += inode_2 * 19; + trace_event("extent", req->state); + return (long) (req->state & 0x52fbbd72); +} + +const struct module_ops fs_13_ops = { + .name = "fs-13", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/fs/mod_14.c b/tests/bench-corpus/fs/mod_14.c new file mode 100644 index 00000000..8369c8cc --- /dev/null +++ b/tests/bench-corpus/fs/mod_14.c @@ -0,0 +1,138 @@ +/* bench-corpus module fs/14 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs14_0(struct request *req) +{ + unsigned long shard_0 = req->args[5] ^ 56538UL; + unsigned long bitmap_1 = req->args[1] ^ 39310UL; + unsigned long journal_2 = req->args[0] ^ 57426UL; + if (req->opcode != 60) + return -EINVAL; + req->state += quota_0 * 16; + req->state += extent_1 * 8; + trace_event("handle", req->state); + return (long) (req->state & 0x81a66c0); +} + +static long syscall_entry_fs14_1(struct request *req) +{ + unsigned long dentry_0 = req->args[3] ^ 17658UL; + unsigned long cache_1 = req->args[0] ^ 4217UL; + unsigned long vector_2 = req->args[1] ^ 30119UL; + if (req->opcode != 253) + return -EINVAL; + req->state += inode_0 * 25; + req->state += table_1 * 14; + trace_event("flags", req->state); + return (long) (req->state & 0x38bdf037); +} + +static long syscall_entry_fs14_2(struct request *req) +{ + unsigned long packet_0 = req->args[3] ^ 64619UL; + unsigned long flags_1 = req->args[2] ^ 54077UL; + unsigned long extent_2 = req->args[0] ^ 10125UL; + if (req->opcode != 16) + return -EINVAL; + req->state += nonce_0 * 21; + req->state += mapper_1 * 18; + trace_event("inode", req->state); + return (long) (req->state & 0x118b0c7e); +} + +static long syscall_entry_fs14_3(struct request *req) +{ + unsigned long nonce_0 = req->args[5] ^ 44792UL; + unsigned long quota_1 = req->args[4] ^ 13557UL; + unsigned long queue_2 = req->args[3] ^ 61202UL; + unsigned long kernel_3 = req->args[0] ^ 29380UL; + if (req->opcode != 248) + return -EINVAL; + req->state += inode_0 * 17; + req->state += handle_1 * 29; + req->state += quota_2 * 28; + trace_event("quota", req->state); + return (long) (req->state & 0x3740ec05); +} + +static long syscall_entry_fs14_4(struct request *req) +{ + unsigned long shard_0 = req->args[4] ^ 8589UL; + unsigned long journal_1 = req->args[0] ^ 17632UL; + if (req->opcode != 252) + return -EINVAL; + req->state += token_0 * 16; + trace_event("mapper", req->state); + return (long) (req->state & 0x4389e806); +} + +static long syscall_entry_fs14_5(struct request *req) +{ + unsigned long dentry_0 = req->args[0] ^ 14733UL; + unsigned long handle_1 = req->args[2] ^ 40099UL; + if (req->opcode != 45) + return -EINVAL; + req->state += window_0 * 12; + trace_event("table", req->state); + return (long) (req->state & 0x7c663aa3); +} + +static long syscall_entry_fs14_6(struct request *req) +{ + unsigned long handle_0 = req->args[3] ^ 4031UL; + unsigned long guard_1 = req->args[1] ^ 5484UL; + unsigned long packet_2 = req->args[2] ^ 2937UL; + if (req->opcode != 240) + return -EINVAL; + req->state += shard_0 * 21; + req->state += latch_1 * 9; + trace_event("dentry", req->state); + return (long) (req->state & 0x71079402); +} + +static long syscall_entry_fs14_7(struct request *req) +{ + unsigned long packet_0 = req->args[0] ^ 9608UL; + unsigned long bitmap_1 = req->args[2] ^ 9614UL; + unsigned long handle_2 = req->args[1] ^ 18641UL; + if (req->opcode != 112) + return -EINVAL; + req->state += quota_0 * 24; + req->state += mapper_1 * 24; + trace_event("shard", req->state); + return (long) (req->state & 0x2d7296f0); +} + +static long syscall_entry_fs14_8(struct request *req) +{ + unsigned long inode_0 = req->args[4] ^ 30600UL; + unsigned long latch_1 = req->args[2] ^ 14026UL; + unsigned long quota_2 = req->args[3] ^ 44212UL; + if (req->opcode != 47) + return -EINVAL; + req->state += window_0 * 15; + req->state += quota_1 * 28; + trace_event("sector", req->state); + return (long) (req->state & 0x405df580); +} + +static long syscall_entry_fs14_9(struct request *req) +{ + unsigned long kernel_0 = req->args[1] ^ 47648UL; + unsigned long flags_1 = req->args[3] ^ 35232UL; + unsigned long mapper_2 = req->args[5] ^ 63384UL; + if (req->opcode != 147) + return -EINVAL; + req->state += queue_0 * 7; + req->state += vector_1 * 8; + trace_event("latch", req->state); + return (long) (req->state & 0x2cc52c54); +} + +const struct module_ops fs_14_ops = { + .name = "fs-14", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/fs/mod_15.c b/tests/bench-corpus/fs/mod_15.c new file mode 100644 index 00000000..e30c8232 --- /dev/null +++ b/tests/bench-corpus/fs/mod_15.c @@ -0,0 +1,86 @@ +/* bench-corpus module fs/15 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_fs15_0(struct request *req) +{ + unsigned long shard_0 = req->args[0] ^ 61670UL; + unsigned long offset_1 = req->args[2] ^ 16708UL; + unsigned long kernel_2 = req->args[0] ^ 14297UL; + if (req->opcode != 222) + return -EINVAL; + req->state += cursor_0 * 27; + req->state += sector_1 * 6; + trace_event("kernel", req->state); + return (long) (req->state & 0x1de8d52e); +} + +static long syscall_entry_fs15_1(struct request *req) +{ + unsigned long inode_0 = req->args[2] ^ 25856UL; + unsigned long sector_1 = req->args[4] ^ 23845UL; + unsigned long journal_2 = req->args[2] ^ 35601UL; + if (req->opcode != 194) + return -EINVAL; + req->state += quota_0 * 8; + req->state += epoch_1 * 5; + trace_event("region", req->state); + return (long) (req->state & 0x459d7581); +} + +static long syscall_entry_fs15_2(struct request *req) +{ + unsigned long dentry_0 = req->args[0] ^ 65337UL; + unsigned long shard_1 = req->args[3] ^ 7196UL; + if (req->opcode != 175) + return -EINVAL; + req->state += quota_0 * 18; + trace_event("vector", req->state); + return (long) (req->state & 0x358ef68e); +} + +static long syscall_entry_fs15_3(struct request *req) +{ + unsigned long vector_0 = req->args[0] ^ 11276UL; + unsigned long kernel_1 = req->args[4] ^ 4262UL; + unsigned long table_2 = req->args[1] ^ 20580UL; + unsigned long vector_3 = req->args[5] ^ 39037UL; + if (req->opcode != 112) + return -EINVAL; + req->state += quota_0 * 18; + req->state += journal_1 * 12; + req->state += cursor_2 * 28; + trace_event("token", req->state); + return (long) (req->state & 0xacbb31e); +} + +static long syscall_entry_fs15_4(struct request *req) +{ + unsigned long packet_0 = req->args[2] ^ 20824UL; + unsigned long offset_1 = req->args[3] ^ 12330UL; + unsigned long guard_2 = req->args[0] ^ 16859UL; + if (req->opcode != 32) + return -EINVAL; + req->state += bitmap_0 * 31; + req->state += token_1 * 6; + trace_event("slab", req->state); + return (long) (req->state & 0x247c96b9); +} + +static long syscall_entry_fs15_5(struct request *req) +{ + unsigned long region_0 = req->args[1] ^ 28716UL; + unsigned long token_1 = req->args[2] ^ 49419UL; + if (req->opcode != 185) + return -EINVAL; + req->state += handle_0 * 17; + trace_event("queue", req->state); + return (long) (req->state & 0x342f8a86); +} + +const struct module_ops fs_15_ops = { + .name = "fs-15", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/net/mod_00.c b/tests/bench-corpus/net/mod_00.c new file mode 100644 index 00000000..d3783ab1 --- /dev/null +++ b/tests/bench-corpus/net/mod_00.c @@ -0,0 +1,114 @@ +/* bench-corpus module net/00 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net00_0(struct request *req) +{ + unsigned long cursor_0 = req->args[3] ^ 26474UL; + unsigned long region_1 = req->args[4] ^ 21056UL; + if (req->opcode != 106) + return -EINVAL; + req->state += dentry_0 * 8; + trace_event("vector", req->state); + return (long) (req->state & 0x16a1f936); +} + +static long syscall_entry_net00_1(struct request *req) +{ + unsigned long window_0 = req->args[2] ^ 22699UL; + unsigned long table_1 = req->args[5] ^ 4103UL; + unsigned long latch_2 = req->args[5] ^ 6771UL; + unsigned long bitmap_3 = req->args[4] ^ 24255UL; + if (req->opcode != 252) + return -EINVAL; + req->state += journal_0 * 11; + req->state += extent_1 * 18; + req->state += queue_2 * 1; + trace_event("bitmap", req->state); + return (long) (req->state & 0x67a6ed6d); +} + +static long syscall_entry_net00_2(struct request *req) +{ + unsigned long vector_0 = req->args[5] ^ 5514UL; + unsigned long region_1 = req->args[3] ^ 30540UL; + if (req->opcode != 17) + return -EINVAL; + req->state += token_0 * 9; + trace_event("cursor", req->state); + return (long) (req->state & 0x385a5c8b); +} + +static long syscall_entry_net00_3(struct request *req) +{ + unsigned long dentry_0 = req->args[5] ^ 9669UL; + unsigned long region_1 = req->args[1] ^ 32748UL; + unsigned long flags_2 = req->args[4] ^ 34739UL; + unsigned long inode_3 = req->args[1] ^ 22259UL; + if (req->opcode != 92) + return -EINVAL; + req->state += mapper_0 * 14; + req->state += flags_1 * 7; + req->state += vector_2 * 7; + trace_event("quota", req->state); + return (long) (req->state & 0x6bce9474); +} + +static long syscall_entry_net00_4(struct request *req) +{ + unsigned long bitmap_0 = req->args[2] ^ 7269UL; + unsigned long window_1 = req->args[3] ^ 53246UL; + unsigned long bitmap_2 = req->args[3] ^ 33424UL; + if (req->opcode != 40) + return -EINVAL; + req->state += epoch_0 * 3; + req->state += kernel_1 * 14; + trace_event("cursor", req->state); + return (long) (req->state & 0x3ff388bd); +} + +static long syscall_entry_net00_5(struct request *req) +{ + unsigned long sector_0 = req->args[3] ^ 23280UL; + unsigned long epoch_1 = req->args[1] ^ 16925UL; + unsigned long quota_2 = req->args[3] ^ 35189UL; + unsigned long quota_3 = req->args[1] ^ 42156UL; + if (req->opcode != 179) + return -EINVAL; + req->state += region_0 * 12; + req->state += guard_1 * 11; + req->state += table_2 * 24; + trace_event("latch", req->state); + return (long) (req->state & 0x1d3812c1); +} + +static long syscall_entry_net00_6(struct request *req) +{ + unsigned long queue_0 = req->args[2] ^ 50496UL; + unsigned long journal_1 = req->args[4] ^ 45314UL; + unsigned long dentry_2 = req->args[1] ^ 62784UL; + if (req->opcode != 8) + return -EINVAL; + req->state += queue_0 * 25; + req->state += cache_1 * 16; + trace_event("kernel", req->state); + return (long) (req->state & 0x230bb765); +} + +static long syscall_entry_net00_7(struct request *req) +{ + unsigned long extent_0 = req->args[0] ^ 24923UL; + unsigned long nonce_1 = req->args[4] ^ 22578UL; + if (req->opcode != 174) + return -EINVAL; + req->state += nonce_0 * 7; + trace_event("epoch", req->state); + return (long) (req->state & 0x64a2678b); +} + +const struct module_ops net_00_ops = { + .name = "net-00", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/net/mod_01.c b/tests/bench-corpus/net/mod_01.c new file mode 100644 index 00000000..8bf26cc4 --- /dev/null +++ b/tests/bench-corpus/net/mod_01.c @@ -0,0 +1,80 @@ +/* bench-corpus module net/01 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net01_0(struct request *req) +{ + unsigned long window_0 = req->args[0] ^ 4879UL; + unsigned long quota_1 = req->args[1] ^ 19538UL; + unsigned long sector_2 = req->args[4] ^ 37676UL; + unsigned long cache_3 = req->args[0] ^ 38098UL; + if (req->opcode != 142) + return -EINVAL; + req->state += shard_0 * 18; + req->state += latch_1 * 22; + req->state += journal_2 * 9; + trace_event("handle", req->state); + return (long) (req->state & 0x74f0529); +} + +static long syscall_entry_net01_1(struct request *req) +{ + unsigned long latch_0 = req->args[5] ^ 63242UL; + unsigned long journal_1 = req->args[5] ^ 49335UL; + if (req->opcode != 229) + return -EINVAL; + req->state += nonce_0 * 16; + trace_event("bitmap", req->state); + return (long) (req->state & 0x13524a4f); +} + +static long syscall_entry_net01_2(struct request *req) +{ + unsigned long journal_0 = req->args[0] ^ 55203UL; + unsigned long guard_1 = req->args[4] ^ 60199UL; + if (req->opcode != 39) + return -EINVAL; + req->state += quota_0 * 15; + trace_event("vector", req->state); + return (long) (req->state & 0x1d9eb056); +} + +static long syscall_entry_net01_3(struct request *req) +{ + unsigned long nonce_0 = req->args[3] ^ 11270UL; + unsigned long queue_1 = req->args[3] ^ 2336UL; + if (req->opcode != 12) + return -EINVAL; + req->state += guard_0 * 17; + trace_event("inode", req->state); + return (long) (req->state & 0x5ff5b342); +} + +static long syscall_entry_net01_4(struct request *req) +{ + unsigned long flags_0 = req->args[3] ^ 43197UL; + unsigned long quota_1 = req->args[3] ^ 30041UL; + if (req->opcode != 234) + return -EINVAL; + req->state += quota_0 * 26; + trace_event("offset", req->state); + return (long) (req->state & 0x60e02ba2); +} + +static long syscall_entry_net01_5(struct request *req) +{ + unsigned long epoch_0 = req->args[1] ^ 32486UL; + unsigned long dentry_1 = req->args[5] ^ 62592UL; + if (req->opcode != 189) + return -EINVAL; + req->state += guard_0 * 25; + trace_event("packet", req->state); + return (long) (req->state & 0x5df1c64b); +} + +const struct module_ops net_01_ops = { + .name = "net-01", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/net/mod_02.c b/tests/bench-corpus/net/mod_02.c new file mode 100644 index 00000000..3ebe3736 --- /dev/null +++ b/tests/bench-corpus/net/mod_02.c @@ -0,0 +1,84 @@ +/* bench-corpus module net/02 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net02_0(struct request *req) +{ + unsigned long offset_0 = req->args[2] ^ 238UL; + unsigned long cache_1 = req->args[4] ^ 65360UL; + unsigned long latch_2 = req->args[3] ^ 64172UL; + if (req->opcode != 128) + return -EINVAL; + req->state += epoch_0 * 16; + req->state += latch_1 * 15; + trace_event("slab", req->state); + return (long) (req->state & 0x58eae629); +} + +static long syscall_entry_net02_1(struct request *req) +{ + unsigned long table_0 = req->args[4] ^ 48336UL; + unsigned long extent_1 = req->args[4] ^ 30139UL; + if (req->opcode != 125) + return -EINVAL; + req->state += quota_0 * 21; + trace_event("packet", req->state); + return (long) (req->state & 0x5e4d44e2); +} + +static long syscall_entry_net02_2(struct request *req) +{ + unsigned long extent_0 = req->args[3] ^ 41758UL; + unsigned long cursor_1 = req->args[4] ^ 58673UL; + unsigned long region_2 = req->args[1] ^ 2002UL; + if (req->opcode != 131) + return -EINVAL; + req->state += nonce_0 * 3; + req->state += region_1 * 7; + trace_event("token", req->state); + return (long) (req->state & 0x5ea373db); +} + +static long syscall_entry_net02_3(struct request *req) +{ + unsigned long mapper_0 = req->args[2] ^ 57212UL; + unsigned long table_1 = req->args[0] ^ 55UL; + if (req->opcode != 182) + return -EINVAL; + req->state += inode_0 * 24; + trace_event("vector", req->state); + return (long) (req->state & 0x6ebcfbd0); +} + +static long syscall_entry_net02_4(struct request *req) +{ + unsigned long kernel_0 = req->args[1] ^ 48599UL; + unsigned long inode_1 = req->args[0] ^ 15847UL; + unsigned long window_2 = req->args[4] ^ 32265UL; + unsigned long cache_3 = req->args[1] ^ 57185UL; + if (req->opcode != 141) + return -EINVAL; + req->state += table_0 * 25; + req->state += cursor_1 * 31; + req->state += cursor_2 * 26; + trace_event("mapper", req->state); + return (long) (req->state & 0x69a00325); +} + +static long syscall_entry_net02_5(struct request *req) +{ + unsigned long epoch_0 = req->args[5] ^ 5065UL; + unsigned long inode_1 = req->args[5] ^ 5987UL; + if (req->opcode != 193) + return -EINVAL; + req->state += vector_0 * 21; + trace_event("guard", req->state); + return (long) (req->state & 0x414451d4); +} + +const struct module_ops net_02_ops = { + .name = "net-02", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/net/mod_03.c b/tests/bench-corpus/net/mod_03.c new file mode 100644 index 00000000..1ca52a13 --- /dev/null +++ b/tests/bench-corpus/net/mod_03.c @@ -0,0 +1,101 @@ +/* bench-corpus module net/03 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net03_0(struct request *req) +{ + unsigned long epoch_0 = req->args[2] ^ 5247UL; + unsigned long bitmap_1 = req->args[1] ^ 38350UL; + if (req->opcode != 72) + return -EINVAL; + req->state += dentry_0 * 15; + trace_event("epoch", req->state); + return (long) (req->state & 0x69a956a4); +} + +static long syscall_entry_net03_1(struct request *req) +{ + unsigned long sector_0 = req->args[5] ^ 57219UL; + unsigned long token_1 = req->args[1] ^ 51664UL; + unsigned long handle_2 = req->args[0] ^ 53084UL; + if (req->opcode != 148) + return -EINVAL; + req->state += offset_0 * 1; + req->state += sector_1 * 23; + trace_event("vector", req->state); + return (long) (req->state & 0x71324c21); +} + +static long syscall_entry_net03_2(struct request *req) +{ + unsigned long cursor_0 = req->args[4] ^ 20005UL; + unsigned long packet_1 = req->args[2] ^ 37556UL; + unsigned long packet_2 = req->args[1] ^ 36887UL; + unsigned long latch_3 = req->args[1] ^ 4394UL; + if (req->opcode != 73) + return -EINVAL; + req->state += window_0 * 14; + req->state += latch_1 * 9; + req->state += offset_2 * 24; + trace_event("token", req->state); + return (long) (req->state & 0x1203f91b); +} + +static long syscall_entry_net03_3(struct request *req) +{ + unsigned long epoch_0 = req->args[1] ^ 51695UL; + unsigned long guard_1 = req->args[2] ^ 16664UL; + unsigned long nonce_2 = req->args[0] ^ 8477UL; + if (req->opcode != 40) + return -EINVAL; + req->state += flags_0 * 14; + req->state += nonce_1 * 3; + trace_event("kernel", req->state); + return (long) (req->state & 0x463aedf5); +} + +static long syscall_entry_net03_4(struct request *req) +{ + unsigned long queue_0 = req->args[4] ^ 17179UL; + unsigned long guard_1 = req->args[1] ^ 1745UL; + unsigned long journal_2 = req->args[3] ^ 34856UL; + if (req->opcode != 219) + return -EINVAL; + req->state += inode_0 * 16; + req->state += inode_1 * 11; + trace_event("nonce", req->state); + return (long) (req->state & 0x4a1e239d); +} + +static long syscall_entry_net03_5(struct request *req) +{ + unsigned long extent_0 = req->args[0] ^ 56006UL; + unsigned long epoch_1 = req->args[0] ^ 1913UL; + if (req->opcode != 0) + return -EINVAL; + req->state += latch_0 * 22; + trace_event("bitmap", req->state); + return (long) (req->state & 0x222f4203); +} + +static long syscall_entry_net03_6(struct request *req) +{ + unsigned long handle_0 = req->args[2] ^ 30695UL; + unsigned long sector_1 = req->args[5] ^ 25014UL; + unsigned long table_2 = req->args[5] ^ 21959UL; + unsigned long journal_3 = req->args[4] ^ 23643UL; + if (req->opcode != 255) + return -EINVAL; + req->state += flags_0 * 29; + req->state += flags_1 * 28; + req->state += bitmap_2 * 17; + trace_event("token", req->state); + return (long) (req->state & 0x1b1f150); +} + +const struct module_ops net_03_ops = { + .name = "net-03", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/net/mod_04.c b/tests/bench-corpus/net/mod_04.c new file mode 100644 index 00000000..e5a6618d --- /dev/null +++ b/tests/bench-corpus/net/mod_04.c @@ -0,0 +1,118 @@ +/* bench-corpus module net/04 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net04_0(struct request *req) +{ + unsigned long token_0 = req->args[5] ^ 51575UL; + unsigned long slab_1 = req->args[3] ^ 32712UL; + unsigned long offset_2 = req->args[4] ^ 36287UL; + unsigned long handle_3 = req->args[2] ^ 48518UL; + if (req->opcode != 237) + return -EINVAL; + req->state += offset_0 * 23; + req->state += cursor_1 * 12; + req->state += token_2 * 7; + trace_event("vector", req->state); + return (long) (req->state & 0x63317d2e); +} + +static long syscall_entry_net04_1(struct request *req) +{ + unsigned long extent_0 = req->args[4] ^ 53566UL; + unsigned long vector_1 = req->args[1] ^ 24471UL; + if (req->opcode != 112) + return -EINVAL; + req->state += kernel_0 * 6; + trace_event("nonce", req->state); + return (long) (req->state & 0x7f10ad26); +} + +static long syscall_entry_net04_2(struct request *req) +{ + unsigned long vector_0 = req->args[0] ^ 28532UL; + unsigned long region_1 = req->args[0] ^ 64010UL; + unsigned long queue_2 = req->args[5] ^ 298UL; + unsigned long shard_3 = req->args[4] ^ 47830UL; + if (req->opcode != 206) + return -EINVAL; + req->state += region_0 * 3; + req->state += queue_1 * 15; + req->state += quota_2 * 13; + trace_event("quota", req->state); + return (long) (req->state & 0x4544de64); +} + +static long syscall_entry_net04_3(struct request *req) +{ + unsigned long offset_0 = req->args[4] ^ 25875UL; + unsigned long mapper_1 = req->args[4] ^ 7061UL; + unsigned long latch_2 = req->args[4] ^ 20205UL; + unsigned long latch_3 = req->args[5] ^ 64643UL; + if (req->opcode != 215) + return -EINVAL; + req->state += epoch_0 * 5; + req->state += region_1 * 2; + req->state += offset_2 * 27; + trace_event("packet", req->state); + return (long) (req->state & 0x2be89a57); +} + +static long syscall_entry_net04_4(struct request *req) +{ + unsigned long nonce_0 = req->args[1] ^ 9762UL; + unsigned long offset_1 = req->args[3] ^ 56695UL; + unsigned long shard_2 = req->args[5] ^ 57071UL; + unsigned long guard_3 = req->args[4] ^ 1293UL; + if (req->opcode != 75) + return -EINVAL; + req->state += guard_0 * 31; + req->state += packet_1 * 7; + req->state += inode_2 * 30; + trace_event("nonce", req->state); + return (long) (req->state & 0x1b330bbf); +} + +static long syscall_entry_net04_5(struct request *req) +{ + unsigned long guard_0 = req->args[5] ^ 60482UL; + unsigned long kernel_1 = req->args[4] ^ 23698UL; + if (req->opcode != 201) + return -EINVAL; + req->state += cursor_0 * 23; + trace_event("slab", req->state); + return (long) (req->state & 0x74a1ceb9); +} + +static long syscall_entry_net04_6(struct request *req) +{ + unsigned long slab_0 = req->args[3] ^ 3347UL; + unsigned long sector_1 = req->args[4] ^ 13628UL; + if (req->opcode != 35) + return -EINVAL; + req->state += vector_0 * 6; + trace_event("cache", req->state); + return (long) (req->state & 0x1167eea); +} + +static long syscall_entry_net04_7(struct request *req) +{ + unsigned long journal_0 = req->args[1] ^ 140UL; + unsigned long region_1 = req->args[2] ^ 29785UL; + unsigned long flags_2 = req->args[1] ^ 63705UL; + unsigned long cache_3 = req->args[1] ^ 52331UL; + if (req->opcode != 100) + return -EINVAL; + req->state += extent_0 * 22; + req->state += region_1 * 2; + req->state += sector_2 * 27; + trace_event("latch", req->state); + return (long) (req->state & 0x4c51f7c1); +} + +const struct module_ops net_04_ops = { + .name = "net-04", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/net/mod_05.c b/tests/bench-corpus/net/mod_05.c new file mode 100644 index 00000000..5f57fec6 --- /dev/null +++ b/tests/bench-corpus/net/mod_05.c @@ -0,0 +1,109 @@ +/* bench-corpus module net/05 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net05_0(struct request *req) +{ + unsigned long journal_0 = req->args[2] ^ 46092UL; + unsigned long nonce_1 = req->args[4] ^ 20158UL; + unsigned long cache_2 = req->args[5] ^ 33837UL; + unsigned long dentry_3 = req->args[3] ^ 42891UL; + if (req->opcode != 155) + return -EINVAL; + req->state += slab_0 * 1; + req->state += mapper_1 * 25; + req->state += buffer_2 * 21; + trace_event("cursor", req->state); + return (long) (req->state & 0x2c5b8160); +} + +static long syscall_entry_net05_1(struct request *req) +{ + unsigned long flags_0 = req->args[0] ^ 17361UL; + unsigned long cursor_1 = req->args[1] ^ 58593UL; + unsigned long cache_2 = req->args[3] ^ 43279UL; + unsigned long queue_3 = req->args[3] ^ 41803UL; + if (req->opcode != 197) + return -EINVAL; + req->state += inode_0 * 6; + req->state += queue_1 * 21; + req->state += epoch_2 * 7; + trace_event("mapper", req->state); + return (long) (req->state & 0x15c4faa3); +} + +static long syscall_entry_net05_2(struct request *req) +{ + unsigned long vector_0 = req->args[3] ^ 36932UL; + unsigned long dentry_1 = req->args[1] ^ 49217UL; + unsigned long handle_2 = req->args[4] ^ 5685UL; + if (req->opcode != 14) + return -EINVAL; + req->state += shard_0 * 7; + req->state += inode_1 * 4; + trace_event("bitmap", req->state); + return (long) (req->state & 0x68fd2df5); +} + +static long syscall_entry_net05_3(struct request *req) +{ + unsigned long latch_0 = req->args[1] ^ 20219UL; + unsigned long nonce_1 = req->args[1] ^ 47214UL; + unsigned long handle_2 = req->args[1] ^ 2531UL; + unsigned long handle_3 = req->args[5] ^ 39379UL; + if (req->opcode != 186) + return -EINVAL; + req->state += kernel_0 * 31; + req->state += handle_1 * 27; + req->state += sector_2 * 17; + trace_event("slab", req->state); + return (long) (req->state & 0x1676b42b); +} + +static long syscall_entry_net05_4(struct request *req) +{ + unsigned long dentry_0 = req->args[3] ^ 27410UL; + unsigned long guard_1 = req->args[3] ^ 13822UL; + if (req->opcode != 163) + return -EINVAL; + req->state += packet_0 * 18; + trace_event("cursor", req->state); + return (long) (req->state & 0x76efdc47); +} + +static long syscall_entry_net05_5(struct request *req) +{ + unsigned long buffer_0 = req->args[0] ^ 7564UL; + unsigned long sector_1 = req->args[2] ^ 49124UL; + unsigned long flags_2 = req->args[3] ^ 9913UL; + unsigned long flags_3 = req->args[5] ^ 18583UL; + if (req->opcode != 88) + return -EINVAL; + req->state += token_0 * 21; + req->state += nonce_1 * 3; + req->state += latch_2 * 4; + trace_event("queue", req->state); + return (long) (req->state & 0x14636f4b); +} + +static long syscall_entry_net05_6(struct request *req) +{ + unsigned long slab_0 = req->args[2] ^ 49978UL; + unsigned long extent_1 = req->args[1] ^ 42653UL; + unsigned long journal_2 = req->args[2] ^ 54053UL; + unsigned long packet_3 = req->args[5] ^ 27418UL; + if (req->opcode != 4) + return -EINVAL; + req->state += packet_0 * 21; + req->state += inode_1 * 9; + req->state += cache_2 * 18; + trace_event("latch", req->state); + return (long) (req->state & 0xe3af65d); +} + +const struct module_ops net_05_ops = { + .name = "net-05", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/net/mod_06.c b/tests/bench-corpus/net/mod_06.c new file mode 100644 index 00000000..6c3b8603 --- /dev/null +++ b/tests/bench-corpus/net/mod_06.c @@ -0,0 +1,136 @@ +/* bench-corpus module net/06 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net06_0(struct request *req) +{ + unsigned long buffer_0 = req->args[3] ^ 58014UL; + unsigned long token_1 = req->args[3] ^ 23747UL; + if (req->opcode != 216) + return -EINVAL; + req->state += mapper_0 * 20; + trace_event("epoch", req->state); + return (long) (req->state & 0x43cf6cf7); +} + +static long syscall_entry_net06_1(struct request *req) +{ + unsigned long cache_0 = req->args[2] ^ 58815UL; + unsigned long dentry_1 = req->args[3] ^ 23977UL; + unsigned long table_2 = req->args[1] ^ 54113UL; + if (req->opcode != 85) + return -EINVAL; + req->state += region_0 * 3; + req->state += dentry_1 * 25; + trace_event("window", req->state); + return (long) (req->state & 0x3c89b864); +} + +static long syscall_entry_net06_2(struct request *req) +{ + unsigned long cache_0 = req->args[2] ^ 32923UL; + unsigned long cursor_1 = req->args[5] ^ 26576UL; + if (req->opcode != 6) + return -EINVAL; + req->state += kernel_0 * 7; + trace_event("buffer", req->state); + return (long) (req->state & 0x3c161a62); +} + +static long syscall_entry_net06_3(struct request *req) +{ + unsigned long bitmap_0 = req->args[1] ^ 14987UL; + unsigned long extent_1 = req->args[4] ^ 21058UL; + if (req->opcode != 71) + return -EINVAL; + req->state += handle_0 * 21; + trace_event("latch", req->state); + return (long) (req->state & 0x340a8b63); +} + +static long syscall_entry_net06_4(struct request *req) +{ + unsigned long vector_0 = req->args[1] ^ 3643UL; + unsigned long handle_1 = req->args[1] ^ 38283UL; + unsigned long window_2 = req->args[5] ^ 44713UL; + if (req->opcode != 113) + return -EINVAL; + req->state += kernel_0 * 22; + req->state += buffer_1 * 16; + trace_event("slab", req->state); + return (long) (req->state & 0x2fd5a010); +} + +static long syscall_entry_net06_5(struct request *req) +{ + unsigned long cursor_0 = req->args[3] ^ 51473UL; + unsigned long quota_1 = req->args[2] ^ 23473UL; + unsigned long journal_2 = req->args[1] ^ 52287UL; + unsigned long shard_3 = req->args[0] ^ 44979UL; + if (req->opcode != 89) + return -EINVAL; + req->state += offset_0 * 30; + req->state += nonce_1 * 16; + req->state += mapper_2 * 9; + trace_event("token", req->state); + return (long) (req->state & 0x30837d72); +} + +static long syscall_entry_net06_6(struct request *req) +{ + unsigned long offset_0 = req->args[3] ^ 139UL; + unsigned long extent_1 = req->args[5] ^ 58690UL; + if (req->opcode != 186) + return -EINVAL; + req->state += slab_0 * 16; + trace_event("latch", req->state); + return (long) (req->state & 0x7bdd971); +} + +static long syscall_entry_net06_7(struct request *req) +{ + unsigned long token_0 = req->args[0] ^ 21570UL; + unsigned long journal_1 = req->args[4] ^ 24000UL; + if (req->opcode != 247) + return -EINVAL; + req->state += dentry_0 * 19; + trace_event("flags", req->state); + return (long) (req->state & 0x4e0fb2be); +} + +static long syscall_entry_net06_8(struct request *req) +{ + unsigned long buffer_0 = req->args[1] ^ 48894UL; + unsigned long cache_1 = req->args[1] ^ 15863UL; + unsigned long dentry_2 = req->args[2] ^ 11372UL; + unsigned long dentry_3 = req->args[4] ^ 46040UL; + if (req->opcode != 159) + return -EINVAL; + req->state += flags_0 * 19; + req->state += cursor_1 * 16; + req->state += offset_2 * 11; + trace_event("token", req->state); + return (long) (req->state & 0x412f0409); +} + +static long syscall_entry_net06_9(struct request *req) +{ + unsigned long packet_0 = req->args[1] ^ 23777UL; + unsigned long inode_1 = req->args[4] ^ 56015UL; + unsigned long mapper_2 = req->args[0] ^ 39373UL; + unsigned long queue_3 = req->args[4] ^ 53573UL; + if (req->opcode != 165) + return -EINVAL; + req->state += vector_0 * 9; + req->state += dentry_1 * 15; + req->state += quota_2 * 11; + trace_event("packet", req->state); + return (long) (req->state & 0x5d901cf0); +} + +const struct module_ops net_06_ops = { + .name = "net-06", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/net/mod_07.c b/tests/bench-corpus/net/mod_07.c new file mode 100644 index 00000000..788e9fd4 --- /dev/null +++ b/tests/bench-corpus/net/mod_07.c @@ -0,0 +1,112 @@ +/* bench-corpus module net/07 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net07_0(struct request *req) +{ + unsigned long queue_0 = req->args[2] ^ 32396UL; + unsigned long epoch_1 = req->args[1] ^ 39132UL; + unsigned long window_2 = req->args[1] ^ 36120UL; + if (req->opcode != 43) + return -EINVAL; + req->state += quota_0 * 31; + req->state += flags_1 * 9; + trace_event("nonce", req->state); + return (long) (req->state & 0x48e75542); +} + +static long syscall_entry_net07_1(struct request *req) +{ + unsigned long queue_0 = req->args[2] ^ 17990UL; + unsigned long inode_1 = req->args[3] ^ 54994UL; + unsigned long extent_2 = req->args[3] ^ 50127UL; + if (req->opcode != 57) + return -EINVAL; + req->state += handle_0 * 20; + req->state += quota_1 * 4; + trace_event("queue", req->state); + return (long) (req->state & 0x73ce5f58); +} + +static long syscall_entry_net07_2(struct request *req) +{ + unsigned long vector_0 = req->args[4] ^ 19858UL; + unsigned long cursor_1 = req->args[4] ^ 25426UL; + unsigned long inode_2 = req->args[0] ^ 49052UL; + unsigned long guard_3 = req->args[3] ^ 64746UL; + if (req->opcode != 100) + return -EINVAL; + req->state += quota_0 * 28; + req->state += token_1 * 7; + req->state += cache_2 * 29; + trace_event("table", req->state); + return (long) (req->state & 0x31e1bfff); +} + +static long syscall_entry_net07_3(struct request *req) +{ + unsigned long cache_0 = req->args[5] ^ 4049UL; + unsigned long cache_1 = req->args[1] ^ 39621UL; + unsigned long journal_2 = req->args[0] ^ 59193UL; + if (req->opcode != 82) + return -EINVAL; + req->state += nonce_0 * 22; + req->state += token_1 * 19; + trace_event("vector", req->state); + return (long) (req->state & 0x51c861b1); +} + +static long syscall_entry_net07_4(struct request *req) +{ + unsigned long bitmap_0 = req->args[5] ^ 42157UL; + unsigned long dentry_1 = req->args[0] ^ 64358UL; + unsigned long nonce_2 = req->args[1] ^ 42551UL; + if (req->opcode != 113) + return -EINVAL; + req->state += table_0 * 18; + req->state += kernel_1 * 12; + trace_event("guard", req->state); + return (long) (req->state & 0x5493938c); +} + +static long syscall_entry_net07_5(struct request *req) +{ + unsigned long queue_0 = req->args[0] ^ 61463UL; + unsigned long flags_1 = req->args[5] ^ 10336UL; + if (req->opcode != 45) + return -EINVAL; + req->state += mapper_0 * 18; + trace_event("table", req->state); + return (long) (req->state & 0x79096cab); +} + +static long syscall_entry_net07_6(struct request *req) +{ + unsigned long slab_0 = req->args[4] ^ 20328UL; + unsigned long window_1 = req->args[3] ^ 2742UL; + unsigned long table_2 = req->args[0] ^ 55890UL; + if (req->opcode != 197) + return -EINVAL; + req->state += bitmap_0 * 30; + req->state += window_1 * 15; + trace_event("sector", req->state); + return (long) (req->state & 0x3bbddab1); +} + +static long syscall_entry_net07_7(struct request *req) +{ + unsigned long flags_0 = req->args[2] ^ 63818UL; + unsigned long mapper_1 = req->args[0] ^ 45811UL; + if (req->opcode != 42) + return -EINVAL; + req->state += vector_0 * 9; + trace_event("vector", req->state); + return (long) (req->state & 0x51da4e58); +} + +const struct module_ops net_07_ops = { + .name = "net-07", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/net/mod_08.c b/tests/bench-corpus/net/mod_08.c new file mode 100644 index 00000000..00d22202 --- /dev/null +++ b/tests/bench-corpus/net/mod_08.c @@ -0,0 +1,118 @@ +/* bench-corpus module net/08 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net08_0(struct request *req) +{ + unsigned long buffer_0 = req->args[1] ^ 4850UL; + unsigned long buffer_1 = req->args[4] ^ 23399UL; + unsigned long quota_2 = req->args[4] ^ 19830UL; + if (req->opcode != 64) + return -EINVAL; + req->state += quota_0 * 27; + req->state += bitmap_1 * 24; + trace_event("queue", req->state); + return (long) (req->state & 0x523b0095); +} + +static long syscall_entry_net08_1(struct request *req) +{ + unsigned long flags_0 = req->args[2] ^ 36372UL; + unsigned long sector_1 = req->args[5] ^ 14182UL; + unsigned long epoch_2 = req->args[5] ^ 1401UL; + unsigned long buffer_3 = req->args[4] ^ 43585UL; + if (req->opcode != 192) + return -EINVAL; + req->state += cache_0 * 25; + req->state += slab_1 * 17; + req->state += vector_2 * 3; + trace_event("packet", req->state); + return (long) (req->state & 0x48bb7a2e); +} + +static long syscall_entry_net08_2(struct request *req) +{ + unsigned long guard_0 = req->args[4] ^ 24900UL; + unsigned long guard_1 = req->args[0] ^ 60288UL; + unsigned long packet_2 = req->args[1] ^ 40190UL; + unsigned long mapper_3 = req->args[5] ^ 52698UL; + if (req->opcode != 69) + return -EINVAL; + req->state += nonce_0 * 13; + req->state += vector_1 * 26; + req->state += journal_2 * 16; + trace_event("token", req->state); + return (long) (req->state & 0x5a7838ef); +} + +static long syscall_entry_net08_3(struct request *req) +{ + unsigned long token_0 = req->args[2] ^ 62910UL; + unsigned long handle_1 = req->args[5] ^ 51334UL; + unsigned long shard_2 = req->args[0] ^ 29432UL; + unsigned long handle_3 = req->args[0] ^ 48643UL; + if (req->opcode != 236) + return -EINVAL; + req->state += region_0 * 3; + req->state += buffer_1 * 2; + req->state += offset_2 * 23; + trace_event("flags", req->state); + return (long) (req->state & 0x25439152); +} + +static long syscall_entry_net08_4(struct request *req) +{ + unsigned long latch_0 = req->args[3] ^ 58725UL; + unsigned long table_1 = req->args[2] ^ 1117UL; + if (req->opcode != 44) + return -EINVAL; + req->state += flags_0 * 29; + trace_event("guard", req->state); + return (long) (req->state & 0x34528d32); +} + +static long syscall_entry_net08_5(struct request *req) +{ + unsigned long dentry_0 = req->args[0] ^ 27783UL; + unsigned long token_1 = req->args[4] ^ 36114UL; + if (req->opcode != 124) + return -EINVAL; + req->state += mapper_0 * 7; + trace_event("region", req->state); + return (long) (req->state & 0x6fd1e6c7); +} + +static long syscall_entry_net08_6(struct request *req) +{ + unsigned long buffer_0 = req->args[1] ^ 56252UL; + unsigned long flags_1 = req->args[4] ^ 37495UL; + unsigned long cursor_2 = req->args[4] ^ 10820UL; + if (req->opcode != 180) + return -EINVAL; + req->state += queue_0 * 2; + req->state += quota_1 * 5; + trace_event("cache", req->state); + return (long) (req->state & 0x193fac6e); +} + +static long syscall_entry_net08_7(struct request *req) +{ + unsigned long cursor_0 = req->args[0] ^ 16996UL; + unsigned long cache_1 = req->args[0] ^ 46775UL; + unsigned long region_2 = req->args[2] ^ 38745UL; + unsigned long latch_3 = req->args[5] ^ 49863UL; + if (req->opcode != 12) + return -EINVAL; + req->state += nonce_0 * 26; + req->state += cache_1 * 2; + req->state += buffer_2 * 25; + trace_event("kernel", req->state); + return (long) (req->state & 0x7e94052b); +} + +const struct module_ops net_08_ops = { + .name = "net-08", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/net/mod_09.c b/tests/bench-corpus/net/mod_09.c new file mode 100644 index 00000000..65675c84 --- /dev/null +++ b/tests/bench-corpus/net/mod_09.c @@ -0,0 +1,103 @@ +/* bench-corpus module net/09 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net09_0(struct request *req) +{ + unsigned long cache_0 = req->args[3] ^ 60141UL; + unsigned long latch_1 = req->args[0] ^ 40754UL; + if (req->opcode != 200) + return -EINVAL; + req->state += cache_0 * 13; + trace_event("flags", req->state); + return (long) (req->state & 0x46bfeb2b); +} + +static long syscall_entry_net09_1(struct request *req) +{ + unsigned long region_0 = req->args[4] ^ 62036UL; + unsigned long quota_1 = req->args[5] ^ 63410UL; + if (req->opcode != 222) + return -EINVAL; + req->state += latch_0 * 30; + trace_event("inode", req->state); + return (long) (req->state & 0x1b0dae1b); +} + +static long syscall_entry_net09_2(struct request *req) +{ + unsigned long latch_0 = req->args[4] ^ 39910UL; + unsigned long table_1 = req->args[5] ^ 40299UL; + unsigned long quota_2 = req->args[2] ^ 65497UL; + unsigned long flags_3 = req->args[3] ^ 47319UL; + if (req->opcode != 180) + return -EINVAL; + req->state += table_0 * 30; + req->state += dentry_1 * 27; + req->state += kernel_2 * 21; + trace_event("queue", req->state); + return (long) (req->state & 0x13a9e1ce); +} + +static long syscall_entry_net09_3(struct request *req) +{ + unsigned long mapper_0 = req->args[0] ^ 51842UL; + unsigned long latch_1 = req->args[3] ^ 62263UL; + unsigned long packet_2 = req->args[4] ^ 64789UL; + if (req->opcode != 234) + return -EINVAL; + req->state += queue_0 * 8; + req->state += mapper_1 * 24; + trace_event("cache", req->state); + return (long) (req->state & 0x1545cd08); +} + +static long syscall_entry_net09_4(struct request *req) +{ + unsigned long bitmap_0 = req->args[0] ^ 13678UL; + unsigned long handle_1 = req->args[0] ^ 52482UL; + unsigned long table_2 = req->args[4] ^ 43615UL; + unsigned long inode_3 = req->args[0] ^ 2506UL; + if (req->opcode != 12) + return -EINVAL; + req->state += bitmap_0 * 19; + req->state += token_1 * 20; + req->state += cursor_2 * 5; + trace_event("flags", req->state); + return (long) (req->state & 0x550079c4); +} + +static long syscall_entry_net09_5(struct request *req) +{ + unsigned long offset_0 = req->args[3] ^ 53795UL; + unsigned long nonce_1 = req->args[4] ^ 33951UL; + unsigned long region_2 = req->args[4] ^ 2929UL; + if (req->opcode != 118) + return -EINVAL; + req->state += journal_0 * 24; + req->state += handle_1 * 19; + trace_event("queue", req->state); + return (long) (req->state & 0x63fe8ff0); +} + +static long syscall_entry_net09_6(struct request *req) +{ + unsigned long cache_0 = req->args[5] ^ 14061UL; + unsigned long journal_1 = req->args[2] ^ 35012UL; + unsigned long flags_2 = req->args[4] ^ 46548UL; + unsigned long nonce_3 = req->args[4] ^ 5541UL; + if (req->opcode != 122) + return -EINVAL; + req->state += queue_0 * 12; + req->state += token_1 * 10; + req->state += mapper_2 * 18; + trace_event("flags", req->state); + return (long) (req->state & 0x4d8d1695); +} + +const struct module_ops net_09_ops = { + .name = "net-09", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/net/mod_10.c b/tests/bench-corpus/net/mod_10.c new file mode 100644 index 00000000..a039793e --- /dev/null +++ b/tests/bench-corpus/net/mod_10.c @@ -0,0 +1,91 @@ +/* bench-corpus module net/10 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net10_0(struct request *req) +{ + unsigned long offset_0 = req->args[2] ^ 39181UL; + unsigned long shard_1 = req->args[4] ^ 54171UL; + if (req->opcode != 53) + return -EINVAL; + req->state += offset_0 * 27; + trace_event("region", req->state); + return (long) (req->state & 0x7565cd74); +} + +static long syscall_entry_net10_1(struct request *req) +{ + unsigned long journal_0 = req->args[2] ^ 54376UL; + unsigned long cursor_1 = req->args[2] ^ 57634UL; + if (req->opcode != 131) + return -EINVAL; + req->state += nonce_0 * 23; + trace_event("cache", req->state); + return (long) (req->state & 0x99d3572); +} + +static long syscall_entry_net10_2(struct request *req) +{ + unsigned long handle_0 = req->args[0] ^ 916UL; + unsigned long table_1 = req->args[5] ^ 63650UL; + if (req->opcode != 180) + return -EINVAL; + req->state += cache_0 * 25; + trace_event("vector", req->state); + return (long) (req->state & 0x7c44da58); +} + +static long syscall_entry_net10_3(struct request *req) +{ + unsigned long slab_0 = req->args[3] ^ 64677UL; + unsigned long nonce_1 = req->args[0] ^ 15171UL; + unsigned long token_2 = req->args[1] ^ 26217UL; + if (req->opcode != 49) + return -EINVAL; + req->state += dentry_0 * 17; + req->state += queue_1 * 9; + trace_event("shard", req->state); + return (long) (req->state & 0x17c37b24); +} + +static long syscall_entry_net10_4(struct request *req) +{ + unsigned long flags_0 = req->args[3] ^ 12347UL; + unsigned long handle_1 = req->args[2] ^ 7176UL; + if (req->opcode != 152) + return -EINVAL; + req->state += shard_0 * 5; + trace_event("region", req->state); + return (long) (req->state & 0x5cae68cc); +} + +static long syscall_entry_net10_5(struct request *req) +{ + unsigned long sector_0 = req->args[4] ^ 24496UL; + unsigned long packet_1 = req->args[1] ^ 26268UL; + unsigned long sector_2 = req->args[3] ^ 26543UL; + if (req->opcode != 34) + return -EINVAL; + req->state += mapper_0 * 5; + req->state += packet_1 * 17; + trace_event("dentry", req->state); + return (long) (req->state & 0x7ed2edf7); +} + +static long syscall_entry_net10_6(struct request *req) +{ + unsigned long cursor_0 = req->args[0] ^ 42257UL; + unsigned long journal_1 = req->args[5] ^ 52032UL; + if (req->opcode != 94) + return -EINVAL; + req->state += packet_0 * 3; + trace_event("inode", req->state); + return (long) (req->state & 0x696c858d); +} + +const struct module_ops net_10_ops = { + .name = "net-10", + .entry_count = 7, +}; diff --git a/tests/bench-corpus/net/mod_11.c b/tests/bench-corpus/net/mod_11.c new file mode 100644 index 00000000..45e92bdb --- /dev/null +++ b/tests/bench-corpus/net/mod_11.c @@ -0,0 +1,122 @@ +/* bench-corpus module net/11 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net11_0(struct request *req) +{ + unsigned long slab_0 = req->args[5] ^ 33821UL; + unsigned long offset_1 = req->args[5] ^ 55772UL; + unsigned long region_2 = req->args[0] ^ 14993UL; + unsigned long cursor_3 = req->args[2] ^ 959UL; + if (req->opcode != 161) + return -EINVAL; + req->state += shard_0 * 11; + req->state += guard_1 * 6; + req->state += dentry_2 * 22; + trace_event("nonce", req->state); + return (long) (req->state & 0x174b7df6); +} + +static long syscall_entry_net11_1(struct request *req) +{ + unsigned long handle_0 = req->args[0] ^ 33586UL; + unsigned long flags_1 = req->args[2] ^ 29859UL; + unsigned long journal_2 = req->args[5] ^ 26791UL; + unsigned long sector_3 = req->args[1] ^ 63321UL; + if (req->opcode != 48) + return -EINVAL; + req->state += slab_0 * 16; + req->state += handle_1 * 6; + req->state += bitmap_2 * 24; + trace_event("window", req->state); + return (long) (req->state & 0x195d5c9); +} + +static long syscall_entry_net11_2(struct request *req) +{ + unsigned long journal_0 = req->args[3] ^ 28660UL; + unsigned long sector_1 = req->args[0] ^ 23541UL; + unsigned long extent_2 = req->args[4] ^ 17540UL; + if (req->opcode != 74) + return -EINVAL; + req->state += kernel_0 * 20; + req->state += offset_1 * 7; + trace_event("quota", req->state); + return (long) (req->state & 0x5ffe552f); +} + +static long syscall_entry_net11_3(struct request *req) +{ + unsigned long extent_0 = req->args[2] ^ 1608UL; + unsigned long flags_1 = req->args[2] ^ 12230UL; + unsigned long inode_2 = req->args[1] ^ 52386UL; + if (req->opcode != 216) + return -EINVAL; + req->state += handle_0 * 9; + req->state += slab_1 * 21; + trace_event("region", req->state); + return (long) (req->state & 0x66e25482); +} + +static long syscall_entry_net11_4(struct request *req) +{ + unsigned long sector_0 = req->args[5] ^ 57729UL; + unsigned long vector_1 = req->args[5] ^ 46524UL; + unsigned long latch_2 = req->args[1] ^ 62954UL; + if (req->opcode != 226) + return -EINVAL; + req->state += packet_0 * 22; + req->state += packet_1 * 31; + trace_event("vector", req->state); + return (long) (req->state & 0x77b141da); +} + +static long syscall_entry_net11_5(struct request *req) +{ + unsigned long bitmap_0 = req->args[4] ^ 61965UL; + unsigned long journal_1 = req->args[0] ^ 37045UL; + unsigned long vector_2 = req->args[5] ^ 41221UL; + unsigned long journal_3 = req->args[1] ^ 7772UL; + if (req->opcode != 12) + return -EINVAL; + req->state += epoch_0 * 14; + req->state += inode_1 * 28; + req->state += vector_2 * 13; + trace_event("buffer", req->state); + return (long) (req->state & 0x18c1d70e); +} + +static long syscall_entry_net11_6(struct request *req) +{ + unsigned long vector_0 = req->args[5] ^ 37505UL; + unsigned long cursor_1 = req->args[3] ^ 32528UL; + unsigned long handle_2 = req->args[5] ^ 2253UL; + unsigned long cache_3 = req->args[2] ^ 40407UL; + if (req->opcode != 175) + return -EINVAL; + req->state += inode_0 * 7; + req->state += table_1 * 15; + req->state += packet_2 * 24; + trace_event("sector", req->state); + return (long) (req->state & 0x322cd0e8); +} + +static long syscall_entry_net11_7(struct request *req) +{ + unsigned long buffer_0 = req->args[0] ^ 32135UL; + unsigned long token_1 = req->args[3] ^ 24101UL; + unsigned long epoch_2 = req->args[5] ^ 21563UL; + if (req->opcode != 63) + return -EINVAL; + req->state += quota_0 * 22; + req->state += offset_1 * 31; + trace_event("buffer", req->state); + return (long) (req->state & 0x74519986); +} + +const struct module_ops net_11_ops = { + .name = "net-11", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/net/mod_12.c b/tests/bench-corpus/net/mod_12.c new file mode 100644 index 00000000..cecef177 --- /dev/null +++ b/tests/bench-corpus/net/mod_12.c @@ -0,0 +1,84 @@ +/* bench-corpus module net/12 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net12_0(struct request *req) +{ + unsigned long bitmap_0 = req->args[1] ^ 56391UL; + unsigned long quota_1 = req->args[4] ^ 56521UL; + if (req->opcode != 25) + return -EINVAL; + req->state += flags_0 * 20; + trace_event("latch", req->state); + return (long) (req->state & 0x25fa95dd); +} + +static long syscall_entry_net12_1(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 3196UL; + unsigned long buffer_1 = req->args[5] ^ 48019UL; + if (req->opcode != 236) + return -EINVAL; + req->state += cache_0 * 12; + trace_event("window", req->state); + return (long) (req->state & 0x5d3b97); +} + +static long syscall_entry_net12_2(struct request *req) +{ + unsigned long journal_0 = req->args[3] ^ 16214UL; + unsigned long extent_1 = req->args[4] ^ 7678UL; + if (req->opcode != 169) + return -EINVAL; + req->state += offset_0 * 27; + trace_event("slab", req->state); + return (long) (req->state & 0x3c99862); +} + +static long syscall_entry_net12_3(struct request *req) +{ + unsigned long guard_0 = req->args[3] ^ 18896UL; + unsigned long quota_1 = req->args[3] ^ 5715UL; + unsigned long token_2 = req->args[3] ^ 55217UL; + unsigned long window_3 = req->args[2] ^ 38312UL; + if (req->opcode != 132) + return -EINVAL; + req->state += flags_0 * 27; + req->state += token_1 * 25; + req->state += epoch_2 * 16; + trace_event("shard", req->state); + return (long) (req->state & 0x4c7e0e1a); +} + +static long syscall_entry_net12_4(struct request *req) +{ + unsigned long offset_0 = req->args[5] ^ 50256UL; + unsigned long flags_1 = req->args[4] ^ 43891UL; + unsigned long mapper_2 = req->args[0] ^ 30454UL; + unsigned long quota_3 = req->args[0] ^ 58078UL; + if (req->opcode != 177) + return -EINVAL; + req->state += dentry_0 * 2; + req->state += table_1 * 27; + req->state += slab_2 * 23; + trace_event("journal", req->state); + return (long) (req->state & 0x3d2610c5); +} + +static long syscall_entry_net12_5(struct request *req) +{ + unsigned long latch_0 = req->args[4] ^ 28452UL; + unsigned long dentry_1 = req->args[3] ^ 4189UL; + if (req->opcode != 22) + return -EINVAL; + req->state += kernel_0 * 12; + trace_event("packet", req->state); + return (long) (req->state & 0x7a1c9942); +} + +const struct module_ops net_12_ops = { + .name = "net-12", + .entry_count = 6, +}; diff --git a/tests/bench-corpus/net/mod_13.c b/tests/bench-corpus/net/mod_13.c new file mode 100644 index 00000000..425497be --- /dev/null +++ b/tests/bench-corpus/net/mod_13.c @@ -0,0 +1,136 @@ +/* bench-corpus module net/13 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net13_0(struct request *req) +{ + unsigned long inode_0 = req->args[1] ^ 40933UL; + unsigned long epoch_1 = req->args[4] ^ 32836UL; + unsigned long quota_2 = req->args[5] ^ 45521UL; + if (req->opcode != 102) + return -EINVAL; + req->state += epoch_0 * 6; + req->state += kernel_1 * 28; + trace_event("nonce", req->state); + return (long) (req->state & 0x686c903a); +} + +static long syscall_entry_net13_1(struct request *req) +{ + unsigned long handle_0 = req->args[5] ^ 50541UL; + unsigned long bitmap_1 = req->args[1] ^ 50941UL; + unsigned long bitmap_2 = req->args[0] ^ 44170UL; + if (req->opcode != 245) + return -EINVAL; + req->state += shard_0 * 1; + req->state += region_1 * 27; + trace_event("vector", req->state); + return (long) (req->state & 0x4bc0d4f6); +} + +static long syscall_entry_net13_2(struct request *req) +{ + unsigned long table_0 = req->args[5] ^ 54863UL; + unsigned long guard_1 = req->args[5] ^ 35890UL; + if (req->opcode != 198) + return -EINVAL; + req->state += buffer_0 * 7; + trace_event("latch", req->state); + return (long) (req->state & 0x1fac10ca); +} + +static long syscall_entry_net13_3(struct request *req) +{ + unsigned long kernel_0 = req->args[2] ^ 32414UL; + unsigned long dentry_1 = req->args[5] ^ 10883UL; + if (req->opcode != 32) + return -EINVAL; + req->state += table_0 * 24; + trace_event("table", req->state); + return (long) (req->state & 0x509c0452); +} + +static long syscall_entry_net13_4(struct request *req) +{ + unsigned long dentry_0 = req->args[1] ^ 44418UL; + unsigned long mapper_1 = req->args[2] ^ 10025UL; + unsigned long vector_2 = req->args[3] ^ 20839UL; + if (req->opcode != 247) + return -EINVAL; + req->state += window_0 * 26; + req->state += token_1 * 24; + trace_event("cursor", req->state); + return (long) (req->state & 0x740e40ce); +} + +static long syscall_entry_net13_5(struct request *req) +{ + unsigned long offset_0 = req->args[3] ^ 42560UL; + unsigned long token_1 = req->args[4] ^ 29599UL; + unsigned long region_2 = req->args[3] ^ 13912UL; + unsigned long shard_3 = req->args[2] ^ 363UL; + if (req->opcode != 2) + return -EINVAL; + req->state += bitmap_0 * 22; + req->state += handle_1 * 22; + req->state += handle_2 * 18; + trace_event("shard", req->state); + return (long) (req->state & 0x1f655fdd); +} + +static long syscall_entry_net13_6(struct request *req) +{ + unsigned long token_0 = req->args[2] ^ 36307UL; + unsigned long nonce_1 = req->args[3] ^ 25544UL; + unsigned long cache_2 = req->args[5] ^ 48584UL; + unsigned long quota_3 = req->args[3] ^ 7524UL; + if (req->opcode != 219) + return -EINVAL; + req->state += handle_0 * 20; + req->state += journal_1 * 10; + req->state += mapper_2 * 26; + trace_event("kernel", req->state); + return (long) (req->state & 0x6542c978); +} + +static long syscall_entry_net13_7(struct request *req) +{ + unsigned long vector_0 = req->args[0] ^ 29226UL; + unsigned long kernel_1 = req->args[3] ^ 36235UL; + unsigned long slab_2 = req->args[1] ^ 37033UL; + if (req->opcode != 70) + return -EINVAL; + req->state += latch_0 * 9; + req->state += buffer_1 * 4; + trace_event("journal", req->state); + return (long) (req->state & 0x3798671b); +} + +static long syscall_entry_net13_8(struct request *req) +{ + unsigned long flags_0 = req->args[3] ^ 2159UL; + unsigned long kernel_1 = req->args[3] ^ 64570UL; + if (req->opcode != 56) + return -EINVAL; + req->state += inode_0 * 14; + trace_event("shard", req->state); + return (long) (req->state & 0x4053efc5); +} + +static long syscall_entry_net13_9(struct request *req) +{ + unsigned long offset_0 = req->args[4] ^ 65268UL; + unsigned long packet_1 = req->args[2] ^ 25932UL; + if (req->opcode != 231) + return -EINVAL; + req->state += epoch_0 * 8; + trace_event("offset", req->state); + return (long) (req->state & 0x3322f4b); +} + +const struct module_ops net_13_ops = { + .name = "net-13", + .entry_count = 10, +}; diff --git a/tests/bench-corpus/net/mod_14.c b/tests/bench-corpus/net/mod_14.c new file mode 100644 index 00000000..1b4f29e3 --- /dev/null +++ b/tests/bench-corpus/net/mod_14.c @@ -0,0 +1,127 @@ +/* bench-corpus module net/14 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net14_0(struct request *req) +{ + unsigned long window_0 = req->args[2] ^ 58492UL; + unsigned long quota_1 = req->args[1] ^ 48913UL; + if (req->opcode != 214) + return -EINVAL; + req->state += latch_0 * 12; + trace_event("journal", req->state); + return (long) (req->state & 0x31a37a3e); +} + +static long syscall_entry_net14_1(struct request *req) +{ + unsigned long kernel_0 = req->args[1] ^ 34883UL; + unsigned long buffer_1 = req->args[2] ^ 63455UL; + if (req->opcode != 148) + return -EINVAL; + req->state += packet_0 * 16; + trace_event("token", req->state); + return (long) (req->state & 0x5e1c6a3b); +} + +static long syscall_entry_net14_2(struct request *req) +{ + unsigned long region_0 = req->args[1] ^ 44327UL; + unsigned long guard_1 = req->args[5] ^ 16742UL; + if (req->opcode != 6) + return -EINVAL; + req->state += mapper_0 * 1; + trace_event("flags", req->state); + return (long) (req->state & 0x26ef60ed); +} + +static long syscall_entry_net14_3(struct request *req) +{ + unsigned long handle_0 = req->args[3] ^ 65421UL; + unsigned long offset_1 = req->args[1] ^ 36600UL; + unsigned long dentry_2 = req->args[1] ^ 51833UL; + unsigned long handle_3 = req->args[0] ^ 51835UL; + if (req->opcode != 181) + return -EINVAL; + req->state += queue_0 * 10; + req->state += quota_1 * 14; + req->state += guard_2 * 7; + trace_event("cursor", req->state); + return (long) (req->state & 0x625b3a5f); +} + +static long syscall_entry_net14_4(struct request *req) +{ + unsigned long epoch_0 = req->args[1] ^ 37693UL; + unsigned long table_1 = req->args[4] ^ 59406UL; + unsigned long mapper_2 = req->args[5] ^ 61052UL; + if (req->opcode != 211) + return -EINVAL; + req->state += dentry_0 * 24; + req->state += handle_1 * 14; + trace_event("nonce", req->state); + return (long) (req->state & 0x48e1da1c); +} + +static long syscall_entry_net14_5(struct request *req) +{ + unsigned long sector_0 = req->args[3] ^ 41084UL; + unsigned long shard_1 = req->args[4] ^ 13804UL; + unsigned long sector_2 = req->args[2] ^ 25427UL; + if (req->opcode != 131) + return -EINVAL; + req->state += guard_0 * 31; + req->state += sector_1 * 13; + trace_event("guard", req->state); + return (long) (req->state & 0x57926c42); +} + +static long syscall_entry_net14_6(struct request *req) +{ + unsigned long journal_0 = req->args[0] ^ 13550UL; + unsigned long queue_1 = req->args[0] ^ 22710UL; + unsigned long cursor_2 = req->args[4] ^ 41923UL; + if (req->opcode != 236) + return -EINVAL; + req->state += sector_0 * 25; + req->state += packet_1 * 16; + trace_event("offset", req->state); + return (long) (req->state & 0x5e9d7ec7); +} + +static long syscall_entry_net14_7(struct request *req) +{ + unsigned long queue_0 = req->args[2] ^ 64293UL; + unsigned long vector_1 = req->args[2] ^ 38250UL; + unsigned long flags_2 = req->args[2] ^ 60646UL; + unsigned long mapper_3 = req->args[3] ^ 21907UL; + if (req->opcode != 101) + return -EINVAL; + req->state += bitmap_0 * 10; + req->state += sector_1 * 10; + req->state += packet_2 * 30; + trace_event("nonce", req->state); + return (long) (req->state & 0x79cb99fd); +} + +static long syscall_entry_net14_8(struct request *req) +{ + unsigned long slab_0 = req->args[1] ^ 24361UL; + unsigned long nonce_1 = req->args[3] ^ 26682UL; + unsigned long dentry_2 = req->args[2] ^ 46311UL; + unsigned long handle_3 = req->args[5] ^ 59911UL; + if (req->opcode != 194) + return -EINVAL; + req->state += flags_0 * 16; + req->state += flags_1 * 6; + req->state += cursor_2 * 9; + trace_event("table", req->state); + return (long) (req->state & 0x54f60d64); +} + +const struct module_ops net_14_ops = { + .name = "net-14", + .entry_count = 9, +}; diff --git a/tests/bench-corpus/net/mod_15.c b/tests/bench-corpus/net/mod_15.c new file mode 100644 index 00000000..ecabf8f0 --- /dev/null +++ b/tests/bench-corpus/net/mod_15.c @@ -0,0 +1,110 @@ +/* bench-corpus module net/15 -- fixed synthetic source. + * Content is deterministic; do not regenerate or edit (see README.md). + */ + +#include "runtime.h" + +static long syscall_entry_net15_0(struct request *req) +{ + unsigned long packet_0 = req->args[2] ^ 14733UL; + unsigned long inode_1 = req->args[4] ^ 11092UL; + if (req->opcode != 172) + return -EINVAL; + req->state += journal_0 * 8; + trace_event("extent", req->state); + return (long) (req->state & 0x5ed18688); +} + +static long syscall_entry_net15_1(struct request *req) +{ + unsigned long table_0 = req->args[3] ^ 31713UL; + unsigned long kernel_1 = req->args[0] ^ 22337UL; + if (req->opcode != 239) + return -EINVAL; + req->state += shard_0 * 6; + trace_event("queue", req->state); + return (long) (req->state & 0x56103a25); +} + +static long syscall_entry_net15_2(struct request *req) +{ + unsigned long vector_0 = req->args[3] ^ 60901UL; + unsigned long flags_1 = req->args[3] ^ 19129UL; + unsigned long mapper_2 = req->args[1] ^ 19829UL; + unsigned long extent_3 = req->args[1] ^ 53178UL; + if (req->opcode != 145) + return -EINVAL; + req->state += inode_0 * 21; + req->state += inode_1 * 10; + req->state += quota_2 * 17; + trace_event("cache", req->state); + return (long) (req->state & 0x7a03c447); +} + +static long syscall_entry_net15_3(struct request *req) +{ + unsigned long epoch_0 = req->args[2] ^ 56590UL; + unsigned long vector_1 = req->args[5] ^ 36738UL; + unsigned long cache_2 = req->args[3] ^ 20203UL; + unsigned long window_3 = req->args[5] ^ 45151UL; + if (req->opcode != 244) + return -EINVAL; + req->state += latch_0 * 1; + req->state += guard_1 * 17; + req->state += table_2 * 28; + trace_event("quota", req->state); + return (long) (req->state & 0x2a41dd80); +} + +static long syscall_entry_net15_4(struct request *req) +{ + unsigned long offset_0 = req->args[3] ^ 61746UL; + unsigned long flags_1 = req->args[2] ^ 45092UL; + if (req->opcode != 140) + return -EINVAL; + req->state += latch_0 * 23; + trace_event("bitmap", req->state); + return (long) (req->state & 0xb952e67); +} + +static long syscall_entry_net15_5(struct request *req) +{ + unsigned long shard_0 = req->args[4] ^ 16080UL; + unsigned long packet_1 = req->args[0] ^ 30365UL; + unsigned long cursor_2 = req->args[3] ^ 26035UL; + unsigned long extent_3 = req->args[1] ^ 43937UL; + if (req->opcode != 169) + return -EINVAL; + req->state += slab_0 * 29; + req->state += cursor_1 * 13; + req->state += table_2 * 25; + trace_event("dentry", req->state); + return (long) (req->state & 0x1b05e063); +} + +static long syscall_entry_net15_6(struct request *req) +{ + unsigned long table_0 = req->args[1] ^ 63337UL; + unsigned long latch_1 = req->args[4] ^ 42600UL; + if (req->opcode != 224) + return -EINVAL; + req->state += bitmap_0 * 26; + trace_event("dentry", req->state); + return (long) (req->state & 0x31235871); +} + +static long syscall_entry_net15_7(struct request *req) +{ + unsigned long table_0 = req->args[0] ^ 7350UL; + unsigned long slab_1 = req->args[5] ^ 59398UL; + if (req->opcode != 69) + return -EINVAL; + req->state += handle_0 * 30; + trace_event("guard", req->state); + return (long) (req->state & 0x36e724a0); +} + +const struct module_ops net_15_ops = { + .name = "net-15", + .entry_count = 8, +}; diff --git a/tests/bench-corpus/runtime.h b/tests/bench-corpus/runtime.h new file mode 100644 index 00000000..f1b75fa4 --- /dev/null +++ b/tests/bench-corpus/runtime.h @@ -0,0 +1,12 @@ +/* bench-corpus shared header -- fixed synthetic source (see README.md). */ + +struct request { + int opcode; + unsigned long state; + unsigned long args[6]; +}; + +struct module_ops { + const char *name; + int entry_count; +}; diff --git a/tests/bench-suite.sh b/tests/bench-suite.sh new file mode 100644 index 00000000..8f0a8000 --- /dev/null +++ b/tests/bench-suite.sh @@ -0,0 +1,1194 @@ +#!/usr/bin/env bash +# bench-suite.sh -- two-tier performance benchmark suite (issue #195). +# +# Copyright 2026 elfuse contributors +# SPDX-License-Identifier: Apache-2.0 +# +# Tier 1 (microbenchmarks): lmbench (issue #195), the three benchmarks +# covering elfuse's critical execution paths: +# lat_syscall null/read/write/stat/open -- syscall entry and +# forwarding cost +# lat_proc fork and fork+execve -- process creation and the +# whole ELF load / process init path +# lat_fs file create/delete -- filesystem metadata cost +# Binaries are cross-compiled from a sha256-pinned source snapshot +# by tests/fetch-fixtures.sh (Alpine ships no lmbench package) into +# externals/test-fixtures/aarch64-musl/lmbench/; static, so the same +# artifacts run in every environment. lat_fs is invoked with lmbench's +# native `-s 1024` option, selecting one 1 KiB case rather than its +# four-size default sweep. Each metric is lmbench's own self-timed +# result (microseconds). Each invocation uses one lmbench repetition; +# the suite's outer samples provide the representative median. +# lmbench's benchmp harness forks coordination children per run, so +# a benchmark that fails or hangs (timeout) is retried once and then +# recorded as a status ERR row rather than aborting the run. +# lat_proc's exec target is the compiled-in path /tmp/hello-s, +# staged into the environment's /tmp for the duration of Tier 1. +# +# Tier 2 (application benchmarks): representative developer workloads +# over the fixed corpus in tests/bench-corpus/: +# python3 -c pass interpreter startup (python_startup_ms) +# git status fs metadata walk (git_status_ms) +# rg source search (ripgrep_ms) +# zstd compression CPU + I/O (zstd_ms) +# make process creation + fs (make_ms) +# Guest binaries come from the Alpine fixture rootfs +# (tests/fetch-fixtures.sh). Under elfuse the rootfs is copied into a +# throwaway case-sensitive APFS sparseimage: on the case-insensitive +# default volume the sidecar's hashed-name overlay makes write-heavy +# workloads unrepresentative, and guest execve() of absolute-target +# symlinks (/bin/sh -> /bin/busybox) fails, so prep also rewrites the +# copy's absolute symlinks to relative ones. The workload itself is +# identical across environments. rg searches 512 replicated source-tree +# shards (~87 MiB, tens of thousands of files) and zstd compresses an ~87 MiB +# deterministic input. Those sizes keep short command/scheduler jitter +# from dominating either measurement. +# +# Every timed invocation is wrapped in `timeout $TEST_TIMEOUT` via +# tests/lib/test-runner.sh (default here: 120s). Tier 1 self-times inside +# lmbench (BENCH_LMBENCH_TIMEOUT bounds each invocation) and Tier 2 uses +# bench-timeit. Every metric in both tiers runs +# BENCH_WARMUP + BENCH_ITERATIONS times; warmups are discarded and the +# median plus raw timed samples are reported. +# +# Usage: tests/bench-suite.sh [-o results.json] +# +# Environment: +# BENCH_ENV elfuse-aarch64 (default) | qemu-aarch64 | native | +# orbstack +# elfuse-aarch64: guests run through $ELFUSE on macOS. +# qemu-aarch64: commands run inside the fixture +# Alpine VM via tests/qemu-runner.sh (HVF + +# -cpu host where available) -- the +# same-silicon Linux-kernel reference column. +# Caveats: the guest root is the initramfs +# (tmpfs), so lat_fs and the write-heavy +# application metrics measure tmpfs rather +# than a disk filesystem, and Tier-2 samples +# are timed inside the guest by +# bench-timeit (ssh session setup would +# otherwise fold ~100 ms into ms-scale +# metrics). Recorded in meta.note. +# native: binaries run directly; meant for an +# aarch64 Linux host (Tier-2 tools from the +# host distro must be installed). +# orbstack: commands run through `orb run` in the +# default OrbStack machine (Tier-2 tools +# must be installed inside the machine). +# Workloads run in a machine-local /tmp +# work area so they exercise the machine's +# Linux filesystem, not the virtiofs macOS +# share, and are timed in-machine by +# bench-timeit. Recorded in meta.note. +# +# Tier-2 metrics are workload-only in every environment: each column +# times every sample inside its guest/machine via bench-timeit. +# The per-command entry toll each environment charges a macOS caller is +# reported separately as applications.startup_ms: elfuse = VM + sysroot +# setup + static ELF load (busybox true); orbstack = `orb run true` +# session; qemu = one ssh round-trip (the per-command cost of using the +# fixture VM interactively); native = a bare no-op spawn. +# BENCH_ITERATIONS timed samples per metric (default 10) +# BENCH_WARMUP discarded leading samples per metric (default 2) +# BENCH_STRICT 1 = missing prerequisites are fatal and fixtures +# are fetched on demand (CI); 0 = skip a tier with a +# warning when its fixtures are absent (default) +# BENCH_LMBENCH_REPS lmbench -N repetitions per outer sample +# (default 1; outer samples provide the median) +# BENCH_LMBENCH_RETRIES extra attempts for a failed/hung Tier-1 +# benchmark before its ERR row (default 1) +# BENCH_LMBENCH_TIMEOUT per-lmbench-invocation timeout in seconds +# (default 60: generous for a healthy run -- +# lat_syscall completes in ~10s -- while +# bounding the dead time of a wedged +# benchmark's attempts) +# BENCH_LMBENCH_ENOUGH lmbench ENOUGH: microseconds per timing +# interval (default 100000; empty = lmbench +# auto-calibration, ~30-40s extra per +# invocation under elfuse) +# LMBENCH_DIR dir with the lmbench fixtures (default +# externals/test-fixtures/aarch64-musl/lmbench) +# ELFUSE elfuse binary (default build/elfuse) +# BENCH_BIN_DIR dir with bench-timeit (default build/) +# TEST_TIMEOUT per-invocation timeout in seconds (default 120) +# +# Result schema (consumed by scripts/bench-compare.py; the lmbench +# section mirrors the issue #195 result format, with median and raw +# samples so results and baseline columns flatten the same way): +# { +# "schema": 1, +# "meta": { "env", "host", "date", "iterations", "warmup", ... }, +# "lmbench": { +# "lat_syscall": { +# "null": {"median": , "samples": [..], "unit": "us"}, +# "read": ..., "write": ..., "stat": ..., "open": ..., +# "": {"status": "ERR"} # failed/hung here +# }, +# "lat_proc": { "fork": ..., "exec": ... }, +# "lat_fs": { "create": ..., "delete": ... } +# }, +# "applications": { +# "python_startup_ms": {"median": , "unit": "ms", +# "samples": [..]}, ... +# } +# } +# +# Baseline refresh procedure (tests/bench-baseline.json): +# 1. Build a release elfuse on the reference host (the self-hosted CI +# runner for the elfuse-aarch64 column) and run +# make bench (elfuse-aarch64 column) +# BENCH_ENV=qemu-aarch64 make bench (qemu-aarch64 reference +# column -- same silicon, +# real Linux kernel via +# HVF; there is no +# separate -qemu target, +# BENCH_ENV picks the +# column like any other) +# until back-to-back runs agree within a few percent. Capture in +# the FOREGROUND with the host otherwise idle: macOS demotes +# background process groups to efficiency cores mid-run, which +# shows up as a 2x step in the process-spawn-heavy metrics. A +# non-default BENCH_ENV writes build/bench-results-$BENCH_ENV.json +# instead of build/bench-results.json so the two captures don't +# clobber each other. +# 2. Capture the orbstack column where hardware allows: +# BENCH_ENV=orbstack make bench +# (a Mac with OrbStack, Tier-2 tools installed inside the machine). +# 3. Promote each captured file into the baseline: +# scripts/bench-promote.py --results build/bench-results.json +# scripts/bench-promote.py \ +# --results build/bench-results-qemu-aarch64.json +# scripts/bench-promote.py \ +# --results build/bench-results-orbstack.json +# This merges medians into "environments." and records +# host/date metadata into "captured." (pass --prune when a +# case was removed or renamed so the stale key doesn't linger). +# 4. Commit the refreshed baseline together with whatever change +# shifted performance (never alone, and never with corpus edits -- +# tests/bench-corpus is part of the benchmark definition). + +set -u +set -o pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" + +: "${TEST_TIMEOUT:=120}" +# shellcheck source=tests/lib/test-runner.sh +source "${REPO_ROOT}/tests/lib/test-runner.sh" + +BENCH_ENV="${BENCH_ENV:-elfuse-aarch64}" +BENCH_ITERATIONS="${BENCH_ITERATIONS:-10}" +BENCH_WARMUP="${BENCH_WARMUP:-2}" +BENCH_STRICT="${BENCH_STRICT:-0}" +BENCH_LMBENCH_REPS="${BENCH_LMBENCH_REPS:-1}" +BENCH_LMBENCH_RETRIES="${BENCH_LMBENCH_RETRIES:-1}" +BENCH_LMBENCH_ENOUGH="${BENCH_LMBENCH_ENOUGH:-100000}" +BENCH_LMBENCH_TIMEOUT="${BENCH_LMBENCH_TIMEOUT:-60}" +# Fixed parts of the Tier-2 benchmark definition, deliberately not knobs: +# making them configurable would make captured baseline columns incomparable. +RG_SHARDS=512 +ZSTD_DOUBLINGS=9 +ELFUSE="${ELFUSE:-${REPO_ROOT}/build/elfuse}" +BENCH_BIN_DIR="${BENCH_BIN_DIR:-${REPO_ROOT}/build}" +FIXTURES="${FIXTURES:-${REPO_ROOT}/externals/test-fixtures}" +ROOTFS="${ROOTFS:-${FIXTURES}/rootfs}" +LMBENCH_DIR="${LMBENCH_DIR:-${FIXTURES}/aarch64-musl/lmbench}" +STATICBIN_BIN="${STATICBIN_BIN:-${FIXTURES}/aarch64-musl/staticbin/bin}" +CORPUS="${REPO_ROOT}/tests/bench-corpus" + +OUT_JSON="${REPO_ROOT}/build/bench-results.json" +while getopts "o:" opt; do + case "$opt" in + o) OUT_JSON="$OPTARG" ;; + *) + echo "usage: $0 [-o results.json]" >&2 + exit 2 + ;; + esac +done + +case "$BENCH_ENV" in + elfuse-aarch64 | qemu-aarch64 | native | orbstack) ;; + *) + echo "bench-suite: unknown BENCH_ENV '$BENCH_ENV'" >&2 + exit 2 + ;; +esac + +# Scratch state. SAMPLES accumulates "
" +# rows for the wall-clock Tier-2 metrics; LMROWS accumulates +# " " rows from the self-timed +# lmbench Tier-1 runs. The JSON emitter aggregates both at the end. +SCRATCH="$(mktemp -d)" +SAMPLES="${SCRATCH}/samples.txt" +LMROWS="${SCRATCH}/lmbench.txt" +: > "$SAMPLES" +: > "$LMROWS" + +# Tier-2 guest state for the elfuse environment: a throwaway +# case-sensitive sparseimage holding a copy of the fixture rootfs. +IMG="" +MNT="" +SYS="" +# Host-side work dir for the native environment. +WORK="" +# Machine-local work dir for the orbstack environment (the workloads run +# on the machine's own filesystem, not the virtiofs macOS share). +ORB_WORK="" +APPS_SKIPPED="" + +_QEMU_ACTIVE=0 + +cleanup() +{ + if [ "$_QEMU_ACTIVE" = 1 ]; then + qemu_stop 2> /dev/null || true + fi + if [ -n "$ORB_WORK" ]; then + timeout "$TEST_TIMEOUT" orb run rm -rf "$ORB_WORK" \ + > /dev/null 2>&1 || true + fi + if [ -n "$MNT" ]; then + hdiutil detach "$MNT" -quiet > /dev/null 2>&1 \ + || hdiutil detach "$MNT" -force -quiet > /dev/null 2>&1 || true + fi + [ -n "$IMG" ] && rm -f "$IMG" + [ -n "$WORK" ] && rm -rf "$WORK" + rm -rf "$SCRATCH" +} +trap cleanup EXIT + +# Boot the fixture Alpine VM for the qemu-aarch64 environment. Sourcing +# qemu-runner.sh replaces the EXIT trap with its own qemu_stop, so the +# combined cleanup is re-armed right after. +# +# Boot calibration: macOS occasionally schedules a fresh VM's vCPU +# threads on efficiency cores, which inflates every microsecond-scale +# metric by a uniform ~1.5x for the VM's whole lifetime. Probe the +# null-syscall latency after boot and reboot rather than publish a run +# that would gate against a performance-core baseline; after +# BENCH_QEMU_BOOT_RETRIES failed attempts, proceed with the warning +# recorded in meta.note. Tune BENCH_QEMU_NULL_CEILING (ns/op) when a +# reference host's performance-core latency differs from Apple +# M-series (~150 ns). +QEMU_BOOT_WARN="" +qemu_env_start() +{ + # shellcheck source=tests/qemu-runner.sh + . "${REPO_ROOT}/tests/qemu-runner.sh" + trap cleanup EXIT + bench_note "booting qemu reference VM (accel auto-selected)" + local tries=0 max="${BENCH_QEMU_BOOT_RETRIES:-2}" + local ceiling="${BENCH_QEMU_NULL_CEILING:-180}" probe + while :; do + qemu_start || bench_die "qemu VM failed to boot" + _QEMU_ACTIVE=1 + if [ ! -x "${LMBENCH_DIR}/lat_syscall" ]; then + bench_note "qemu VM ready (accel=$QEMU_ACCEL cpu=$QEMU_CPU, uncalibrated)" + return 0 + fi + probe=$(qemu_exec timeout "$BENCH_LMBENCH_TIMEOUT" env \ + "ENOUGH=${BENCH_LMBENCH_ENOUGH:-100000}" \ + "${LMBENCH_DIR}/lat_syscall" -N 1 null 2>&1 \ + | awk -F': ' '$1 == "Simple syscall" \ + { split($2, a, " "); printf "%.0f", a[1] * 1000; exit }') + if awk -v p="${probe:-999999}" -v c="$ceiling" \ + 'BEGIN { exit !(p <= c) }'; then + bench_note "qemu VM ready (accel=$QEMU_ACCEL cpu=$QEMU_CPU null=${probe}ns)" + return 0 + fi + tries=$((tries + 1)) + if [ "$tries" -gt "$max" ]; then + QEMU_BOOT_WARN="vm slow after $max reboots: null-syscall=${probe}ns > ${ceiling}ns ceiling (efficiency-core placement?)" + bench_note "WARNING: $QEMU_BOOT_WARN" + return 0 + fi + bench_note "boot calibration: null=${probe}ns > ${ceiling}ns; rebooting VM ($tries/$max)" + qemu_stop + _QEMU_ACTIVE=0 + done +} + +bench_die() +{ + echo "bench-suite: $*" >&2 + exit 1 +} + +bench_note() +{ + printf "%s %s\n" "${BLUE}bench:${RESET}" "$*" +} + +# --------------------------------------------------------------------------- +# Tier 1: microbenchmarks +# --------------------------------------------------------------------------- + +# Full argv (including its timeout guard) for one Tier-1 run in the +# elfuse/native/orbstack environments. Tier-1 binaries are static +# aarch64-linux executables, so they run directly on native Linux and +# inside the OrbStack machine; the qemu environment is handled by +# lmbench_exec's remote shell line instead (see below). +# +# BENCH_LMBENCH_ENOUGH pins lmbench's per-timing-interval length +# (microseconds) via its standard ENOUGH knob, injected with env(1) in +# front of the benchmark so it reaches the guest in every transport. +# Without it lmbench auto-calibrates the interval, which costs ~30-40s +# of fixed calibration per invocation under elfuse; 100ms intervals +# keep a whole Tier-1 pass below ten minutes on the self-hosted M4 runner +# while still running syscall metrics hundreds of thousands of iterations +# per interval. Set +# BENCH_LMBENCH_ENOUGH= (empty) to restore lmbench's own calibration. +# +# elfuse-aarch64 runs the lmbench binary through a busybox sh wrapper +# rather than as elfuse's direct argv (which makes it guest PID 1). +# lmbench's benchmp() forks a child for every measurement and that +# child's benchmp_interval() treats getppid() == 1 as "my parent died, +# I've been reparented to init -- give up" (a standard, normally-safe +# idiom). When the benchmarked binary itself is PID 1, its own fork +# children have real, live ppid == 1, so the very first fork trips +# this false-positive: the child exits immediately without ever +# signaling readiness on lmbench's control pipe, and lmbench's parent +# side has no timeout on that read -- it spins forever re-polling the +# now-closed pipe. Never observed on native/orbstack (both already run +# under a normal init) or qemu (lmbench_exec's remote shell line +# already puts an sshd session between init and the benchmark). See +# issue #195 lmbench-fork-wedge notes. +tier1_cmd() +{ + local envp=() + if [ -n "$BENCH_LMBENCH_ENOUGH" ]; then + envp=(env "ENOUGH=${BENCH_LMBENCH_ENOUGH}") + fi + case "$BENCH_ENV" in + elfuse-aarch64) + printf '%s\n' timeout "$TEST_TIMEOUT" \ + ${envp[@]+"${envp[@]}"} "$ELFUSE" \ + "${STATICBIN_BIN}/busybox" sh -c '"$0" "$@"; exit $?' "$@" + ;; + native) + printf '%s\n' timeout "$TEST_TIMEOUT" \ + ${envp[@]+"${envp[@]}"} "$@" + ;; + orbstack) + printf '%s\n' timeout "$TEST_TIMEOUT" orb run \ + ${envp[@]+"${envp[@]}"} "$@" + ;; + esac +} + +# Kill benchmark processes that outlive a failed or timed-out attempt. +# timeout(1) signals only its direct child; lmbench's benchmp children +# survive it, and a wedged one spins at full CPU (distorting every +# later measurement) or holds an inherited pipe open. elfuse guest +# processes carry a " (aarch64-linux)" proctitle; native and +# orbstack stragglers keep the fixture path in their argv (the [/] +# regex trick stops pkill -f matching its own command line). The qemu +# environment reaps inside the remote shell line in lmbench_exec. +lmbench_reap_stragglers() +{ + local b + case "$BENCH_ENV" in + elfuse-aarch64) + for b in lat_syscall lat_proc lat_fs hello-s; do + pkill -9 -f "$b \\(aarch64-linux\\)" 2> /dev/null + done + ;; + native) + pkill -9 -f 'aarch64-musl/lmbench[/]' 2> /dev/null + ;; + orbstack) + timeout "$TEST_TIMEOUT" orb run pkill -9 -f \ + 'aarch64-musl/lmbench[/]' \ + > /dev/null 2>&1 + ;; + esac + return 0 +} + +# Run one lmbench binary through the environment transport and echo its +# combined output (lmbench prints results to stderr). Every attempt is +# bounded by BENCH_LMBENCH_TIMEOUT (dynamic-scope TEST_TIMEOUT override +# for tier1_cmd), and a failed attempt reaps straggler benchmark +# processes before the caller retries. +# +# qemu does not go through tier1_cmd: the benchmark runs inside one +# remote shell line that (a) sends its output to a guest file rather +# than the ssh channel -- benchmp children orphaned by the guest +# timeout inherit the channel and would otherwise hold the ssh session +# open indefinitely -- and (b) pkills stragglers on failure, guest-side. +# Repo paths are rewritten to /mnt/host by hand because they sit inside +# the sh -c string where qemu_exec's per-argument rewrite cannot reach. +lmbench_exec() +{ + if [ "$BENCH_ENV" = "qemu-aarch64" ]; then + local script="" a q + local remote_timeout=$((BENCH_LMBENCH_TIMEOUT + 10)) + for a in "$@"; do + case "$a" in + "${REPO_ROOT}"/*) a="/mnt/host${a#"${REPO_ROOT}"}" ;; + esac + printf -v q '%q' "$a" + script="$script $q" + done + script="timeout ${BENCH_LMBENCH_TIMEOUT}${script}" + if [ -n "$BENCH_LMBENCH_ENOUGH" ]; then + script="ENOUGH=${BENCH_LMBENCH_ENOUGH} ${script}" + fi + # The outer guard includes cleanup margin so the inner timeout can + # fire first and the shell can reap any benchmp stragglers. + qemu_exec timeout "$remote_timeout" sh -c \ + "${script} > /tmp/.lmbench.out 2>&1; rc=\$?; [ \$rc -ne 0 ] && pkill -9 -f 'aarch64-musl/lmbench[/]' 2> /dev/null; cat /tmp/.lmbench.out; rm -f /tmp/.lmbench.out; exit \$rc" + return $? + fi + + local TEST_TIMEOUT="$BENCH_LMBENCH_TIMEOUT" + local cmd=() line rc=0 + while IFS= read -r line; do + cmd+=("$line") + done < <(tier1_cmd "$@") + "${cmd[@]}" 2>&1 || rc=$? + if [ "$rc" -ne 0 ]; then + lmbench_reap_stragglers + fi + return $rc +} + +# lmbench_metric