Re: [PATCH 2/3] Better interface for hooking early initcalls.

From: Mathieu Desnoyers
Date: Tue Jun 17 2008 - 10:07:55 EST


* Eduard - Gabriel Munteanu (eduard.munteanu@xxxxxxxxxxx) wrote:
> Added early initcall (pre-SMP) support, using an identical interface to
> that of regular initcalls. Functions called from do_pre_smp_initcalls()
> could be converted to use this cleaner interface.
>
> This is required by CPU hotplug, because early users have to register
> notifiers before going SMP. One such CPU hotplug user is the relay
> interface with buffer-only channels, which needs to register such a
> notifier, to be usable in early code. This in turn is used by kmemtrace.
>

I am not sure it's worth it trying to define a generic "early" initcall,
since definition of "how early it is" may change with time.

Currently, it's earlier than SMP init, but later on, it could become
earlier than mm init. If there are only few users of this, and given
that they must be designed "knowing" how early they are initialized wrt
other subsystems, I think it would make sense to call them directly from
the init code without putting them in a "early initcall" category.

> Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@xxxxxxxxxxx>
....
> -extern initcall_t __initcall_start[], __initcall_end[];
> +extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
>
> static void __init do_initcalls(void)
> {
> initcall_t *call;
>
> - for (call = __initcall_start; call < __initcall_end; call++)
> + for (call = __early_initcall_end; call < __initcall_end; call++)
> do_one_initcall(*call);
>
> /* Make sure there is no pending stuff from the initcall sequence */
> @@ -775,6 +775,14 @@ static int __init nosoftlockup_setup(char *str)
> }
> __setup("nosoftlockup", nosoftlockup_setup);
>
> +static void __init __do_pre_smp_initcalls(void)
> +{
> + initcall_t *call;
> +
> + for (call = __initcall_start; call < __early_initcall_end; call++)
> + (*call)();

why not do_one_initcall(*call); ?

Mathieu

--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/