Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1564696

Re: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Date 2017-01-23 07:00 +0100
Message-ID <t2FPA-2w6-3@gated-at.bofh.it> (permalink)
References <t0BwJ-7cW-19@gated-at.bofh.it> <t0BGp-7vj-1@gated-at.bofh.it> <t0Cj9-7Jg-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Peter Zijlstra <peterz@infradead.org> writes:

> On Tue, Jan 17, 2017 at 02:07:36PM +0100, Vlastimil Babka wrote:
>
>> Anyway I'm not sure if this patch is safe. Hopefully Peter can judge
>> this better...
>> 
>> > Cc: Vlastimil Babka <vbabka@suse.cz>
>> > Signed-off-by: Stafford Horne <shorne@gmail.com>
>> > ---
>> >  init/main.c | 3 +--
>> >  1 file changed, 1 insertion(+), 2 deletions(-)
>> > 
>> > diff --git a/init/main.c b/init/main.c
>> > index 8b1adb6e..d1ca7cb 100644
>> > --- a/init/main.c
>> > +++ b/init/main.c
>> > @@ -513,6 +513,7 @@ asmlinkage __visible void __init start_kernel(void)
>> >  	boot_cpu_state_init();
>> >  	smp_prepare_boot_cpu();	/* arch-specific boot-cpu hooks */
>> >  
>> > +	jump_label_init();
>> >  	build_all_zonelists(NULL, NULL);
>> >  	page_alloc_init();
>> >  
>> > @@ -526,8 +527,6 @@ asmlinkage __visible void __init start_kernel(void)
>> >  		parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
>> >  			   NULL, set_init_arg);
>> >  
>> > -	jump_label_init();
>> > -
>
> Urgh, that means auditing all archs that implement this. The thing
> you're looking for is if the self-modifying code cruft can be done that
> early.

You could do what we do on powerpc, which is to call jump_label_init()
early in arch code.

The second call from generic code will just return without doing
anything, see the start of jump_label_init():

void __init jump_label_init(void)
{
	struct jump_entry *iter_start = __start___jump_table;
	struct jump_entry *iter_stop = __stop___jump_table;
	struct static_key *key = NULL;
	struct jump_entry *iter;

	/*
	 * Since we are initializing the static_key.enabled field with
	 * with the 'raw' int values (to avoid pulling in atomic.h) in
	 * jump_label.h, let's make sure that is safe. There are only two
	 * cases to check since we initialize to 0 or 1.
	 */
	BUILD_BUG_ON((int)ATOMIC_INIT(0) != 0);
	BUILD_BUG_ON((int)ATOMIC_INIT(1) != 1);

	if (static_key_initialized)
		return;


cheers

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH -next] init/main: Init jump_labels before they are used to build zonelists Stafford Horne <shorne@gmail.com> - 2017-01-17 14:00 +0100
  Re: [PATCH -next] init/main: Init jump_labels before they are used to  build zonelists Vlastimil Babka <vbabka@suse.cz> - 2017-01-17 14:10 +0100
    Re: [PATCH -next] init/main: Init jump_labels before they are used  to build zonelists Peter Zijlstra <peterz@infradead.org> - 2017-01-17 14:50 +0100
      Re: [PATCH -next] init/main: Init jump_labels before they are used  to build zonelists Stafford Horne <shorne@gmail.com> - 2017-01-17 15:40 +0100
        Re: [PATCH -next] init/main: Init jump_labels before they are used to  build zonelists Vlastimil Babka <vbabka@suse.cz> - 2017-01-17 17:30 +0100
          Re: [PATCH -next] init/main: Init jump_labels before they are used  to build zonelists Andrew Morton <akpm@linux-foundation.org> - 2017-01-17 21:40 +0100
            Re: [PATCH -next] init/main: Init jump_labels before they are used to  build zonelists Vlastimil Babka <vbabka@suse.cz> - 2017-01-17 22:00 +0100
              Re: [PATCH -next] init/main: Init jump_labels before they are used to  build zonelists Vlastimil Babka <vbabka@suse.cz> - 2017-01-19 09:30 +0100
                Re: [PATCH -next] init/main: Init jump_labels before they are used  to build zonelists Mel Gorman <mgorman@techsingularity.net> - 2017-01-19 11:00 +0100
      Re: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists Michael Ellerman <mpe@ellerman.id.au> - 2017-01-23 07:00 +0100

csiph-web