Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add an option to control nested virtualization - #7408

Merged
rbradford merged 6 commits into
cloud-hypervisor:mainfrom
russell-islam:muislam/mshv-nested-feature
Dec 3, 2025
Merged

rbradford merged 6 commits into
cloud-hypervisor:mainfrom
russell-islam:muislam/mshv-nested-feature

Conversation

@russell-islam

Copy link
Copy Markdown
Contributor

No description provided.

@russell-islam
russell-islam requested a review from a team as a code owner October 9, 2025 20:04
@russell-islam
russell-islam marked this pull request as draft October 9, 2025 20:20
@russell-islam
russell-islam force-pushed the muislam/mshv-nested-feature branch from 3c26210 to f2847cb Compare October 9, 2025 20:30
@liuw

liuw commented Oct 9, 2025

Copy link
Copy Markdown
Member

I assume there isn't an option for KVM?

We should take into consideration we may want to provide very fine-grained configurations in the medium term.

Putting this into PlatformConfig looks wrong. This is a CPU feature, not a platform feature.

@russell-islam

russell-islam commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

I assume there isn't an option for KVM?

We should take into consideration we may want to provide very fine-grained configurations in the medium term.

Putting this into PlatformConfig looks wrong. This is a CPU feature, not a platform feature.

We can directly add to the VM configuration as features or something?

@liuw

liuw commented Oct 10, 2025

Copy link
Copy Markdown
Member

I assume there isn't an option for KVM?
We should take into consideration we may want to provide very fine-grained configurations in the medium term.
Putting this into PlatformConfig looks wrong. This is a CPU feature, not a platform feature.

We can directly add to the VM configuration as features or something?

There is a workstream to expose fine-grained control over the CPU features. I think this belongs there.

KVM can benefit from the fine-grained control.

@russell-islam
russell-islam force-pushed the muislam/mshv-nested-feature branch from f2847cb to 1920b79 Compare October 10, 2025 20:14
@phip1611

phip1611 commented Oct 13, 2025

Copy link
Copy Markdown
Member

For the record: with current Cloud Hypervisor on Linux/KVM, nesting works out of the box including state save/resume and live-migration. It should work similar with MSHV.

@russell-islam

Copy link
Copy Markdown
Contributor Author

For the record: with current Cloud Hypervisor on Linux/KVM, nesting works out of the box including state save/resume and live-migration. It should work similar with MSHV.
On MSHV without that CPU feature enablement it would not work.

@russell-islam
russell-islam marked this pull request as ready for review October 13, 2025 20:45
@phip1611

phip1611 commented Oct 14, 2025

Copy link
Copy Markdown
Member

We could add a runtime configuration for kvm similar to MSHV which disables/enables the support explicitly. Then we can have similar behavior for both backends - and disabling nesting is a valid use case in case infrastructure maintainers are concerned about people breaking out of the VMX emulation for example

