Serialize hardware plans on a host device lock#136
Merged
Conversation
execute_plan_steps takes an endpoint_bdf: when set, the whole plan run is held under a host-global advisory flock keyed on that device (device_lock_path: a FIXED /var/lock-or-/tmp path, never TMPDIR-sensitive gettempdir). A board is one exclusive resource, so no two hardware plans — from any process, session, or a direct CLI flash — remove/reset/program the same endpoint at once. The hardware-plan task passes the composed endpoint BDF; a device-less plan runs unserialized. Proven by an interleave test. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Executed hardware plans (execute=true) now take a per-device advisory lock keyed on the endpoint BDF, so two overlapping runs cannot remove/reset/program the same board at once.
The lock lives in the user-private runtime dir ($XDG_RUNTIME_DIR/dau, else ~/.dau/locks), opened with O_NOFOLLOW — no world-writable /tmp attack surface. Serializes the operator's own processes; a bench is single-operator. The BDF is lower-cased before keying so equivalent spellings map to one lock.