public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Keerthy <j-keerthy@ti.com>
Cc: linux-kernel@vger.kernel.org, edubezval@gmail.com,
	grygorii.strashko@ti.com, nm@ti.com, joel@jms.id.au,
	akpm@linux-foundation.org, mingo@kernel.org,
	peterz@infradead.org, dyoung@redhat.com, mpe@ellerman.id.au
Subject: Re: [PATCH] reboot: Backup orderly_poweroff
Date: Mon, 11 Jan 2016 06:55:16 -0800	[thread overview]
Message-ID: <20160111145516.GA30206@x> (raw)
In-Reply-To: <1452507804-20886-1-git-send-email-j-keerthy@ti.com>

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

  reply	other threads:[~2016-01-11 14:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 10:23 [PATCH] reboot: Backup orderly_poweroff Keerthy
2016-01-11 14:55 ` Josh Triplett [this message]
2016-01-13  4:25   ` Keerthy

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=20160111145516.GA30206@x \
    --to=josh@joshtriplett.org \
    --cc=akpm@linux-foundation.org \
    --cc=dyoung@redhat.com \
    --cc=edubezval@gmail.com \
    --cc=grygorii.strashko@ti.com \
    --cc=j-keerthy@ti.com \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nm@ti.com \
    --cc=peterz@infradead.org \
    /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