linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: fransklaver@gmail.com (Frans Klaver)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/44] kernel: Add support for poweroff handler call chain
Date: Thu, 18 Jun 2015 14:14:07 +0200	[thread overview]
Message-ID: <CAH6sp9O0B_BWS8cLSq=MoFbe3nB_45+K64gh7QMHO3meT-b14w@mail.gmail.com> (raw)
In-Reply-To: <5582B15B.4010205@roeck-us.net>

On Thu, Jun 18, 2015 at 1:54 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On 06/17/2015 11:53 PM, Frans Klaver wrote:
>>
>> On Thu, Jun 18, 2015 at 3:04 AM, Stephen Boyd <sboyd@codeaurora.org>
>> wrote:
>>>
>>> On 10/06/2014 10:28 PM, Guenter Roeck wrote:
>>>>
>>>> Various drivers implement architecture and/or device specific means to
>>>> remove power from the system.  For the most part, those drivers set the
>>>> global variable pm_power_off to point to a function within the driver.
>>>>
>>>> This mechanism has a number of drawbacks.  Typically only one scheme
>>>> to remove power is supported (at least if pm_power_off is used).
>>>> At least in theory there can be multiple means remove power, some of
>>>> which may be less desirable. For example, some mechanisms may only
>>>> power off the CPU or the CPU card, while another may power off the
>>>> entire system.  Others may really just execute a restart sequence
>>>> or drop into the ROM monitor. Using pm_power_off can also be racy
>>>> if the function pointer is set from a driver built as module, as the
>>>> driver may be in the process of being unloaded when pm_power_off is
>>>> called. If there are multiple poweroff handlers in the system, removing
>>>> a module with such a handler may inadvertently reset the pointer to
>>>> pm_power_off to NULL, leaving the system with no means to remove power.
>>>>
>>>> Introduce a system poweroff handler call chain to solve the described
>>>> problems.  This call chain is expected to be executed from the
>>>> architecture specific machine_power_off() function.  Drivers providing
>>>> system poweroff functionality are expected to register with this call
>>>> chain.
>>>> By using the priority field in the notifier block, callers can control
>>>> poweroff handler execution sequence and thus ensure that the poweroff
>>>> handler with the optimal capabilities to remove power for a given system
>>>> is called first.
>>>
>>>
>>> What happened to this series? I want to add shutdown support to my
>>> platform and I need to write a register on the PMIC in one driver to
>>> configure it for shutdown instead of restart and then write an MMIO
>>> register to tell the PMIC to actually do the shutdown in another driver.
>>> It seems that the notifier solves this case for me, albeit with the
>>> slight complication that I need to order the two with some priority.
>>
>>
>> I was wondering the same thing. I did find out that things kind of
>> stalled after Linus cast doubt on the chosen path [1]. I'm not sure
>> there's any consensus on what would be best to do instead.
>>
>
> Linus cast doubt on it, then the maintainers started picking it apart.
> At the end, trying not to use notifier callbacks made the code so
> complicated that even I didn't understand it anymore. With no consensus
> in sight, I abandoned it.
>
> Problem is really that the notifier call chain would be perfect to solve
> the problem, yet Linus didn't like priorities (which are essential),
> and the power maintainers didn't like that a call chain is supposed
> to execute _all_ callbacks, which would not be the case here. If I were
> to start again, I would insist to use notifiers. However, I don't see
> a chance to get that accepted, so I won't. Feel free to pick it up and
> give it a try yourself.

How about having two phases? One where all interested parts of the
system get notified, one that does the final shutdown. It's a slightly
different approach than you took, but does use the notifier chains as
expected, and can be used to prepare peripherals for shutdown, if
there's a use case for it.

The two-stage approach does keep the single place to power down. I
expect it would become more obvious that it would be silly to have
more than one actual system power down sequence and hiding
pm_power_off and unifying setting of it should become more straight
forward as well.

Thoughts?

