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


Groups > linux.kernel > #1560574 > unrolled thread

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

Started byStafford Horne <shorne@gmail.com>
First post2017-01-17 14:00 +0100
Last post2017-01-23 07:00 +0100
Articles 10 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [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

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

FromStafford Horne <shorne@gmail.com>
Date2017-01-17 14:00 +0100
Subject[PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t0BwJ-7cW-19@gated-at.bofh.it>
A recent change in -next introduced static_keys in init zonelists,
details are:

  Author: Vlastimil Babka <vbabka@suse.cz>
  Date:   Thu Jan 12 12:19:03 2017 +1100
  commit f5adbdff6a1c40e19 ("mm, page_alloc: convert
  page_group_by_mobility_disable to static key")

This causes the following warning in openrisc as reported by Guenter,
and repoduced by me.

 WARNING: CPU: 0 PID: 0 at ./include/linux/jump_label.h:198 0xc02d758c
 static_key_slow_inc used before call to jump_label_init

This fixes this by initialized jump_labels even earlier, I am suprized the
issue is not showing up in other platforms yet.

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();
-
 	/*
 	 * These use large bootmem allocations and must precede
 	 * kmem_cache_init()
-- 
2.9.3

[toc] | [next] | [standalone]


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

FromVlastimil Babka <vbabka@suse.cz>
Date2017-01-17 14:10 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t0BGp-7vj-1@gated-at.bofh.it>
In reply to#1560574
[+CC PeterZ]

On 01/17/2017 01:56 PM, Stafford Horne wrote:
> A recent change in -next introduced static_keys in init zonelists,
> details are:
> 
>   Author: Vlastimil Babka <vbabka@suse.cz>
>   Date:   Thu Jan 12 12:19:03 2017 +1100
>   commit f5adbdff6a1c40e19 ("mm, page_alloc: convert
>   page_group_by_mobility_disable to static key")
> 
> This causes the following warning in openrisc as reported by Guenter,
> and repoduced by me.
> 
>  WARNING: CPU: 0 PID: 0 at ./include/linux/jump_label.h:198 0xc02d758c
>  static_key_slow_inc used before call to jump_label_init
> 
> This fixes this by initialized jump_labels even earlier, I am suprized the
> issue is not showing up in other platforms yet.

AFAICS it depends on how much memory is available at that point. But
maybe I just missed the warning somehow.

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();
> -
>  	/*
>  	 * These use large bootmem allocations and must precede
>  	 * kmem_cache_init()
> 

[toc] | [prev] | [next] | [standalone]


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

FromPeter Zijlstra <peterz@infradead.org>
Date2017-01-17 14:50 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t0Cj9-7Jg-47@gated-at.bofh.it>
In reply to#1560575
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.

x86 looks to be fine, because this is after setup_arch() which is
required for ideal_nops[] to be initialied and we use text_poke_early()
which doesn't really need anything else.

I've not gone through the other arches...

[toc] | [prev] | [next] | [standalone]


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

FromStafford Horne <shorne@gmail.com>
Date2017-01-17 15:40 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t0D5w-8eI-21@gated-at.bofh.it>
In reply to#1560594
On Tue, Jan 17, 2017 at 02:44:54PM +0100, Peter Zijlstra wrote:
> 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.
> 
> x86 looks to be fine, because this is after setup_arch() which is
> required for ideal_nops[] to be initialied and we use text_poke_early()
> which doesn't really need anything else.
> 
> I've not gone through the other arches...

Vlastimil,

Will you be able to look into that? Openrisc doesnt have jump_label
support, so its no issue at the moment.

Archs that do have it:

arch/arm64/Kconfig:     select HAVE_ARCH_JUMP_LABEL
arch/mips/Kconfig:      select HAVE_ARCH_JUMP_LABEL
arch/s390/Kconfig:      select HAVE_ARCH_JUMP_LABEL
arch/sparc/Kconfig:     select HAVE_ARCH_JUMP_LABEL if SPARC64
arch/tile/Kconfig:      select HAVE_ARCH_JUMP_LABEL
arch/x86/Kconfig:       select HAVE_ARCH_JUMP_LABEL
arch/arm/Kconfig:       select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
arch/powerpc/Kconfig:   select HAVE_ARCH_JUMP_LABEL

I looked at a few (arm, tile) and I dont see their arch_jump_label_transform*
implementations depending on global state like ideal_nops from x86. They
should be ok.

If no time, Should you change your patch to not use static keys for
build_all_zonelists at least?

[toc] | [prev] | [next] | [standalone]


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

FromVlastimil Babka <vbabka@suse.cz>
Date2017-01-17 17:30 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t0ENX-SA-5@gated-at.bofh.it>
In reply to#1560651
On 01/17/2017 03:30 PM, Stafford Horne wrote:
> On Tue, Jan 17, 2017 at 02:44:54PM +0100, Peter Zijlstra wrote:
>> 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.
>>
>> x86 looks to be fine, because this is after setup_arch() which is
>> required for ideal_nops[] to be initialied and we use text_poke_early()
>> which doesn't really need anything else.
>>
>> I've not gone through the other arches...
> 
> Vlastimil,
> 
> Will you be able to look into that? Openrisc doesnt have jump_label
> support, so its no issue at the moment.
> 
> Archs that do have it:
> 
> arch/arm64/Kconfig:     select HAVE_ARCH_JUMP_LABEL
> arch/mips/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> arch/s390/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> arch/sparc/Kconfig:     select HAVE_ARCH_JUMP_LABEL if SPARC64
> arch/tile/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> arch/x86/Kconfig:       select HAVE_ARCH_JUMP_LABEL
> arch/arm/Kconfig:       select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> arch/powerpc/Kconfig:   select HAVE_ARCH_JUMP_LABEL
> 
> I looked at a few (arm, tile) and I dont see their arch_jump_label_transform*
> implementations depending on global state like ideal_nops from x86. They
> should be ok.

Thanks, I'll try.

> If no time, Should you change your patch to not use static keys for
> build_all_zonelists at least?

Yes that would be uglier but possible if I find issues or I'm not
confident enough with the auditing...

[toc] | [prev] | [next] | [standalone]


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

FromAndrew Morton <akpm@linux-foundation.org>
Date2017-01-17 21:40 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t0IHV-3fQ-37@gated-at.bofh.it>
In reply to#1560765
> > 
> > Will you be able to look into that? Openrisc doesnt have jump_label
> > support, so its no issue at the moment.
> > 
> > Archs that do have it:
> > 
> > arch/arm64/Kconfig:     select HAVE_ARCH_JUMP_LABEL
> > arch/mips/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> > arch/s390/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> > arch/sparc/Kconfig:     select HAVE_ARCH_JUMP_LABEL if SPARC64
> > arch/tile/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> > arch/x86/Kconfig:       select HAVE_ARCH_JUMP_LABEL
> > arch/arm/Kconfig:       select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> > arch/powerpc/Kconfig:   select HAVE_ARCH_JUMP_LABEL
> > 
> > I looked at a few (arm, tile) and I dont see their arch_jump_label_transform*
> > implementations depending on global state like ideal_nops from x86. They
> > should be ok.
> 
> Thanks, I'll try.
> 
> > If no time, Should you change your patch to not use static keys for
> > build_all_zonelists at least?
> 
> Yes that would be uglier but possible if I find issues or I'm not
> confident enough with the auditing...

We could just revert f5adbdff6a1c40e19 ("mm, page_alloc: convert
page_group_by_mobility_disable to static key")?

[toc] | [prev] | [next] | [standalone]


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

FromVlastimil Babka <vbabka@suse.cz>
Date2017-01-17 22:00 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t0J1g-3nu-17@gated-at.bofh.it>
In reply to#1561004
On 17.1.2017 21:34, Andrew Morton wrote:
>>>
>>> Will you be able to look into that? Openrisc doesnt have jump_label
>>> support, so its no issue at the moment.
>>>
>>> Archs that do have it:
>>>
>>> arch/arm64/Kconfig:     select HAVE_ARCH_JUMP_LABEL
>>> arch/mips/Kconfig:      select HAVE_ARCH_JUMP_LABEL
>>> arch/s390/Kconfig:      select HAVE_ARCH_JUMP_LABEL
>>> arch/sparc/Kconfig:     select HAVE_ARCH_JUMP_LABEL if SPARC64
>>> arch/tile/Kconfig:      select HAVE_ARCH_JUMP_LABEL
>>> arch/x86/Kconfig:       select HAVE_ARCH_JUMP_LABEL
>>> arch/arm/Kconfig:       select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
>>> arch/powerpc/Kconfig:   select HAVE_ARCH_JUMP_LABEL
>>>
>>> I looked at a few (arm, tile) and I dont see their arch_jump_label_transform*
>>> implementations depending on global state like ideal_nops from x86. They
>>> should be ok.
>>
>> Thanks, I'll try.
>>
>>> If no time, Should you change your patch to not use static keys for
>>> build_all_zonelists at least?
>>
>> Yes that would be uglier but possible if I find issues or I'm not
>> confident enough with the auditing...
> 
> We could just revert f5adbdff6a1c40e19 ("mm, page_alloc: convert
> page_group_by_mobility_disable to static key")?

That's a -next commit id, as the patch is in mmotm. I'll ask for removal if I
don't have a fix soon, but if you or somebody else prefers to do that ASAP, it
can be re-added later with a fix.

[toc] | [prev] | [next] | [standalone]


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

FromVlastimil Babka <vbabka@suse.cz>
Date2017-01-19 09:30 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t1ggy-7x5-17@gated-at.bofh.it>
In reply to#1561016
On 01/17/2017 09:49 PM, Vlastimil Babka wrote:
> On 17.1.2017 21:34, Andrew Morton wrote:
>>>>
>>>> Will you be able to look into that? Openrisc doesnt have jump_label
>>>> support, so its no issue at the moment.
>>>>
>>>> Archs that do have it:
>>>>
>>>> arch/arm64/Kconfig:     select HAVE_ARCH_JUMP_LABEL
>>>> arch/mips/Kconfig:      select HAVE_ARCH_JUMP_LABEL
>>>> arch/s390/Kconfig:      select HAVE_ARCH_JUMP_LABEL
>>>> arch/sparc/Kconfig:     select HAVE_ARCH_JUMP_LABEL if SPARC64
>>>> arch/tile/Kconfig:      select HAVE_ARCH_JUMP_LABEL
>>>> arch/x86/Kconfig:       select HAVE_ARCH_JUMP_LABEL
>>>> arch/arm/Kconfig:       select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
>>>> arch/powerpc/Kconfig:   select HAVE_ARCH_JUMP_LABEL
>>>>
>>>> I looked at a few (arm, tile) and I dont see their arch_jump_label_transform*
>>>> implementations depending on global state like ideal_nops from x86. They
>>>> should be ok.
>>>
>>> Thanks, I'll try.
>>>
>>>> If no time, Should you change your patch to not use static keys for
>>>> build_all_zonelists at least?
>>>
>>> Yes that would be uglier but possible if I find issues or I'm not
>>> confident enough with the auditing...
>>
>> We could just revert f5adbdff6a1c40e19 ("mm, page_alloc: convert
>> page_group_by_mobility_disable to static key")?
> 
> That's a -next commit id, as the patch is in mmotm. I'll ask for removal if I
> don't have a fix soon, but if you or somebody else prefers to do that ASAP, it
> can be re-added later with a fix.

OK I think that we just drop the patch [1] from mmotm. Mel told me the
benefit was marginal, and also the last move of jump_label_init() caused
problems for several releases.

Thanks,
Vlastimil

[1] mm-page_alloc-convert-page_group_by_mobility_disable-to-static-key.patch

[toc] | [prev] | [next] | [standalone]


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

FromMel Gorman <mgorman@techsingularity.net>
Date2017-01-19 11:00 +0100
SubjectRe: [PATCH -next] init/main: Init jump_labels before they are used to build zonelists
Message-ID<t1hFD-8hK-1@gated-at.bofh.it>
In reply to#1562468
On Thu, Jan 19, 2017 at 09:28:28AM +0100, Vlastimil Babka wrote:
> On 01/17/2017 09:49 PM, Vlastimil Babka wrote:
> > On 17.1.2017 21:34, Andrew Morton wrote:
> >>>>
> >>>> Will you be able to look into that? Openrisc doesnt have jump_label
> >>>> support, so its no issue at the moment.
> >>>>
> >>>> Archs that do have it:
> >>>>
> >>>> arch/arm64/Kconfig:     select HAVE_ARCH_JUMP_LABEL
> >>>> arch/mips/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> >>>> arch/s390/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> >>>> arch/sparc/Kconfig:     select HAVE_ARCH_JUMP_LABEL if SPARC64
> >>>> arch/tile/Kconfig:      select HAVE_ARCH_JUMP_LABEL
> >>>> arch/x86/Kconfig:       select HAVE_ARCH_JUMP_LABEL
> >>>> arch/arm/Kconfig:       select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU
> >>>> arch/powerpc/Kconfig:   select HAVE_ARCH_JUMP_LABEL
> >>>>
> >>>> I looked at a few (arm, tile) and I dont see their arch_jump_label_transform*
> >>>> implementations depending on global state like ideal_nops from x86. They
> >>>> should be ok.
> >>>
> >>> Thanks, I'll try.
> >>>
> >>>> If no time, Should you change your patch to not use static keys for
> >>>> build_all_zonelists at least?
> >>>
> >>> Yes that would be uglier but possible if I find issues or I'm not
> >>> confident enough with the auditing...
> >>
> >> We could just revert f5adbdff6a1c40e19 ("mm, page_alloc: convert
> >> page_group_by_mobility_disable to static key")?
> > 
> > That's a -next commit id, as the patch is in mmotm. I'll ask for removal if I
> > don't have a fix soon, but if you or somebody else prefers to do that ASAP, it
> > can be re-added later with a fix.
> 
> OK I think that we just drop the patch [1] from mmotm. Mel told me the
> benefit was marginal, and also the last move of jump_label_init() caused
> problems for several releases.
> 

Note that it's not guaranteed to cause any problems this time. If
jump_label_init can go ahead without the page allocator being fully up
and running then it may be ok.

-- 
Mel Gorman
SUSE Labs

[toc] | [prev] | [next] | [standalone]


#1564696

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-01-23 07:00 +0100
Message-ID<t2FPA-2w6-3@gated-at.bofh.it>
In reply to#1560594
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web