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

Skip to content

hypervisor: kvm: Save KVM HyperV SynIC emulation state - #7492

Merged
rbradford merged 2 commits into
cloud-hypervisor:mainfrom
rbradford:2025-11-21-add-hyperv-synic-to-state
Nov 22, 2025
Merged

rbradford merged 2 commits into
cloud-hypervisor:mainfrom
rbradford:2025-11-21-add-hyperv-synic-to-state

Conversation

@rbradford

Copy link
Copy Markdown
Member

As well as saving the MSRs as it is curretly does ensure ensure that the
KVM capabability is enabled along with ensuring that the internal state
is updated.

Signed-off-by: Rob Bradford [email protected]
Co-authored-by: Chengyu Fu [email protected]

@rbradford
rbradford requested a review from a team as a code owner November 21, 2025 09:19

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

LGTM.

@rbradford
rbradford force-pushed the 2025-11-21-add-hyperv-synic-to-state branch from 2f2dcab to 0abfabd Compare November 21, 2025 10:14
As well as saving the MSRs as it is currently does ensure that the KVM
capability is enabled along with keeping the internal state updated.

Signed-off-by: Rob Bradford <[email protected]>
Co-authored-by: Chengyu Fu <[email protected]>
@rbradford
rbradford force-pushed the 2025-11-21-add-hyperv-synic-to-state branch from 0abfabd to 3442153 Compare November 21, 2025 11:31
@rbradford
rbradford added this pull request to the merge queue Nov 21, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 21, 2025
@tpressure

Copy link
Copy Markdown
Member

Just FYI, I am not sure if this is really related:

I just tested snapshot/restore with my WindowsPE installer setup. When restoring the snapshot, I am no longer able to connect to the windows VM via network. I only see the following:

./cloud-hypervisor --api-socket=/tmp/chv.sock --restore source_url=file:///tmp/windows
cloud-hypervisor:   0.423612s: <vmm> WARN:vmm/src/config.rs:2526 -- Using TTY output for multiple consoles: ["virtio-console", "serial-console"]
cloud-hypervisor:   0.424963s: <vmm> WARN:net_util/src/open_tap.rs:88 -- Tap tap0 already exists. IP configuration will not be overwritten.

@likebreath
likebreath requested a review from liuw November 21, 2025 17:08
@liuw

liuw commented Nov 21, 2025

Copy link
Copy Markdown
Member

Just FYI, I am not sure if this is really related:

I just tested snapshot/restore with my WindowsPE installer setup. When restoring the snapshot, I am no longer able to connect to the windows VM via network. I only see the following:

./cloud-hypervisor --api-socket=/tmp/chv.sock --restore source_url=file:///tmp/windows
cloud-hypervisor:   0.423612s: <vmm> WARN:vmm/src/config.rs:2526 -- Using TTY output for multiple consoles: ["virtio-console", "serial-console"]
cloud-hypervisor:   0.424963s: <vmm> WARN:net_util/src/open_tap.rs:88 -- Tap tap0 already exists. IP configuration will not be overwritten.

Are you saying that somehow not restoring the state makes this work? Did you have hyperv_synic enabled before?

@tpressure

Copy link
Copy Markdown
Member

Are you saying that somehow not restoring the state makes this work? Did you have hyperv_synic enabled before?

I never tested snapshot/restore with Windows before I saw this PR. I just have a WindowsPE installer setup here which works great when I boot it normally, but I am unable to do a snapshot/restore cycle with this image. Once restored, the ip of the guest is no longer reachable. SynIC was enabled when I bootet the VM initially.

@liuw

liuw commented Nov 22, 2025

Copy link
Copy Markdown
Member

Are you saying that somehow not restoring the state makes this work? Did you have hyperv_synic enabled before?

I never tested snapshot/restore with Windows before I saw this PR. I just have a WindowsPE installer setup here which works great when I boot it normally, but I am unable to do a snapshot/restore cycle with this image. Once restored, the ip of the guest is no longer reachable. SynIC was enabled when I bootet the VM initially.

Okay, then we cannot say for sure if this issue is caused by this change or not.

Only for x86-64 for now as it's still failing on ARM64.

See: cloud-hypervisor#4327

Signed-off-by: Rob Bradford <[email protected]>
@rbradford
rbradford force-pushed the 2025-11-21-add-hyperv-synic-to-state branch from 3442153 to f6e2a8d Compare November 22, 2025 10:12
@rbradford
rbradford enabled auto-merge November 22, 2025 10:25
@rbradford
rbradford added this pull request to the merge queue Nov 22, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 22, 2025
@rbradford
rbradford added this pull request to the merge queue Nov 22, 2025
Merged via the queue into cloud-hypervisor:main with commit 4d79709 Nov 22, 2025
42 of 43 checks passed
@FuuuOverclocking

FuuuOverclocking commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

Just FYI, I am not sure if this is really related:

I just tested snapshot/restore with my WindowsPE installer setup. When restoring the snapshot, I am no longer able to connect to the windows VM via network. I only see the following:

./cloud-hypervisor --api-socket=/tmp/chv.sock --restore source_url=file:///tmp/windows
cloud-hypervisor:   0.423612s: <vmm> WARN:vmm/src/config.rs:2526 -- Using TTY output for multiple consoles: ["virtio-console", "serial-console"]
cloud-hypervisor:   0.424963s: <vmm> WARN:net_util/src/open_tap.rs:88 -- Tap tap0 already exists. IP configuration will not be overwritten.

@tpressure
It looks like there's a potential conflict with the tap configuration during restore. This is my startup command, and I found that the network works normally after restore.

OS: Windows 11 IoT Enterprise LTSC 2024

#!/bin/bash

FW=CLOUDHV.fd
DISK0=disk0-os.raw

rm -f api.sock
sudo cloud-hypervisor \
	--api-socket api.sock \
	--kernel $FW \
	--disk path=$DISK0 \
	--cpus boot=4,kvm_hyperv=on \
	--memory size=8G \
	--serial tty \
	--console off \
	--seccomp false \
	--net tap=,ip=192.168.249.1,mask=255.255.255.0
#!/bin/bash

snapshot=$(pwd)/snapshot_$(date +"%Y%m%d_%H%M%S")
echo "$snapshot" > latest_snapshot

mkdir -p "$snapshot"

sudo ch-remote --api-socket ./api.sock pause
sudo ch-remote --api-socket ./api.sock snapshot file://$snapshot
sudo ch-remote --api-socket ./api.sock shutdown-vmm
#!/bin/bash

rm -f api.sock
sudo cloud-hypervisor --api-socket ./api.sock --seccomp false
#!/bin/bash

snapshot=$(cat latest_snapshot)

sudo ch-remote --api-socket ./api.sock restore source_url=file://$snapshot
sudo ch-remote --api-socket ./api.sock resume

@rbradford
rbradford deleted the 2025-11-21-add-hyperv-synic-to-state branch November 24, 2025 08:48
@tpressure

Copy link
Copy Markdown
Member

It looks like there's a potential conflict with the tap configuration during restore. This is my startup command, and I found that the network works normally after restore.

OS: Windows 11 IoT Enterprise LTSC 2024

Thanks for the pointers. I will give this a spin later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix Bug fix to include in release notes

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

6 participants