From: Guenter Roeck <linux@roeck-us.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-watchdog@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Wim Van Sebroeck <wim@iguana.be>,
Catalin Marinas <catalin.marinas@arm.com>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Will Deacon <will.deacon@arm.com>, Arnd Bergmann <arnd@arndb.de>,
Heiko Stuebner <heiko@sntech.de>,
Russell King <linux@arm.linux.org.uk>,
Jonas Jensen <jonas.jensen@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] kernel: Add support for restart notifier call chain
Date: Mon, 07 Jul 2014 18:10:20 -0700 [thread overview]
Message-ID: <53BB44FC.7070501@roeck-us.net> (raw)
In-Reply-To: <20140707141454.3ca1e2fc2e6a4c985d7d2f35@linux-foundation.org>
On 07/07/2014 02:14 PM, Andrew Morton wrote:
> On Sun, 6 Jul 2014 16:38:14 -0700 Guenter Roeck <linux@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 mutliple 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.
>>
>> To solve the problem, introduce a system restart notifier. This notifier
>> is expected to be called 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 notifier.
>
> It all looks sane to my unfamiliar eye.
>
>> /*
>> + * Notifier list for kernel code which wants to be called
>> + * to restart the system.
>> + */
>
> hm, is this all we have to say?
>
>> --- a/kernel/reboot.c
>> +++ b/kernel/reboot.c
>> @@ -104,6 +104,38 @@ int unregister_reboot_notifier(struct notifier_block *nb)
>> }
>> EXPORT_SYMBOL(unregister_reboot_notifier);
>>
>> +/**
>> + * register_restart_notifier - Register function to be called to reset
>> + * the system
>> + * @nb: Info about notifier function to be called
>> + *
>> + * Registers a function with the list of functions
>> + * to be called to restart the system.
>> + *
>> + * Currently always returns zero, as blocking_notifier_chain_register()
>> + * always returns zero.
>> + */
>
> This would be a good place to describe what those notifier callbacks
> actually do. Why they exist, what their role is, under what
> circumstances they are called, what values they should return, etc.
>
Makes sense. Done.
Guenter
next prev parent reply other threads:[~2014-07-08 1:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-06 23:38 [RFC PATCH v2 0/7] kernel: Add support for restart notifier call chain Guenter Roeck
2014-07-06 23:38 ` [PATCH v2 1/7] " Guenter Roeck
2014-07-07 21:14 ` Andrew Morton
2014-07-08 1:10 ` Guenter Roeck [this message]
2014-07-06 23:38 ` [PATCH v2 2/7] arm64: Support restart through " Guenter Roeck
2014-07-07 21:16 ` Andrew Morton
2014-07-08 1:12 ` Guenter Roeck
2014-07-06 23:38 ` [PATCH v2 3/7] arm: " Guenter Roeck
2014-07-06 23:38 ` [PATCH v2 4/7] power/restart: Call machine_restart instead of arm_pm_restart Guenter Roeck
2014-07-06 23:38 ` [PATCH v2 5/7] watchdog: moxart: Register restart handler with restart notifier Guenter Roeck
2014-07-06 23:38 ` [PATCH v2 6/7] watchdog: alim7101: " Guenter Roeck
2014-07-06 23:38 ` [PATCH v2 7/7] arm/arm64: Unexport restart handlers Guenter Roeck
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=53BB44FC.7070501@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=heiko@sntech.de \
--cc=jonas.jensen@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=maxime.ripard@free-electrons.com \
--cc=mingo@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=will.deacon@arm.com \
--cc=wim@iguana.be \
/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