Skip to content

atelet, hardware: record cpu_features from runsc cpu-features --bitmask - #3825

Open
Shrutiya Mohan (shrutiyam-glitch) wants to merge 3 commits into
agent-substrate:mainfrom
shrutiyam-glitch:cpu-features-bitmask
Open

Shrutiya Mohan (shrutiyam-glitch) wants to merge 3 commits into
agent-substrate:mainfrom
shrutiyam-glitch:cpu-features-bitmask

Conversation

@shrutiyam-glitch

@shrutiyam-glitch Shrutiya Mohan (shrutiyam-glitch) commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3828

atelet previously ran runsc cpu-features and mapped the printed feature names to bit numbers through per-architecture tables in internal/hardware. That required updating the tables whenever gVisor added a CPU feature, or the probe would fail on the unknown name.

Since gVisor release 20261026.0 (google/gvisor@3fdb673dc0a3), runsc cpu-features --bitmask prints the feature set directly as comma-separated 0x%08x uint32 block bitmasks in the same bit numbering cpu_features uses. gvisor-default in release 1.0.0 already ships 20261026.0 and 20261102.0, so --bitmask works across 1.0 to 1.1 upgrades and rollbacks under the version skew policy.

  • Run runsc cpu-features --bitmask in runRunscCPUFeatures and encode the blocks with hardware.EncodeCPUFeatureMask. The stored cpu_features string is unchanged, so existing snapshots keep matching.
  • Remove the CPU feature name tables (cpufeatures_table.go), EncodeCPUFeatures, and DecodeCPUFeatures.
  • Document in docs/reference/api-guide.md that custom gvisor SandboxConfigs require gVisor release 20261026.0 or newer, and how atelet handles older releases.

Verified on a GKE cluster: after upgrading atelet, the existing worker and a new one on the same node both record cpu_features 2e500800004003f30000000700400004219c01ab178bfbfffef83203, identical to the value the pre-upgrade atelet recorded through the name tables.

AI disclosure: Used an AI coding assistant to check runsc cpu-features --bitmask support in gVisor and review the diff.

  • Tests pass
  • Docs updated

runsc prints its feature set as a bitmask since gVisor release
20261026.0, in the numbering the cpu_features attribute already uses.
Probe with --bitmask and encode the blocks directly, so a gVisor feature
newer than the name tables no longer fails the probe. The recorded value
is unchanged, so snapshots taken before this keep matching.

An older runsc fails the probe permanently. ateworker-gvisor needs that
release anyway, as the gvisor-default SandboxConfig notes.

Signed-off-by: Shrutiya <shrutiyam@google.com>
atelet no longer maps runsc feature names to bits, so the tables,
EncodeCPUFeatures and DecodeCPUFeatures have no callers outside their
tests.

Signed-off-by: Shrutiya <shrutiyam@google.com>
Document in the API guide that gVisor SandboxConfigs require release
20261026.0 or newer. Older runsc binaries lack `runsc cpu-features
--bitmask` and the `-no-root-container` restore fix. Describe how
atelet handles an older release when a SandboxConfig lists one.
Update EncodeCPUFeatureMask to ignore all-zero blocks past 12 blocks.
`runsc` prints blocks up to its highest compiled feature even when
those bits are zero on the host, so a future runsc with a 13th block
would otherwise fail on existing CPUs. Non-zero bits past 12 blocks
still fail.
Update the cpuFeaturesTimeout comment in atelet to reference
`runsc cpu-features --bitmask`.

Signed-off-by: Shrutiya <shrutiyam@google.com>

This branch has not been deployed

No deployments
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.

atelet, hardware: use runsc cpu-features --bitmask and remove hardcoded CPU feature tables

1 participant