Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3161484ybi; Fri, 5 Jul 2019 02:59:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8gbUVVlW99Dk9ilhNCH/42JcKPwLUooH/3QAQxAeanR2/J4MIHkVXhuxQySM3qHYpETMu X-Received: by 2002:a17:90a:cf8f:: with SMTP id i15mr4185080pju.110.1562320742807; Fri, 05 Jul 2019 02:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562320742; cv=none; d=google.com; s=arc-20160816; b=eXjfJI6S3cOUQAWd8ps1SuTdZZRVfax8DZYBWwBBFKqKhrJjJRzTJM+Pgfzf5PdCuY qXID/VWYKJfOY2nOqyEOnsxOIr+GTs3InxfikFJSluP+gMZ42N89o/yNA2hnCtjcJdHv gJQL9++CxGNrFq3rfNce0U/4avsnN6DAi+n0jgMIELIwwe/QeMPaMjCQgHEiXWUKbYXd oIg9dwlY6Y/QnxhS2tlPy3/W6PsudrK22VwMlyfJf+45cHQ8u4uUm08HMuNYCt64WtUi QPXjw0kzscVc20kPsOfdxv8yBh3oRwASXQnBitHa04+RcQD4Vk8r/ZbUibz0N6yPm5Iy HdZw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=tyuQAhzlYF9kMLrTI1M6E1kMmPcZc2faGfJna0gzBHE=; b=B0RYQx0KV4LmoPNVBBJkHGZbtXMynVjtycasVJ54dxcyy267WEh1xdWF97D4jZG8FS Tn5XV97L20dy9m64xr1gxRCCSF7QdnQNX0KMibdfXF7lpB2L7mXXgbttvzaFXpowwAnD i72MSSxSYbVaRFOwnE0AZk8qTiEILnR+8vLaUwZcZQ9wGo14Ep2ygmjHdaWPFu3W8SIp rZnY/5eQ+yxKfQdBhgEMuvT/YpNws0E2PEs/r/LoBQomeJKJ5vW5vq+1zlmWnGrWow87 VZPrhgQgqBuTjVTRUhfHPsI9s59vejOPPwOhg8tB6YgkXm8r9WDXr+MDdiunRAU0v42g ahuQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h64si8896919pge.208.2019.07.05.02.58.47; Fri, 05 Jul 2019 02:59:02 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728291AbfGEJkh (ORCPT + 99 others); Fri, 5 Jul 2019 05:40:37 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:49389 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbfGEJkh (ORCPT ); Fri, 5 Jul 2019 05:40:37 -0400 Received: from 79.184.254.216.ipv4.supernova.orange.pl (79.184.254.216) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.267) id c1519e1ec2a27edb; Fri, 5 Jul 2019 11:40:34 +0200 From: "Rafael J. Wysocki" To: Dexuan Cui Cc: Pavel Machek , Michael Kelley , "linux-acpi@vger.kernel.org" , "lenb@kernel.org" , "robert.moore@intel.com" , "erik.schmauss@intel.com" , Russell King , Russ Dill , Sebastian Capella , Lorenzo Pieralisi , Russell King - ARM Linux admin , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , KY Srinivasan , Stephen Hemminger , Haiyang Zhang , Sasha Levin , "olaf@aepfle.de" , "apw@canonical.com" , "jasowang@redhat.com" , vkuznets , "marcelo.cerri@canonical.com" Subject: Re: [PATCH] ACPI: PM: Make acpi_sleep_state_supported() non-static Date: Fri, 05 Jul 2019 11:40:33 +0200 Message-ID: <1656981.zhPPi4nNQI@kreacher> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, July 4, 2019 4:43:32 AM CEST Dexuan Cui wrote: > > With some upcoming patches to save/restore the Hyper-V drivers related > states, a Linux VM running on Hyper-V will be able to hibernate. When > a Linux VM hibernates, unluckily we must disable the memory hot-add/remove > and balloon up/down capabilities in the hv_balloon driver > (drivers/hv/hv_balloon.c), because these can not really work according to > the design of the related back-end driver on the host. > > By default, Hyper-V does not enable the virtual ACPI S4 state for a VM; > on recent Hyper-V hosts, the administrator is able to enable the virtual > ACPI S4 state for a VM, so we hope to use the presence of the virtual ACPI > S4 state as a hint for hv_balloon to disable the aforementioned > capabilities. In this way, hibernation will work more reliably, from the > user's perspective. > > By marking acpi_sleep_state_supported() non-static, we'll be able to > implement a hv_is_hibernation_supported() API in the always-built-in > module arch/x86/hyperv/hv_init.c, and the API will be called by hv_balloon. > > Signed-off-by: Dexuan Cui > --- > > Previously I posted a version that tries to export the function: > https://lkml.org/lkml/2019/6/14/1077, which may be an overkill. > > So I proposed a second patch (which covers this patch and shows how this > patch will be used): https://lkml.org/lkml/2019/6/19/861 > > I explained the situation in detail here: https://lkml.org/lkml/2019/6/21/63 > (a correction: old Hyper-V hosts can support guest hibernation, but some > important functionalities in the host's management tool stack are missing). > > There is no further reply in that discussion, so I'm sending this patch to > draw people's attention again. :-) > > drivers/acpi/sleep.c | 2 +- > include/acpi/acpi_bus.h | 6 ++++++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c > index 8ff08e531443..d1ff303a857a 100644 > --- a/drivers/acpi/sleep.c > +++ b/drivers/acpi/sleep.c > @@ -77,7 +77,7 @@ static int acpi_sleep_prepare(u32 acpi_state) > return 0; > } > > -static bool acpi_sleep_state_supported(u8 sleep_state) > +bool acpi_sleep_state_supported(u8 sleep_state) > { > acpi_status status; > u8 type_a, type_b; > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h > index 31b6c87d6240..3e6563e1a2c0 100644 > --- a/include/acpi/acpi_bus.h > +++ b/include/acpi/acpi_bus.h > @@ -651,6 +651,12 @@ static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable) > } > #endif > > +#ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT > +bool acpi_sleep_state_supported(u8 sleep_state); > +#else > +bool acpi_sleep_state_supported(u8 sleep_state) { return false; } > +#endif > + > #ifdef CONFIG_ACPI_SLEEP > u32 acpi_target_system_state(void); > #else > Applied, thanks!