Skip to content

Commit 0a825f2

Browse files
committed
Add kernel syscall-prune build cycle
The existing PGO cycle bundles config-only, syscall-prune, and layout-ordering candidates into a single rebuild loop. When all we want is the syscall-prune verdict (e.g. tightening the prune table after a userspace change), paying for the layout-ordering detour is wasteful, and the QEMU trace + analyze step gets re-run on every invocation. build.sh grows kernel_syscall_prune_cycle alongside the existing kernel_pgo_cycle: same primitives (build_candidate_kernel, boot_not_regressed, restore_kernel_artifacts), but only baseline / config-only / syscall-prune candidates, defaulting QEMU_LOG to exec,cpu,in_asm so the R7 dumps needed for syscall extraction are present. The stage selects the smallest linux.axf that does not regress shell_ready_ms, mirroring the existing cycle's selection rule. prepare_kernel_profile_analysis extracts the trace-collect+analyze pair into a shared helper keyed on (IMAGE_FP, sha256(workload), trace selector). Both cycles share the namespace but resolve to distinct cache directories via the trace tag, so PGO's exec,in_asm trace and the new cycle's exec,cpu,in_asm trace do not collide. IMAGE_FP already covers scripts/, configs/, patches/, and build.sh, so any change that affects the baseline binary or the analysis tooling invalidates the cache. materialize_cache_tree uses cp -f rather than hardlinks: link_cached_tree exposes cache files via symlinks in working dirs, and a hardlink would let any future writer that follows that symlink mutate the cache through a shared inode. cp -f makes the cache the canonical copy. scripts/qemu-trace-to-orderfile.py rewrites the syscall pairing state machine to match QEMU's actual -d cpu ordering: register dumps precede the TB whose entry state they capture. The previous code kept a backward-binding fallback that, when a TB without a preceding regdump showed up (orphan TB), bound the next R07 to the orphan instead of holding it for the upcoming TB. In a real trace this silently misattributes or drops syscalls and feeds a wrong prune table. pending_tb is dropped entirely; an R07 always binds forward to the next TB or stays pending until one arrives. scripts/test_qemu_trace_to_orderfile.py covers the happy path, the orphan-TB regression (which fails under the old backward-binding), and the MAX_ARM_SYSCALL boundary at 511/512. Three Python script invocations gain an explicit python3 prefix. generate-syscall-prune-table.py is committed as 100644, so calling it via the bare path raised Permission denied; the other two are defensive consistency.
1 parent 1edb897 commit 0a825f2

5 files changed

Lines changed: 429 additions & 35 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ jobs:
183183
qemu-system-arm
184184
185185
- name: Download build image
186-
uses: actions/download-artifact@v5
186+
uses: actions/download-artifact@v6
187187
with:
188188
name: bootable-image
189189
path: bootwrapper

.github/workflows/rollup-comment.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
3131
steps:
3232
- name: Download subsystem rollup artifact
33-
uses: actions/download-artifact@v5
33+
uses: actions/download-artifact@v6
3434
with:
3535
name: subsystem-rollup
3636
path: rollup
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: Resolve PR number
4141
id: pr
42-
uses: actions/github-script@v8
42+
uses: actions/github-script@v9
4343
with:
4444
script: |
4545
const run = context.payload.workflow_run;
@@ -64,7 +64,7 @@ jobs:
6464
6565
- name: Upsert comment
6666
if: steps.pr.outputs.number != ''
67-
uses: actions/github-script@v8
67+
uses: actions/github-script@v9
6868
env:
6969
# Pass the PR number through the environment instead of
7070
# interpolating it directly into the script body. Template
@@ -75,13 +75,24 @@ jobs:
7575
with:
7676
script: |
7777
const fs = require('fs');
78-
// upload-artifact@v4+ preserves workspace-relative paths,
79-
// so the markdown lives at its original profiles/ path
80-
// inside the downloaded folder.
81-
const body = fs.readFileSync(
78+
const candidates = [
79+
// download-artifact extracts the common parent of the
80+
// uploaded files, so the current artifact lands flat at
81+
// the destination root.
82+
'rollup/subsystem-rollup.md',
83+
// Keep accepting the older nested layout in case the
84+
// upload path changes again.
8285
'rollup/profiles/kernel-pgo/none/subsystem-rollup.md',
83-
'utf8',
86+
];
87+
const bodyPath = candidates.find(candidate =>
88+
fs.existsSync(candidate)
8489
);
90+
if (!bodyPath) {
91+
throw new Error(
92+
`subsystem rollup markdown not found; checked: ${candidates.join(', ')}`
93+
);
94+
}
95+
const body = fs.readFileSync(bodyPath, 'utf8');
8596
const marker = '<!-- subsystem-rollup-comment -->';
8697
const { owner, repo } = context.repo;
8798
const issue_number = Number(process.env.PR_NUMBER);

0 commit comments

Comments
 (0)