RE: [PATCH] hv_balloon: Add the support of hibernation
From: Dexuan Cui
Date: Thu Sep 12 2019 - 15:18:40 EST
> From: David Hildenbrand <david@xxxxxxxxxx>
> Sent: Thursday, September 12, 2019 3:09 AM
> On 12.09.19 01:36, Dexuan Cui wrote:
> > When hibernation is enabled, we must ignore the balloon up/down and
> > hot-add requests from the host, if any.
>
> Why do you even care about supporting hibernation? Can't you just pause
> the VM in the hypervisor and continue to live a happy life? :)
>
> (to be more precise, most QEMU/KVM distributions I am aware of don't
> support suspend/hibernation of guests for said reason, so I wonder why
> Hyper-V needs it)
In some scenarios, hibernation can be better than pause/unpause,
save/restore and live migration:
1. Compared to pause/unpause, the VM can power off completely with
hibernation, and all the states are saved inside the VM image, then the
image can be copied to another host to start the VM again, as long as
the new host uses exactly the same configuration for the VM.
2. Compared to pause/unpause, hibernation may be more reliable, since it's
performed by the VM kernel rather than the host, so the VM kernel may
better tackle some clock-source/event-sensitive issues.
3. Hibernation can be especially useful when we pass through a PCIe device,
e.g. a NIC, a NVMe controller or a GPU, to the VM, as usually save/restore
and live migration can not work with this kind of configuration, because
usually the host doesn't know how to save/restore the state of the PCIe
device.
> > This patch is basically a pure Hyper-V specific change and it has a
> > build dependency on the commit 271b2224d42f ("Drivers: hv: vmbus:
> Implement
> > suspend/resume for VSC drivers for hibernation"), which is on Sasha Levin's
> > Hyper-V tree's hyperv-next branch
> > @@ -1672,6 +1694,24 @@ static int balloon_probe(struct hv_device *dev,
> > {
> > int ret;
> >
> > +#if 0
>
> I am not sure if that's a good idea. Can't you base this series on
> hv_is_hibernation_supported() ?
Unluckily, I can not. :-(
My hv_is_hibernation_supported() patch is still in review, and has not been
in any tree yet (it's supposed to go through the tip.git tree's timers/core
branch since otherwise the branch contains some patches that would
cause conflicts):
https://lkml.org/lkml/2019/9/5/1158
https://lkml.org/lkml/2019/9/5/1160
> > + /*
> > + * The patch to implement hv_is_hibernation_supported() is going
> > + * through the tip tree. For now, let's hardcode allow_hibernation
> > + * to false to keep the current behavior of hv_balloon. If people
> > + * want to test hibernation, please blacklist hv_balloon for now
> > + * or do not enable Dynamid Memory and Memory Resizing.
> > + *
> > + * We'll remove the conditional compilation as soon as
> > + * hv_is_hibernation_supported() is available in the mainline tree.
> > + */
> > + allow_hibernation = hv_is_hibernation_supported();
> > +#else
> > + allow_hibernation = false;
> > +#endif
Thanks,
-- Dexuan