Comment thread vmm/src/vm_config.rs Outdated
@@ -35,6 +35,7 @@ pub struct CpuFeatures {
#[cfg(target_arch = "x86_64")]
#[serde(default)]
pub amx: bool,
pub nested: bool,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about nested_virt instead of just nested?

Comment thread vmm/src/vm_config.rs Outdated
Comment thread vmm/src/vm.rs
@anirudhrb

Copy link
Copy Markdown
Member

nit: there are multiple typos in the commit messages.

@russell-islam
russell-islam force-pushed the muislam/mshv-nested-feature branch from 1920b79 to 187ce24 Compare October 16, 2025 20:08
@russell-islam

Copy link
Copy Markdown
Contributor Author

@anirudhrb Please take another look. Thx

@rbradford rbradford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't have a nested option for KVM - it's always enabled. Why do we need to make it an option for MSHV?

If you add the option to --cpu for MSHV then you need to do the same for KVM.

@russell-islam

russell-islam commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

We don't have a nested option for KVM - it's always enabled. Why do we need to make it an option for MSHV?

If you add the option to --cpu for MSHV then you need to do the same for KVM.

With MSHV we have to pass the flag during VM creations. The customers want to control that flow with CLI, that's why I raised the PR.

Do you recommend adding feature guard around the nested feature, or recommend adding an extra argument like --mshv-cpu-feaures?

@rbradford

Copy link
Copy Markdown
Member

We don't have a nested option for KVM - it's always enabled. Why do we need to make it an option for MSHV?
If you add the option to --cpu for MSHV then you need to do the same for KVM.

With MSHV we have to pss the flag during VM creations. THe customers wants to control that flow with CLI, that's why I raised the PR.

Do you recommend adding feature guard around the nested feature, or recommend adding an extra argument like --mshv-cpu-feaures?

You haven't explained why you can't have it turned on all the time.

@russell-islam

russell-islam commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

We don't have a nested option for KVM - it's always enabled. Why do we need to make it an option for MSHV?
If you add the option to --cpu for MSHV then you need to do the same for KVM.

With MSHV we have to pss the flag during VM creations. THe customers wants to control that flow with CLI, that's why I raised the PR.
Do you recommend adding feature guard around the nested feature, or recommend adding an extra argument like --mshv-cpu-feaures?

You haven't explained why you can't have it turned on all the time.

Customers does not wnat to turn on by default.

We don't have a nested option for KVM - it's always enabled. Why do we need to make it an option for MSHV?
If you add the option to --cpu for MSHV then you need to do the same for KVM.

With MSHV we have to pss the flag during VM creations. THe customers wants to control that flow with CLI, that's why I raised the PR.
Do you recommend adding feature guard around the nested feature, or recommend adding an extra argument like --mshv-cpu-feaures?

You haven't explained why you can't have it turned on all the time.

We can turn it on by default with no issue but customer does not want it default rather it wants to control in run-time. Do you also refer to turn it on by default with the CpuFeatures default initialization? Also in future we will have more Cpu features on MSVH that might need to be turned on the CLI.

@rbradford

Copy link
Copy Markdown
Member

Okay. If you want to make it controllable then I think you should make it controllable for KVM as well - with a default of on.

@russell-islam

Copy link
Copy Markdown
Contributor Author

Okay. If you want to make it controllable then I think you should make it controllable for KVM as well - with a default of on.

Just curious, If we add some features that is only available for MSHV, How do we do it?

@rbradford

Copy link
Copy Markdown
Member

Okay. If you want to make it controllable then I think you should make it controllable for KVM as well - with a default of on.

Just curious, If we add some features that is only available for MSHV, How do we do it?

Probably something like x-mshv- prefix

@phip1611

phip1611 commented Oct 27, 2025

Copy link
Copy Markdown
Member

Why not add a parameter to --cpu, such as: --cpu nesting={on,off}? This is generic. I think in the KVM case we can also set the default to false, we probably just have to remove a few CPUid entries in that case.

with a default of on.

For the record: Some operators are concerned about the increased attack surface of the KVM VMX emulator code.

@rbradford

Copy link
Copy Markdown
Member

Why not add a parameter to --cpu, such as: --cpu nesting={on,off}? This is generic. I think in the KVM case we can also set the default to false, we probably just have to remove a few CPUid entries in that case.

Exactly what I was getting at!

with a default of on.

For the record: Some operators are concerned about the increased attack surface of the KVM VMX emulator code.

We've already shipped with a default of on - so we can't change that now.

@russell-islam
russell-islam force-pushed the muislam/mshv-nested-feature branch 5 times, most recently from e9d670a to f9107db Compare October 30, 2025 20:54
User can now disable nested virtualization for Intel and AMD
if configured by the CLI.

Signed-off-by: Muminul Islam <[email protected]>
This patch updates the documentation to reflect the newly added
nested CPU feature option in the CLI.

Signed-off-by: Muminul Islam <[email protected]>
@russell-islam
russell-islam force-pushed the muislam/mshv-nested-feature branch from a92eb90 to a5e7e7b Compare December 3, 2025 06:29

@rbradford rbradford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your patience on this PR! We do need to be especially careful with adding APIs and things could affect our defaults.

@rbradford
rbradford added this pull request to the merge queue Dec 3, 2025
Merged via the queue into cloud-hypervisor:main with commit 5fb50ed Dec 3, 2025
44 of 45 checks passed
@russell-islam

Copy link
Copy Markdown
Contributor Author

Thank you for your patience on this PR! We do need to be especially careful with adding APIs and things could affect our defaults.

Thank you @rbradford for all your effort on this. Your thorough review was very helpful and some learning for me.

@github-project-automation github-project-automation Bot moved this from 🆕 New to ✅ Done in Cloud Hypervisor Roadmap Dec 11, 2025
danmihai1 added a commit to microsoft/kata-containers that referenced this pull request Feb 25, 2026
The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Dan Mihai <[email protected]>
danmihai1 added a commit to microsoft/kata-containers that referenced this pull request Feb 25, 2026
The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Dan Mihai <[email protected]>
Redent0r pushed a commit to microsoft/kata-containers that referenced this pull request Apr 1, 2026
The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Dan Mihai <[email protected]>
Redent0r pushed a commit to microsoft/kata-containers that referenced this pull request Apr 2, 2026
The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Dan Mihai <[email protected]>
Redent0r pushed a commit to microsoft/kata-containers that referenced this pull request Apr 2, 2026
The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Dan Mihai <[email protected]>
Redent0r pushed a commit to microsoft/kata-containers that referenced this pull request Apr 13, 2026
The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Dan Mihai <[email protected]>
Redent0r pushed a commit to microsoft/kata-containers that referenced this pull request Apr 13, 2026
The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Dan Mihai <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request Apr 23, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
sprt pushed a commit to microsoft/kata-containers that referenced this pull request Apr 24, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request Apr 24, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request Apr 29, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request Apr 29, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request Apr 30, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request May 8, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request May 8, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Redent0r added a commit to microsoft/kata-containers that referenced this pull request May 17, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
sprt pushed a commit to microsoft/kata-containers that referenced this pull request May 18, 2026
This is a runtime-rs port for kata-containers@7973e4e

The recently-added nested property is true by default, but is not
supported yet on MSHV.

See cloud-hypervisor/cloud-hypervisor#7408 for additional information.

Signed-off-by: Saul Paredes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

7 participants