Skip to content

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

Merged
ben-zen merged 7 commits intomicrosoft:mainfrom
ben-zen:mana-failure-tracing
Apr 15, 2026
Merged

netvsp & mana_driver - Improve failure identification & improve cleanup#3146
ben-zen merged 7 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 extends the endpoint shutdown logic with an extra cleanup step to force the release of netvsp's retained Vport instance, as well as to ensure that the senders for those now-disconnected endpoints are shut down afterwards.

@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.

Comment thread vm/devices/net/mana_driver/src/mana.rs
@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.

@ben-zen ben-zen force-pushed the mana-failure-tracing branch from 55bffa1 to df247ec Compare March 30, 2026 16:51
Copilot AI review requested due to automatic review settings March 30, 2026 18:05
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

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

Comment thread openhcl/underhill_core/src/emuplat/netvsp.rs Outdated
@ben-zen ben-zen force-pushed the mana-failure-tracing branch from 098faaa to 7cfdf6e Compare March 31, 2026 17:48
Copilot AI review requested due to automatic review settings March 31, 2026 17:48
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

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

Comment thread openhcl/underhill_core/src/emuplat/netvsp.rs
Copy link
Copy Markdown
Contributor

@erfrimod erfrimod left a comment

Choose a reason for hiding this comment

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

LGTM

erfrimod
erfrimod previously approved these changes Apr 2, 2026
Copilot AI review requested due to automatic review settings April 2, 2026 20:42
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@benhillis benhillis added the enhancement New feature or request label Apr 6, 2026
erfrimod
erfrimod previously approved these changes Apr 9, 2026
Comment thread openhcl/underhill_core/src/emuplat/netvsp.rs
Copilot AI review requested due to automatic review settings April 14, 2026 17:03
@ben-zen ben-zen force-pushed the mana-failure-tracing branch from 24465a9 to 1d99489 Compare April 14, 2026 17:03
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comment thread vm/devices/net/mana_driver/src/mana.rs
Comment thread vm/devices/net/mana_driver/src/mana.rs
Comment thread openhcl/underhill_core/src/emuplat/netvsp.rs
Comment thread openhcl/underhill_core/src/dispatch/vtl2_settings_worker.rs
@ben-zen ben-zen force-pushed the mana-failure-tracing branch from 1d99489 to e625841 Compare April 14, 2026 21:20
@ben-zen ben-zen merged commit 6796eb6 into microsoft:main Apr 15, 2026
87 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants