# KVM: host CPU goes 100% loading SMP guests from snapshot

## VinzC

Hi.

I wanted to try pausing/resuming a virtual machine using KVM-84 -- my test VM is Gentoo with a 2.6.27-gentoo-r8 kernel. So I first stopped the VM from KVM monitor, saved the VM and checked the snapshot from KVM:

```
ID        TAG                 VM SIZE                DATE       VM CLOCK

1                                249M 2009-03-01 23:19:45   10:07:05.652
```

I closed KVM and restarted it with exactly the same arguments as I ran it in the first place and appended arguments -S -loadvm 1. Now the VM hung and my host CPU went 100% as soon as I cont'inued to resume the VM.

The virtual machine is SMP-enabled and I ran it with -smp 2 from the command line from the host. I also enabled KVM guest features in my test virtual machine:

```
CONFIG_KVM_CLOCK=y

CONFIG_KVM_GUEST=y

CONFIG_HAVE_KVM=y
```

Here's how I ran KVM before the snapshot:

```
/usr/bin/kvm -name "KVM Test Guest" -usb -boot c -m 256 -hda ./ldap-server-hda.vdsk -net tap,script=no,downscript=no,ifname=vnet2 -net nic,model=rtl8139,macaddr=00:50:56:3f:84:7f -smp 2
```

Any idea or recommendation on how to pause/resume KVM guests in cases I missed something?

----------

## VinzC

Suspend/resume also behaves strangely with Windows guests. Strangely enough it's when I close KVM that it stops responding. I must kill KVM after I attempt to close a Windows guest that I suspended/resumed...

I start suspecting GCC version has an impact on KVM. I'm using GCC 4.2.4-r1 with openmp USE flag set as I also have a Core2 Duo. I'm recompiling KVM with GCC 4.1* and I'll post my results.

----------

## VinzC

Downgrading GCC to version 4.1 and recompiling KVM didn't help.

Only my Windows XP guests make KVM freeze when closing.

Windows 2000 guests do close properly.Still investigating.

EDIT: Downgrading KVM to version 81 did help! KVM no longer freezes upon closing my Windows XP guests. I'll check compiling it with with GCC 4.2* as well as snapshots.

EDIT: Definitely KVM-84 is quite buggy. KVM-81 allows me to pause, save, load and resume Windows and GNU/Linux guests without a problem. I tried single CPU guests and I'm trying SMP right now.

EDIT: Final attempt to load a saved SMP Gentoo guest failed. The host CPU goes 100% as soon as I resume the paused guest. No more problems when guests have only one CPU. I still don't know if the bug is caused by the guest kernel or by KVM itself. More tests to go...

----------

## bbgermany

I had a similiar issue without resumeing. Only SMP. Host load goes up to 100%. This seems to be a buggy smp code of KVM.

bb

----------

