feat(spec2006): add dual-hart Linux checkpoint workloads#31
Conversation
poemonsense
left a comment
There was a problem hiding this comment.
For the dts gen, we should migrate https://github.com/OpenXiangShan/nemu_board to workload-builder in the next steps.
There was a problem hiding this comment.
Pull request overview
This PR adds support for building and packaging Linux SPEC2006 workloads for dual-hart (multi-hart) checkpoint restore flows, including per-hart SPEC trees, CPU-pinned launch scripts, and a matching multi-hart DTB selection + DTS template/generation pipeline. It also switches firmware startup selection to use LibCheckpoint in multi-hart mode while keeping LibCheckpointAlpha for single-hart builds, and updates Buildroot to include BusyBox taskset.
Changes:
- Add multi-hart rootfs packaging (per-hart SPEC copies, pinned launcher, inittab rewrite) and wire it into Linux workload packaging.
- Add multi-hart XiangShan DTS generation flow + checked-in 2-hart/8GiB DTS template, and select it by default when
MULTIHART=1. - Switch GCPT build selection between LibCheckpointAlpha (single-hart) and LibCheckpoint
--mode=dual_core(multi-hart), and enable BusyBoxtaskset.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| workloads/linux/spec2006/spec2006-package.py | Allow overriding SPEC working directory via SPEC_ROOT for per-hart runs. |
| workloads/linux/spec2006/rules.mk | Add multi-hart variables, default DTB selection, rebuild stamping, and multihart packaging integration. |
| workloads/linux/spec2006/README.md | Document multi-hart build usage, layout, and DTB template requirement. |
| scripts/package-multihart-rootfs.py | New transformer to split a single /spec into per-hart copies + launcher and update inittab. |
| scripts/generate-xiangshan-multihart-dts.py | New generator to produce multi-hart XiangShan DTS templates from a base template. |
| scripts/build-workload-linux.sh | Invoke multi-hart rootfs packaging when MULTIHART=1. |
| scripts/build-gcpt.sh | Support building either LibCheckpointAlpha or LibCheckpoint (with mode selection). |
| scripts/build-firmware-linux.sh | Fail fast if selected DTB template is missing before building DTBs. |
| README.md | Document multi-hart SPEC build usage and firmware layout differences. |
| Makefile | Add top-level MULTIHART/HARTS plumbing, DTB default selection, and GCPT implementation selection. |
| dts/xiangshan-fpga-noAIA-2hart-mem8g.dts.in | Add checked-in 2-hart, 8GiB XiangShan FPGA DTS template for multi-hart runs. |
| dts/README.md | Document multi-hart DTS template naming and how to run the generator. |
| br2-external/configs/nemu_defconfig | Enable BusyBox config fragment for taskset. |
| br2-external/board/openxiangshan/nemu/busybox-taskset.fragment | New BusyBox fragment enabling taskset and related features. |
| .gitmodules | Add LibCheckpoint submodule for multi-hart firmware builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| SPEC2006_GCPT_ELF ?= $(if $(GCPT_ELF),$(GCPT_ELF),$(SPEC2006_REPO_ROOT)/build/$(if $(filter 1,$(MULTIHART)),LibCheckpoint,LibCheckpointAlpha)/build/gcpt) | ||
| SPEC2006_GCPT_BIN ?= $(if $(GCPT_BIN),$(GCPT_BIN),$(SPEC2006_REPO_ROOT)/build/$(if $(filter 1,$(MULTIHART)),LibCheckpoint,LibCheckpointAlpha)/build/gcpt.bin) |
| DEFAULT_DTB="${DEFAULT_DTB:-xiangshan}" | ||
| CLINT_MMIO="${CLINT_MMIO:-$(extract_clint_mmio "$DTS_TEMPLATE_DIR" "$DEFAULT_DTB")}" | ||
| export CFLAGS="${CFLAGS:-} -DCONFIG_CLINT_MMIO=$CLINT_MMIO" | ||
| make -C "$GCPT_BUILD_DIR" |
| if harts < 2: | ||
| raise argparse.ArgumentTypeError("HARTS must be at least 2") | ||
| return harts |
Summary
before_workloadandafter_workloadhooks for each workload copy.MULTIHART=1.tasksetapplet required by the multi-hart launcher.LibCheckpoint --mode=dual_corefor multi-hart firmware while retainingLibCheckpointAlphafor single-hart images.HARTS=2restriction.Scope
Multi-hart checkpoint generation is currently limited to two harts because the supported QEMU checkpoint format and
LibCheckpointrecovery mode are dual-core only.