RE: How can a userspace program tell if the system supports the ACPI S4 state (Suspend-to-Disk)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> Sent: Friday, February 5, 2021 5:06 AM
> To: Dexuan Cui <decui@xxxxxxxxxxxxx>
> Cc: linux-acpi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux-hyperv@xxxxxxxxxxxxxxx; Michael Kelley <mikelley@xxxxxxxxxxxxx>
> Subject: Re: How can a userspace program tell if the system supports the ACPI
> S4 state (Suspend-to-Disk)?
> 
> On Sat, Dec 12, 2020 at 2:22 AM Dexuan Cui <decui@xxxxxxxxxxxxx> wrote:
> >
> > Hi all,
> > It looks like Linux can hibernate even if the system does not support the ACPI
> > S4 state, as long as the system can shut down, so "cat /sys/power/state"
> > always contains "disk", unless we specify the kernel parameter "nohibernate"
> > or we use LOCKDOWN_HIBERNATION.
> >
> > In some scenarios IMO it can still be useful if the userspace is able to detect
> > if the ACPI S4 state is supported or not, e.g. when a Linux guest runs on
> > Hyper-V, Hyper-V uses the virtual ACPI S4 state as an indicator of the proper
> > support of the tool stack on the host, i.e. the guest is discouraged from
> > trying hibernation if the state is not supported.
> >
> > I know we can check the S4 state by 'dmesg':
> >
> > # dmesg |grep ACPI: | grep support
> > [    3.034134] ACPI: (supports S0 S4 S5)
> >
> > But this method is unreliable because the kernel msg buffer can be filled
> > and overwritten. Is there any better method? If not, do you think if the
> > below patch is appropriate? Thanks!
> 
> Sorry for the delay.
> 
> If ACPI S4 is supported, /sys/power/disk will list "platform" as one
> of the options (and it will be the default one then).  Otherwise,
> "platform" is not present in /sys/power/disk, because ACPI is the only
> user of hibernation_ops.
> 
> HTH

This works on x86. Thanks a lot!

BTW, does this also work on ARM64?

Thanks,
-- Dexuan




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux