Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1306360

Re: [PATCH] reboot: Backup orderly_poweroff

From Josh Triplett <josh@joshtriplett.org>
Newsgroups linux.kernel
Subject Re: [PATCH] reboot: Backup orderly_poweroff
Date 2016-01-11 16:00 +0100
Message-ID <qPM6S-3KB-17@gated-at.bofh.it> (permalink)
References <qPHTA-Yo-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jan 11, 2016 at 03:53:24PM +0530, Keerthy wrote:
> orderly_poweroff is triggered when a graceful shutdown
> of system is desired. This may be used in many critical states of the
> kernel such as when subsystems detects conditions such as critical
> temperature conditions. However, in certain conditions in system
> boot up sequences like those in the middle of driver probes being
> initiated, userspace will be unable to power off the system in a clean
> manner and leaves the system in a critical state. In cases like these,
> the /sbin/poweroff will return success (having forked off to attempt
> powering off the system. However, the system overall will fail to
> completely poweroff (since other modules will be probed) and the system
> is still functional with no userspace (since that would have shut itself
> off).
> 
> However, there is no clean way of detecting such failure of userspace
> powering off the system. In such scenarios, it is necessary for a backup
> workqueue to be able to force a shutdown of the system when orderly
> shutdown is not successful after a configurable time period.

One issue below, inline.

> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Suggested-by: Eduardo Valentin <edubezval@gmail.com> 
> Reported-by: Nishanth Menon <nm@ti.com>
> ---
> Links to previous discussion can be found here:
> 
> http://www.spinics.net/lists/linux-omap/msg124925.html
> 
> Boot tested on DRA7.
> 
>  arch/Kconfig    |  7 +++++++
>  kernel/reboot.c | 23 ++++++++++++++++++-----
>  2 files changed, 25 insertions(+), 5 deletions(-)
> 
> Index: linux/arch/Kconfig
> ===================================================================
> --- linux.orig/arch/Kconfig	2016-01-11 15:26:07.732173131 +0530
> +++ linux/arch/Kconfig	2016-01-11 15:26:07.728173205 +0530
> @@ -37,6 +37,18 @@
>  	def_bool y
>  	depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !PPC64
>  
> +config SHUTDOWN_BACKUP_DELAY_MS
> +	int "Backup shutdown delay in milli-seconds"
> +	default 0

With no dependencies, as far as I can tell this will always get defined
with a value, defaulting to 0.  (I don't know of any special cases in
Kconfig for an int value of 0.)  Thus, in the code below...

> --- linux.orig/kernel/reboot.c	2016-01-11 15:26:07.732173131 +0530
> +++ linux/kernel/reboot.c	2016-01-11 15:38:33.502341511 +0530
> @@ -424,6 +424,38 @@
>  	return ret;
>  }
>  
> +#ifdef CONFIG_SHUTDOWN_BACKUP_DELAY_MS

...this should use #if, not #ifdef.  Otherwise this code will get
compiled into every kernel.

- Josh Triplett

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] reboot: Backup orderly_poweroff  Keerthy <j-keerthy@ti.com> - 2016-01-11 11:30 +0100
  Re: [PATCH] reboot: Backup orderly_poweroff Josh Triplett <josh@joshtriplett.org> - 2016-01-11 16:00 +0100
    Re: [PATCH] reboot: Backup orderly_poweroff Keerthy <a0393675@ti.com> - 2016-01-13 05:30 +0100

csiph-web