From: Sascha Hauer <s.hauer@pengutronix.de>
To: Herve Codina <herve.CODINA@celad.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: [RFC] Barebox shutdown hooks
Date: Mon, 15 Jun 2015 07:23:33 +0200 [thread overview]
Message-ID: <20150615052333.GK6325@pengutronix.de> (raw)
In-Reply-To: <557AA945.4040108@celad.com>
Hi Herve,
On Fri, Jun 12, 2015 at 11:41:25AM +0200, Herve Codina wrote:
> I try to find a way to perform some tasks on barebox leaving (ie last step of go command or boot/bootm command)
> and i look at shutdown_barebox (common/startup.c)
> This function is :
> ---- 8< -----
> void shutdown_barebox(void)
> {
> devices_shutdown();
> #ifdef ARCH_SHUTDOWN
> arch_shutdown();
> #endif
> if (board_shutdown)
> board_shutdown();
> }
> ---- 8< -----
>
> I have several questions :
>
> 1) Why board_shutdown is called after arch_shutdown.
> arch shutdown is supposed to do stuf like disabling mmu, flushing cache, ...
> Don't you think that board_shutdown should be between devices_shutdown and arch_shutdown ?
You are probably right. Only one single board implements board_shutdown
anyway, so I guess it's just where it suited the original author.
>
> 2) What about the ability to have hooks for shutdown with all resources available
> For my tasks, i need devices available. What do you thing about a new "early_shutdown" called before devices_shutdown.
> barebox_shutdown will become :
> void shutdown_barebox(void)
> {
> early_shutdown();
> devices_shutdown();
> #ifdef ARCH_SHUTDOWN
> arch_shutdown();
> #endif
> if (board_shutdown)
> board_shutdown();
> }
>
> for early_shutdown itself, i would give flexibility. I thing about 2 way :
>
> 2.1) register shutdown hooks
> Use same mechanism as fixing up device tree :
> early_shutdown_register function to register hook
> and iterator calling all registered hooks in early_shutdown
>
> 2.2) exitcall
> Use same mechanism as initcall functions :
> Use a specific section to store exit hooks table. A macro early_exitcall (same mechanism as xxxx_initcall macro) will be used to do this.
> Iterate on each hook in this section in early_shutdown (same mechanism as initcall in start_barebox).
I vote for 2.2). It has the smaller runtime overhead and we can hook
the existing devices_shutdown, arch_shutdown and board_shutdown into
that mechanism aswell.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2015-06-15 5:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 9:41 Herve Codina
2015-06-15 5:23 ` Sascha Hauer [this message]
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=20150615052333.GK6325@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=herve.CODINA@celad.com \
/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