Re: [PATCH v3 2/7] x86/jump_label: Use text_poke_early() during early_init

From: Peter Zijlstra
Date: Mon Nov 05 2018 - 08:33:56 EST


On Mon, Nov 05, 2018 at 01:39:53PM +0100, Peter Zijlstra wrote:
> On Fri, Nov 02, 2018 at 04:29:41PM -0700, Nadav Amit wrote:
> > diff --git a/init/main.c b/init/main.c
> > index a664246450d1..b0fa26637496 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -117,6 +117,8 @@ extern void radix_tree_init(void);
> > */
> > bool early_boot_irqs_disabled __read_mostly;
> >
> > +u8 early_boot_done __read_mostly;
> > +
> > enum system_states system_state __read_mostly;
> > EXPORT_SYMBOL(system_state);
>
> Should this not be using system_state ^ ? The site is very close to
> SYSTEM_SCHEDULING, can we use that or should we add another state ?

We must be before kernel_init() -> kernel_init_freeable() -> smp_init().

So we need another state, something like SYSTEM_BOOTING_SMP I suppose ?

> > @@ -735,6 +737,8 @@ asmlinkage __visible void __init start_kernel(void)
> > efi_free_boot_services();
> > }
> >
> > + early_boot_done = true;
> > +
> > /* Do the rest non-__init'ed, we're now alive */
> > rest_init();
> > }
> > --
> > 2.17.1
> >