Skip to content

nvidia: fix shadowed agent usb disconnect + suppress teardown replug prompts - #283

Open
lee-reinhardt wants to merge 2 commits into
wrynosefrom
initrd-flash-agent-unshadow
Open

nvidia: fix shadowed agent usb disconnect + suppress teardown replug prompts#283
lee-reinhardt wants to merge 2 commits into
wrynosefrom
initrd-flash-agent-unshadow

Conversation

@lee-reinhardt

Copy link
Copy Markdown
Member

Problem

The wrynose BSP rebase re-imported upstream copies of seven initrd-flash.sh helper functions without removing the agent-aware block grafted at the top of the file. Bash keeps the later definition, so the live disconnect_usb_device was the plain sysfs-only copy and _twiddle_via_agent (plus the device-gone idempotency guard) was dead code. Any provision running inside the avocado-vm would hang at the first cable-cycle point with no prompt anywhere, since the authorized=0 toggle is a no-op through vhci_hcd.

Separately, the teardown-prompt fix from #277 (scarthgap) had not been ported, so once the agent path is live again, the releases in get_final_status_t234 and the end-of-script lingering-device deauthorize would each age out the host's 120s replug waiter after flashing already completed.

Change

Commit 1 — remove the duplicates. Six of the seven pairs are byte-identical modulo whitespace; only disconnect_usb_device differs, by exactly the agent path and the device-gone guard. Keep the agent-aware copy, delete the shadowing re-imports. Pure deletion, −202 lines.

Commit 2 — port the relevant half of #277:

  • disconnect_usb_device gains an optional no-prompt mode (threaded through unmount_and_release): teardown/cleanup releases never engage the agent, keeping only the free sysfs toggle. Applied to get_final_status_t234's release and the end-of-script deauthorize.
  • _twiddle_via_agent prints ACTION NEEDED: unplug and replug the device's USB cable to continue provisioning to stderr before blocking, so CLI-driven provisions surface the prompt in the terminal instead of stalling silently.
  • The reuse-cycle mode from nvidia: suppress redundant usb twiddle prompts in initrd-flash #277 is intentionally not ported: the back-to-back double disconnect in generate_flash_package that required it does not exist in the wrynose flow.

With AVOCADO_AGENT_SOCK unset (bare Linux / CI), every call site behaves exactly as before in all modes.

Validation

  • bash -n clean; no duplicate function definitions remain (verified by scan).
  • 13-case stub harness (real _twiddle_via_agent / disconnect_usb_device / unmount_and_release extracted from this file, fake agent on a real AF_UNIX socket): mode threading, device-gone idempotency, prompt emission, and no-agent parity all pass.
  • Hardware bench on a Jetson Orin Nano is pending a wrynose Orin runtime build; the equivalent scarthgap change was validated end-to-end on real hardware in nvidia: suppress redundant usb twiddle prompts in initrd-flash #277.

…connect

the wrynose bsp rebase re-imported upstream copies of seven helper
functions without removing the agent-aware block, so the later
definitions won at runtime. the live disconnect_usb_device was the
plain sysfs-only copy, leaving _twiddle_via_agent (and the device-gone
idempotency guard) as dead code: provisioning inside the avocado-vm
would hang at the first cable-cycle point with no prompt, since the
authorized toggle is a no-op through vhci_hcd.

six of the seven pairs were byte-identical modulo whitespace; only
disconnect_usb_device differed, by exactly the agent path. keep the
agent-aware copy and delete the shadowing duplicates.
port of the twiddle-dedup fix from scarthgap (#277), adapted to the
wrynose t234/t264 split. the teardown releases in get_final_status_t234
and the end-of-script lingering-device deauthorize ran after flashing
completed, so each agent request aged out the host's 120s replug waiter
before falling back to the sysfs toggle, adding dead wait to every
successful provision. a new optional no-prompt mode on
disconnect_usb_device (threaded through unmount_and_release) keeps
those call sites on the free sysfs path.

the reuse-cycle mode from #277 is intentionally not ported: the
back-to-back double disconnect in generate_flash_package that needed it
does not exist in the wrynose flow.

also print an ACTION NEEDED line before blocking on the agent so
cli-driven provisions surface the replug prompt in the terminal instead
of stalling silently.

with AVOCADO_AGENT_SOCK unset, every call site behaves exactly as
before in all modes.
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