Message ID | 20210604070633.32363-16-wangkefeng.wang@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | init_mm: cleanup ARCH's text/data/brk setup code | expand |
On Fri, 4 Jun 2021 15:06:33 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote: > Use setup_initial_init_mm() helper to simplify code. > > ... > > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -868,10 +868,7 @@ void __init setup_arch(char **cmdline_p) > > if (!boot_params.hdr.root_flags) > root_mountflags &= ~MS_RDONLY; > - init_mm.start_code = (unsigned long) _text; > - init_mm.end_code = (unsigned long) _etext; > - init_mm.end_data = (unsigned long) _edata; > - init_mm.brk = _brk_end; > + setup_initial_init_mm(_text, _etext, _edata, _brk_end); > > code_resource.start = __pa_symbol(_text); > code_resource.end = __pa_symbol(_etext)-1; arch/x86/kernel/setup.c:873:47: warning: passing argument 4 of 'setup_initial_init_mm' makes pointer from integer without a cast [-Wint-conversion] 873 | setup_initial_init_mm(_text, _etext, _edata, _brk_end); | ^~~~~~~~ | | | long unsigned int In file included from ./include/linux/pid_namespace.h:7, from ./include/linux/ptrace.h:10, from ./include/linux/elfcore.h:11, from ./include/linux/crash_core.h:6, from ./include/linux/kexec.h:18, from ./include/linux/crash_dump.h:5, from arch/x86/kernel/setup.c:9: ./include/linux/mm.h:248:29: note: expected 'void *' but argument is of type 'long unsigned int' 248 | void *end_data, void *brk); | ~~~~~~^~~ afaict the other architectures will warn this way, not sure. Please check all that, refresh ,retest and resend?
On 2021/6/8 8:26, Andrew Morton wrote: > On Fri, 4 Jun 2021 15:06:33 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote: > >> Use setup_initial_init_mm() helper to simplify code. >> >> ... >> >> --- a/arch/x86/kernel/setup.c >> +++ b/arch/x86/kernel/setup.c >> @@ -868,10 +868,7 @@ void __init setup_arch(char **cmdline_p) >> >> if (!boot_params.hdr.root_flags) >> root_mountflags &= ~MS_RDONLY; >> - init_mm.start_code = (unsigned long) _text; >> - init_mm.end_code = (unsigned long) _etext; >> - init_mm.end_data = (unsigned long) _edata; >> - init_mm.brk = _brk_end; >> + setup_initial_init_mm(_text, _etext, _edata, _brk_end); >> >> code_resource.start = __pa_symbol(_text); >> code_resource.end = __pa_symbol(_etext)-1; > arch/x86/kernel/setup.c:873:47: warning: passing argument 4 of 'setup_initial_init_mm' makes pointer from integer without a cast [-Wint-conversion] > 873 | setup_initial_init_mm(_text, _etext, _edata, _brk_end); > | ^~~~~~~~ > | | > | long unsigned int > In file included from ./include/linux/pid_namespace.h:7, > from ./include/linux/ptrace.h:10, > from ./include/linux/elfcore.h:11, > from ./include/linux/crash_core.h:6, > from ./include/linux/kexec.h:18, > from ./include/linux/crash_dump.h:5, > from arch/x86/kernel/setup.c:9: > ./include/linux/mm.h:248:29: note: expected 'void *' but argument is of type 'long unsigned int' > 248 | void *end_data, void *brk); > | ~~~~~~^~~ > > > afaict the other architectures will warn this way, not sure. I check all archs again, the x86/m68k/powerpc/h8300 has use some value which is not pointer , other are changed, but forget this one. I do compile, but I don't know why I missed it, sorry about this. > > Please check all that, refresh ,retest and resend? > . >
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 72920af0b3c0..2be957ab7f8c 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -868,10 +868,7 @@ void __init setup_arch(char **cmdline_p) if (!boot_params.hdr.root_flags) root_mountflags &= ~MS_RDONLY; - init_mm.start_code = (unsigned long) _text; - init_mm.end_code = (unsigned long) _etext; - init_mm.end_data = (unsigned long) _edata; - init_mm.brk = _brk_end; + setup_initial_init_mm(_text, _etext, _edata, _brk_end); code_resource.start = __pa_symbol(_text); code_resource.end = __pa_symbol(_etext)-1;
Use setup_initial_init_mm() helper to simplify code. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: x86@kernel.org Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- arch/x86/kernel/setup.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)