Skip to content

driver: Bring the spare slot up to date after a commit - #512

Draft
chrysh wants to merge 1 commit into
OpenPRoT:ocp-global-demo-wipfrom
9elements:slot-resync
Draft

chrysh wants to merge 1 commit into
OpenPRoT:ocp-global-demo-wipfrom
9elements:slot-resync

Conversation

@chrysh

@chrysh chrysh commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Rebased onto ocp-global-demo-wip now that #511 merged. One commit, no stack note. The only rebase fix was Event::UpdateVerified, which no longer carries a component id.

This is SOW P7, "additional partitions up to date", in its cheaper shape.

A commit re-stages the image that just proved itself, so the slot the device stopped booting from stops holding the version from before the update. Nothing activates afterwards: the payload lands in the inactive slot and stays there.

It re-stages rather than copying between slots, because Updatable keeps slot identity on the device's side ("which slot is inactive is device state"). The candidate is still in the staging region: the machine runs one job at a time, so nothing has overwritten it since the activation. The cost is a second full transfer. Copying between slots instead needs a seam that names them, which is the larger decision, parked for the week of 2026-10-11.

The pump runs the pass, not the commit executor: a transfer takes minutes and an executor must return promptly. The SM is never told the result, because a verdict would start a second activation of an image the device already runs. A device that fails the pass reports SlotResyncFailed and the job ends there, with the running image committed either way.

Rebase note: the merged pump parks at Staged and emits no UpdateVerified until the crypto verify client (#490) is wired, and the candidate-verifier seam this branch was written against did not survive into #506. The tests here pump until the device holds the payload and then dispatch the verdict directly, so they exercise what follows activation rather than the pump reaching it. The verify session and UpdateVerifier board seam the earlier revision carried are gone with it; abandon_job only tells the device to drop what it was staging.

Two things this assumes, both worth a second opinion:

Staged bytes in the spare slot are what a fallback boots. Updatable says writes go to the inactive slot and activate flips the metadata, but it does not say a slot written and never activated is bootable. That is the staging-is-inert slot question from the #431 follow-ups, still open with Anthony.

An update that is submitted and then discarded between the activation and the confirmed boot cancels the re-sync for good: the region changed hands, so re-staging from it would write the wrong image. The spare slot then keeps pre-update firmware and nothing reports it, because by commit time the driver cannot tell that case from "no update to re-sync". Telling them apart needs a tombstone, which I have not added.

A commit re-stages the image that just proved itself, so the slot the
device stopped booting from stops holding the version before the
update. Nothing activates afterwards: the payload lands in the inactive
slot and stays there, which is what a fallback needs.

Re-stages rather than copying between slots, because Updatable keeps
slot identity on the device's side. The candidate is still in the
staging region, which submit_update and discard_staged keep true by
dropping the queued re-sync whenever the region changes hands. The cost
is a second full transfer; copying between slots needs a seam that
names them, which is a larger decision.

The pump runs the pass, not the commit executor: a transfer takes
minutes and an executor must return promptly. The SM is never told the
result, because a verdict would start a second activation of an image
the device already runs. A device that fails or stalls the pass is
reported as SlotResyncFailed and the job ends there, with the running
image committed either way.

A re-sync occupies the job while it runs, so an update requested
mid-pass is deferred: the candidate would overwrite the bytes being
written.

Assisted-by: Claude

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.

1 participant