Thanks,
Frans

  reply	other threads:[~2015-06-18 12:14 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1412659726-29957-1-git-send-email-linux@roeck-us.net>
2014-10-07  5:28 ` [PATCH 01/44] kernel: Add support for poweroff handler call chain Guenter Roeck
2014-10-07  7:46   ` Philippe Rétornaz
2014-10-09 10:31   ` Pavel Machek
2014-10-09 15:38     ` Guenter Roeck
2014-10-09 11:31   ` Geert Uytterhoeven
2014-10-09 13:25     ` Guenter Roeck
2015-06-18  1:04   ` Stephen Boyd
2015-06-18  6:53     ` Frans Klaver
2015-06-18 11:54       ` Guenter Roeck
2015-06-18 12:14         ` Frans Klaver [this message]
2015-06-18 15:30     ` Guenter Roeck
2015-06-18 21:40       ` Stephen Boyd
2014-10-07  5:28 ` [PATCH 02/44] memory: emif: Use API function to determine poweroff capability Guenter Roeck
2014-10-07  5:28 ` [PATCH 03/44] hibernate: Call have_kernel_poweroff instead of checking pm_power_off Guenter Roeck
2014-10-07 23:41   ` Rafael J. Wysocki
2014-10-09 10:32   ` Pavel Machek
2014-10-09 13:24     ` Guenter Roeck
2014-10-07  5:28 ` [PATCH 04/44] m68k: Replace mach_power_off with pm_power_off Guenter Roeck
2014-10-07  8:29   ` Geert Uytterhoeven
2014-10-07  5:28 ` [PATCH 05/44] mfd: as3722: Drop reference to pm_power_off from devicetree bindings Guenter Roeck
2014-10-07 10:59   ` Mark Rutland
2014-10-07 16:21   ` Rob Landley
2014-10-07 16:31     ` Guenter Roeck
2014-10-07 16:59       ` David Daney
2014-10-07 17:10         ` Rob Landley
2014-10-07 16:58     ` Mark Rutland
2014-10-07  5:28 ` [PATCH 06/44] gpio-poweroff: " Guenter Roeck
2014-10-07 11:03   ` Mark Rutland
2014-10-07 15:50   ` Andrew Lunn
2014-10-07  5:28 ` [PATCH 07/44] qnap-poweroff: " Guenter Roeck
2014-10-07 11:02   ` Mark Rutland
2014-10-07 15:57     ` Guenter Roeck
2014-10-07 15:51   ` Andrew Lunn
2014-10-07  5:28 ` [PATCH 09/44] mfd: palmas: Register with kernel poweroff handler Guenter Roeck
2014-10-07  5:28 ` [PATCH 10/44] mfd: axp20x: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 11/44] mfd: retu: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 12/44] mfd: ab8500-sysctrl: " Guenter Roeck
2014-10-07  8:00   ` Lee Jones
2014-10-09 10:36     ` Catalin Marinas
2014-10-09 10:49       ` Lee Jones
2014-10-09 13:26         ` Guenter Roeck
2014-10-09 13:33           ` Lee Jones
2014-10-09 15:45             ` Guenter Roeck
2014-10-09 15:54         ` Guenter Roeck
2014-10-07  5:28 ` [PATCH 13/44] mfd: max8907: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 14/44] mfd: tps80031: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 15/44] mfd: dm355evm_msp: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 16/44] mfd: tps6586x: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 17/44] mfd: tps65910: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 18/44] mfd: twl4030-power: " Guenter Roeck
2014-10-07  7:52   ` Lee Jones
2014-10-07  5:28 ` [PATCH 19/44] ipmi: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 20/44] power/reset: restart-poweroff: " Guenter Roeck
2014-10-07 16:06   ` Andrew Lunn
2014-10-07  5:28 ` [PATCH 21/44] power/reset: gpio-poweroff: " Guenter Roeck
2014-10-07 16:00   ` Andrew Lunn
2014-10-07  5:28 ` [PATCH 22/44] power/reset: as3722-poweroff: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 23/44] power/reset: qnap-poweroff: " Guenter Roeck
2014-10-07 16:02   ` Andrew Lunn
2014-10-07  5:28 ` [PATCH 24/44] power/reset: msm-powroff: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 25/44] power/reset: vexpress-poweroff: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 26/44] x86: iris: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 27/44] x86: apm: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 28/44] x86: olpc: Register xo1 poweroff handler " Guenter Roeck
2014-10-07  5:28 ` [PATCH 29/44] staging: nvec: Register " Guenter Roeck
2014-10-07 16:23   ` Greg Kroah-Hartman
2014-10-08 18:51   ` Marc Dietrich
2014-10-07  5:28 ` [PATCH 30/44] acpi: Register poweroff handler " Guenter Roeck
2014-10-07  5:28 ` [PATCH 32/44] arm64: psci: Register " Guenter Roeck
2014-10-09 10:41   ` Catalin Marinas
2014-10-07  5:28 ` [PATCH 33/44] avr32: atngw100: " Guenter Roeck
2014-11-01 10:16   ` Hans-Christian Egtvedt
2014-11-01 17:02     ` Guenter Roeck
2014-10-07  5:28 ` [PATCH 34/44] ia64: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 35/44] m68k: " Guenter Roeck
2014-10-07  9:19   ` Geert Uytterhoeven
2014-10-07  5:28 ` [PATCH 36/44] mips: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 37/44] sh: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 38/44] x86: lguest: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 39/44] x86: ce4100: " Guenter Roeck
2014-10-07  5:28 ` [PATCH 40/44] x86: intel-mid: Drop registration of dummy poweroff handlers Guenter Roeck
2014-10-07  5:28 ` [PATCH 41/44] x86: pmc_atom: Register poweroff handler with kernel poweroff handler Guenter Roeck
2014-10-07  5:28 ` [PATCH 42/44] efi: " Guenter Roeck
2014-10-16 14:59   ` Matt Fleming
2014-10-16 15:24     ` Mark Salter
2014-10-16 17:27       ` Guenter Roeck
2014-10-16 17:46         ` Matt Fleming
2014-10-16 18:27           ` Guenter Roeck
2014-10-07  5:28 ` [PATCH 43/44] hwmon: (ab8500) Call kernel_power_off instead of pm_power_off Guenter Roeck
2014-10-07  5:28 ` [PATCH 44/44] kernel: Remove pm_power_off Guenter Roeck
2014-10-07 23:43   ` Rafael J. Wysocki

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='CAH6sp9O0B_BWS8cLSq=MoFbe3nB_45+K64gh7QMHO3meT-b14w@mail.gmail.com' \
    --to=fransklaver@gmail.com \
    --cc=linux-arm-kernel@lists.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;
as well as URLs for NNTP newsgroup(s).