Skip to content

feat(spec2006): add dual-hart Linux checkpoint workloads#31

Merged
rezado merged 4 commits into
mainfrom
feature/multihart-linux-workloads
Jul 17, 2026
Merged

feat(spec2006): add dual-hart Linux checkpoint workloads#31
rezado merged 4 commits into
mainfrom
feature/multihart-linux-workloads

Conversation

@rezado

@rezado rezado commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add multi-hart SPEC2006 rootfs packaging, including one workload copy per hart and CPU-pinned launch scripts.
  • Add before_workload and after_workload hooks for each workload copy.
  • Add a generated XiangShan multi-hart DTS flow and the checked-in two-hart, 8 GiB DTS template.
  • Select the matching multi-hart DTB when MULTIHART=1.
  • Add the BusyBox taskset applet required by the multi-hart launcher.
  • Use LibCheckpoint --mode=dual_core for multi-hart firmware while retaining LibCheckpointAlpha for single-hart images.
  • Document the firmware layout and the current HARTS=2 restriction.

Scope

Multi-hart checkpoint generation is currently limited to two harts because the supported QEMU checkpoint format and LibCheckpoint recovery mode are dual-core only.

@rezado
rezado requested a review from poemonsense July 16, 2026 03:45

@poemonsense poemonsense left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the dts gen, we should migrate https://github.com/OpenXiangShan/nemu_board to workload-builder in the next steps.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BusyBox taskset.

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.

Comment on lines +34 to +35
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)
Comment thread scripts/build-gcpt.sh
Comment on lines +46 to +49
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"
Comment on lines +12 to +14
if harts < 2:
raise argparse.ArgumentTypeError("HARTS must be at least 2")
return harts
@rezado
rezado merged commit bf153a7 into main Jul 17, 2026
3 checks passed
@rezado
rezado deleted the feature/multihart-linux-workloads branch July 17, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants