Skip to content

netvsp & mana_driver - Improve failure identification & improve cleanup#3146

Open
ben-zen wants to merge 2 commits intomicrosoft:mainfrom
ben-zen:mana-failure-tracing
Open

netvsp & mana_driver - Improve failure identification & improve cleanup#3146
ben-zen wants to merge 2 commits intomicrosoft:mainfrom
ben-zen:mana-failure-tracing

Conversation

@ben-zen
Copy link
Copy Markdown
Contributor

@ben-zen ben-zen commented Mar 27, 2026

Arc::<T>::into_inner() returns Some(T) or None, and a call to unwrap() that returned result will panic with no clear error message; in cases where all clones of an Arc will eventually have into_inner() called on them, the resource will eventually be de-reference-counted and ultimately released, but the clones of ManaDevice::inner are stored in Vports which need to be cleaned up before one of the expected terminal states of the ManaDevice is reached.

This change replaces .unwrap() with .expect() on both calls to extract ManaDevice::inner from its Arc, and adds a cleanup step to force the release of netvsp's retained Vport instances.

@ben-zen ben-zen requested a review from a team as a code owner March 27, 2026 22:46
Copilot AI review requested due to automatic review settings March 27, 2026 22:46
@ben-zen ben-zen force-pushed the mana-failure-tracing branch from b45d0bc to 55bffa1 Compare March 27, 2026 22:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves diagnosability of rare shutdown/save failures in the MANA VF driver by adding explicit panic messages when Arc::into_inner() fails, and ensures netvsp drops packet-capture controls during endpoint teardown to help release retained vport references.

Changes:

  • Replace unwrap() with expect() for Arc::into_inner(self.inner) in ManaDevice::{save,shutdown} to provide clearer failure identification.
  • Clear pkt_capture_controls after disconnecting endpoints to force-drop any retained packet capture controls during teardown.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
vm/devices/net/mana_driver/src/mana.rs Adds clearer expect() messages when unwrapping the device inner Arc during save/shutdown.
openhcl/underhill_core/src/emuplat/netvsp.rs Ensures packet capture controls are dropped after endpoint disconnect to help release retained vport references.

@ben-zen
Copy link
Copy Markdown
Contributor Author

ben-zen commented Mar 27, 2026

We discussed in the team that it's odd that Vport holds an Arc<Inner> if it should also be cleaned up before shutdown(). I looked at converting that Arc<Inner> to a Weak<Inner> & the blast radius of that change is, though not small, not huge either.

If that's seen as worthwhile, I plan to bring it as a separate patch as this is a targeted set of changes that are worthwhile in of themselves.

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.

2 participants