linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Domenico Andreoli <domenico.andreoli@linux.com>
Cc: Pavel Machek <pavel@ucw.cz>, Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH 2/2] uswsusp: build only when configured
Date: Sun, 26 Apr 2020 18:16:29 +0200	[thread overview]
Message-ID: <4068729.AMvo8hvaBI@kreacher> (raw)
In-Reply-To: <20200413193718.956985775@gmail.com>

On Monday, April 13, 2020 9:08:45 PM CEST Domenico Andreoli wrote:
> From: Domenico Andreoli <domenico.andreoli@linux.com>
> 
> uswsusp is no longer the preferred way to suspend/hibernate and the
> userspace tools have not received any update in years.
> 
> Make it possible to enable the uswsusp support only if needed, prepare
> for future phase out.
> 
> Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Linux PM <linux-pm@vger.kernel.org>
> 
> ---
>  kernel/power/Kconfig  |    5 +++++
>  kernel/power/Makefile |    3 ++-
>  kernel/power/power.h  |    5 +++++
>  3 files changed, 12 insertions(+), 1 deletion(-)
> 
> Index: b/kernel/power/Kconfig
> ===================================================================
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -80,6 +80,11 @@ config HIBERNATION
>  
>  	  For more information take a look at <file:Documentation/power/swsusp.rst>.
>  
> +config HIBERNATION_USER
> +	bool "Userspace software suspend interface (DEPRECATED)"
> +	depends on HIBERNATION
> +	default n

This needs to be "default y" for the time being.

Also, I would call the option HIBERNATION_SNAPSHOT_DEV, because it effectively
controls whether or not the snapshot device is available.

> +
>  config PM_STD_PARTITION
>  	string "Default resume partition"
>  	depends on HIBERNATION
> Index: b/kernel/power/Makefile
> ===================================================================
> --- a/kernel/power/Makefile
> +++ b/kernel/power/Makefile
> @@ -10,7 +10,8 @@ obj-$(CONFIG_VT_CONSOLE_SLEEP)	+= consol
>  obj-$(CONFIG_FREEZER)		+= process.o
>  obj-$(CONFIG_SUSPEND)		+= suspend.o
>  obj-$(CONFIG_PM_TEST_SUSPEND)	+= suspend_test.o
> -obj-$(CONFIG_HIBERNATION)	+= hibernate.o snapshot.o swap.o user.o
> +obj-$(CONFIG_HIBERNATION)	+= hibernate.o snapshot.o swap.o
> +obj-$(CONFIG_HIBERNATION_USER)	+= user.o
>  obj-$(CONFIG_PM_AUTOSLEEP)	+= autosleep.o
>  obj-$(CONFIG_PM_WAKELOCKS)	+= wakelock.o
>  
> Index: b/kernel/power/power.h
> ===================================================================
> --- a/kernel/power/power.h
> +++ b/kernel/power/power.h
> @@ -158,8 +158,13 @@ extern sector_t alloc_swapdev_block(int
>  extern void free_all_swap_pages(int swap);
>  extern int swsusp_swap_in_use(void);
>  
> +#ifdef CONFIG_HIBERNATION_USER
>  bool swsusp_try_enter(void);
>  void swsusp_leave(void);
> +#else
> +static inline bool swsusp_try_enter(void) { return 1; }
> +static inline void swsusp_leave(void) {}
> +#endif

It is possible in theory that two processes write "disk" to /sys/power/state
concurrently.

Is there enough mutual exclusion in place to handle this gracefully after the
above change?

>  
>  /*
>   * Flags that can be passed from the hibernatig hernel to the "boot" kernel in
> 
> 





  reply	other threads:[~2020-04-26 16:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 19:08 [PATCH 0/2] Preparing to phase out uswsusp Domenico Andreoli
2020-04-13 19:08 ` [PATCH 1/2] uswsusp: use enter/leave helpers and make a global variable static Domenico Andreoli
2020-04-26 16:11   ` Rafael J. Wysocki
2020-04-13 19:08 ` [PATCH 2/2] uswsusp: build only when configured Domenico Andreoli
2020-04-26 16:16   ` Rafael J. Wysocki [this message]
2020-04-27  9:48     ` Domenico Andreoli
2020-04-29 11:20       ` Rafael J. Wysocki
2020-05-01  7:10         ` Domenico Andreoli
2020-05-01 14:54           ` Rafael J. Wysocki
2020-05-03 13:31             ` Domenico Andreoli
2020-05-03 17:25               ` Domenico Andreoli
2020-04-26 15:46 ` [PATCH 0/2] Preparing to phase out uswsusp Rafael J. Wysocki
2020-04-27  9:53   ` Domenico Andreoli
2020-04-29 11:06     ` Rafael J. Wysocki
2020-05-03 11:19       ` Domenico Andreoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4068729.AMvo8hvaBI@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=domenico.andreoli@linux.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).