All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Sebastian Capella <sebastian.capella@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	linaro-kernel@lists.linaro.org, Len Brown <len.brown@intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH RFC] PM / Hibernate: no kernel_power_off when pm_power_off NULL
Date: Thu, 20 Mar 2014 22:23:36 +0100	[thread overview]
Message-ID: <20140320212336.GA17368@amd.pavel.ucw.cz> (raw)
In-Reply-To: <1395348795-8554-2-git-send-email-sebastian.capella@linaro.org>

Hi!

> Reboot logic in kernel/reboot will avoid calling kernel_power_off
> when pm_power_off is null, and instead uses kernel_halt.  Change
> hibernate's power_down to follow the behavior in the reboot call.
> 
> Calling the notifier twice (once for SYS_POWER_OFF and again for
> SYS_HALT) causes a panic during hibernation on Kirkwood
> Openblocks A6 board.

I can't say I like this patch.

kernel_power_off should work with pm_power_off == NULL, see for
example x86.

static void native_machine_power_off(void)
{
        if (pm_power_off) {
                if (!reboot_force)
			machine_shutdown();
                pm_power_off();
        }
        /* A fallback in case there is no PM info available */
        tboot_shutdown(TB_SHUTDOWN_HALT);
}

. arch/arm/process.c implementation is strange:

void machine_halt(void)
{
        local_irq_disable();
	smp_send_stop();

        local_irq_disable();
        while (1);
}

## Why second disable?

/*                                                                                                 
 * Power-off simply requires that the secondary CPUs stop performing
 any                           
 * activity (executing tasks, handling interrupts). smp_send_stop()                                
 * achieves this. When the system power is turned off, it will take
 all CPUs                       
 * with it.                                                                                        
 */
void machine_power_off(void)
{
	local_irq_disable();
        smp_send_stop();

	if (pm_power_off)
                pm_power_off();
}

## It really should do while (1) here.
   
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2014-03-20 21:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 20:53 [PATCH RFC 0/1] PM / Hibernate: no kernel_power_off when pm_power_off Sebastian Capella
2014-03-20 20:53 ` [PATCH RFC] PM / Hibernate: no kernel_power_off when pm_power_off NULL Sebastian Capella
2014-03-20 21:23   ` Pavel Machek [this message]
2014-03-20 21:35     ` One Thousand Gnomes
2014-03-20 21:36       ` Sebastian Capella
2014-03-26 17:22         ` Sebastian Capella
2014-04-15 18:34           ` Sebastian Capella
2014-04-15 20:54             ` Russell King - ARM Linux
2014-04-15 21:18               ` Pavel Machek
2014-04-16 16:28                 ` Sebastian Capella
2014-04-16 20:41                   ` Russell King - ARM Linux
2014-04-16 20:57                     ` One Thousand Gnomes
2014-04-16 21:09                       ` Russell King - ARM Linux
2014-04-18 21:38                         ` Sebastian Capella
2014-04-20 14:06                           ` Pavel Machek

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=20140320212336.GA17368@amd.pavel.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=len.brown@intel.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=sebastian.capella@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.