[PATCH v7 01/11] kernel: Add support for kernel restart handler call chain
Doug Anderson
dianders at chromium.org
Wed Aug 20 21:08:37 PDT 2014
Guenter,
On Tue, Aug 19, 2014 at 5:45 PM, Guenter Roeck <linux at roeck-us.net> wrote:
> Various drivers implement architecture and/or device specific means
> to restart (reset) the system. Various mechanisms have been implemented
> to support those schemes. The best known mechanism is arm_pm_restart,
> which is a function pointer to be set either from platform specific code
> or from drivers. Another mechanism is to use hardware watchdogs to issue
> a reset; this mechanism is used if there is no other method available
> to reset a board or system. Two examples are alim7101_wdt, which currently
> uses the reboot notifier to trigger a reset, and moxart_wdt, which registers
> the arm_pm_restart function.
>
> The existing mechanisms have a number of drawbacks. Typically only one scheme
> to restart the system is supported (at least if arm_pm_restart is used).
> At least in theory there can be multiple means to restart the system, some of
> which may be less desirable (for example one mechanism may only reset the CPU,
> while another may reset the entire system). Using arm_pm_restart can also be
> racy if the function pointer is set from a driver, as the driver may be in
> the process of being unloaded when arm_pm_restart is called.
> Using the reboot notifier is always racy, as it is unknown if and when
> other functions using the reboot notifier have completed execution
> by the time the watchdog fires.
>
> Introduce a system restart handler call chain to solve the described problems.
> This call chain is expected to be executed from the architecture specific
> machine_restart() function. Drivers providing system restart functionality
> (such as the watchdog drivers mentioned above) are expected to register
> with this call chain. By using the priority field in the notifier block,
> callers can control restart handler execution sequence and thus ensure that
> the restart handler with the optimal restart capabilities for a given system
> is called first.
>
> Signed-off-by: Guenter Roeck <linux at roeck-us.net>
> Acked-by: Catalin Marinas <catalin.marinas at arm.com>
> Acked-by: Heiko Stuebner <heiko at sntech.de>
> ---
> v7: Rebased to v3.17-rc1
> v6: Use atomic notifier call chain
> v5: Function renames:
> register_restart_notifier -> register_restart_handler
> unregister_restart_notifier -> unregister_restart_handler
> kernel_restart_notify -> do_kernel_restart
> v4: Document and suggest values for notifier priorities
> v3: Add kernel_restart_notify wrapper function to execute notifier.
> Improve documentation.
> Move restart_notifier_list into kernel/reboot.c and make it static.
> v2: No change.
>
> include/linux/reboot.h | 3 ++
> kernel/reboot.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 84 insertions(+)
Reviewed-by: Doug Anderson <dianders at chromium.org>
Tested-by: Doug Anderson <dianders at chromium.org>
More information about the linux-arm-kernel
mailing list