Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp484689ybe; Fri, 13 Sep 2019 00:48:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFokyDk+qsPWwCFyIL1r+q7DKp3Vir+4d84ryNrQkPbdHeY4eUUdouZ2A4BvcHhhGb8MMG X-Received: by 2002:a17:906:5214:: with SMTP id g20mr37376487ejm.220.1568360936099; Fri, 13 Sep 2019 00:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568360936; cv=none; d=google.com; s=arc-20160816; b=i1SSE0UdEE779JxmRSQGjaNOmpCLue1QPOtBrDGPAQmRCrQM4wrRWsrYwojiiUFZC3 KhlXmcXg7GZXIGEphTV7JeIBwstbb9WxOhl34FZGFwKn55q2lfSixQGoJuWwBdFtUIa9 b+ntBQEFOex8EbBXuU5uUYUqVeJN0H0wTMMZeZ9CZ17Arzimus3e8DQBcYV6abpzZ2YS Zgd7S502jISV1ulNkos0NSRNB6wC1h09PrDPHRZLDDg7q0rJN/ENISvg0QAACvuO762j juSYLks/znMWcizQ4anR6a299kfVurCsvOApRiITALSvSy0KQHj9+idq8aUDXCUIUf/1 HHEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:references:to :subject; bh=20Z40Nf7rJF5hI14RPuDKfvUPJt+6TsjvuHxNxqu0TA=; b=YB/JPWXKkPvm5D7nET0UY/2p62HXLkNuABn4BTGZKvPpx89YlWkDWSS1Lma7pP99Ny jG+p2hTUIGnKk5zCd4T4VabvfNH3AA0EQWRIRYvnCerissM6ATCql1xjZvsYV+bUHWrf bvnXr4wRnhBE3AzPew350o2DybB3rOR1QVFjgtFeuo+uRx+mUeg53yl/FJSJMM/SmR30 /347AFiTW6W3XB00ckh1xPxpkG4DdRCVuUWBwNP3iB54vHqIjKKaNJcncTPdfW5DM6hI k0pSUjoztrsBxxBvQ66/9GLh/cYlihH8jhD6ot69o4GuEbv0QhMvXnJ6sjqxdcJOR9Vm njhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si13732037ejn.179.2019.09.13.00.48.32; Fri, 13 Sep 2019 00:48:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728591AbfIMHqK (ORCPT + 99 others); Fri, 13 Sep 2019 03:46:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37328 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728137AbfIMHqJ (ORCPT ); Fri, 13 Sep 2019 03:46:09 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2015C2BFDC; Fri, 13 Sep 2019 07:46:09 +0000 (UTC) Received: from [10.36.117.182] (ovpn-117-182.ams2.redhat.com [10.36.117.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68D95600CE; Fri, 13 Sep 2019 07:46:07 +0000 (UTC) Subject: Re: [PATCH] hv_balloon: Add the support of hibernation To: Dexuan Cui , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "sashal@kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Michael Kelley References: <1568245010-66879-1-git-send-email-decui@microsoft.com> <42de5835-8faa-2047-0f77-db51dd57b036@redhat.com> From: David Hildenbrand Openpgp: preference=signencrypt Autocrypt: addr=david@redhat.com; prefer-encrypt=mutual; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW5icmFuZCA8ZGF2aWRAcmVkaGF0LmNvbT7CwX4EEwECACgFAljj9eoCGwMFCQlmAYAGCwkI BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEE3eEPcA/4Na5IIP/3T/FIQMxIfNzZ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dfab230@redhat.com> Date: Fri, 13 Sep 2019 09:46:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 13 Sep 2019 07:46:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.09.19 21:18, Dexuan Cui wrote: >> From: David Hildenbrand >> 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. Okay, under QEMU that also works just fine via pause/unpause (e.g., simply migration). > > 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. Not sure I agree, but maybe that's a Hyper-V special issue. > > 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. Interesting. Under QEMU/KVM (especially for migration), the discussed solutions I am aware of rather wanted to temporarily unplug the PCI devices or replace them with some kind of "standby" device temporarily. Anyhow, would it also be an option for you instead of making the balloon basically useless in case the virtual ACPI S4 state is enabled to a) Remember if there was a harmful requests that was processed (memory add, balloon up, balloon down) - or if the device is *currently* in an un-hibernatable state. E.g., if somebody inflated the balloon, you can't hibernate. But if the balloon was deflated again, you can again hibernate. b) Block hibernation in balloon_suspend() in case the device is in such an un-hibernatable state. Then you don't need hv_is_hibernation_supported(). The VM is able to hibernate as long as Dynamic Memory and Memory Resizing was not used. This is something that can be documented perfectly well. -- Thanks, David / dhildenb