Message ID | 20210926072048.190336-10-wangkefeng.wang@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | sections: Unify kernel sections range check and use | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Le 26/09/2021 à 09:20, Kefeng Wang a écrit : > Use is_kernel_text() and is_kernel_inittext() helper to simplify code, > also drop etext, _stext, _sinittext, _einittext declaration which > already declared in section.h. > > Cc: Michael Ellerman <mpe@ellerman.id.au> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> > Cc: Paul Mackerras <paulus@samba.org> > Cc: linuxppc-dev@lists.ozlabs.org > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> > --- > arch/powerpc/mm/pgtable_32.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c > index dcf5ecca19d9..13c798308c2e 100644 > --- a/arch/powerpc/mm/pgtable_32.c > +++ b/arch/powerpc/mm/pgtable_32.c > @@ -33,8 +33,6 @@ > > #include <mm/mmu_decl.h> > > -extern char etext[], _stext[], _sinittext[], _einittext[]; > - > static u8 early_fixmap_pagetable[FIXMAP_PTE_SIZE] __page_aligned_data; > > notrace void __init early_ioremap_init(void) > @@ -104,14 +102,13 @@ static void __init __mapin_ram_chunk(unsigned long offset, unsigned long top) > { > unsigned long v, s; > phys_addr_t p; > - int ktext; > + bool ktext; > > s = offset; > v = PAGE_OFFSET + s; > p = memstart_addr + s; > for (; s < top; s += PAGE_SIZE) { > - ktext = ((char *)v >= _stext && (char *)v < etext) || > - ((char *)v >= _sinittext && (char *)v < _einittext); > + ktext = (is_kernel_text(v) || is_kernel_inittext(v)); I think we could use core_kernel_next() instead. > map_kernel_page(v, p, ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL); > v += PAGE_SIZE; > p += PAGE_SIZE; > Build failure on mpc885_ads_defconfig arch/powerpc/mm/pgtable_32.c: In function '__mapin_ram_chunk': arch/powerpc/mm/pgtable_32.c:111:26: error: implicit declaration of function 'is_kernel_text'; did you mean 'is_kernel_inittext'? [-Werror=implicit-function-declaration] 111 | ktext = (is_kernel_text(v) || is_kernel_inittext(v)); | ^~~~~~~~~~~~~~ | is_kernel_inittext cc1: all warnings being treated as errors make[2]: *** [scripts/Makefile.build:277: arch/powerpc/mm/pgtable_32.o] Error 1 make[1]: *** [scripts/Makefile.build:540: arch/powerpc/mm] Error 2 make: *** [Makefile:1868: arch/powerpc] Error 2
On 2021/9/29 1:51, Christophe Leroy wrote: > > > Le 26/09/2021 à 09:20, Kefeng Wang a écrit : >> Use is_kernel_text() and is_kernel_inittext() helper to simplify code, >> also drop etext, _stext, _sinittext, _einittext declaration which >> already declared in section.h. >> >> Cc: Michael Ellerman <mpe@ellerman.id.au> >> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> >> Cc: Paul Mackerras <paulus@samba.org> >> Cc: linuxppc-dev@lists.ozlabs.org >> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> >> --- >> arch/powerpc/mm/pgtable_32.c | 7 ++----- >> 1 file changed, 2 insertions(+), 5 deletions(-) >> >> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c >> index dcf5ecca19d9..13c798308c2e 100644 >> --- a/arch/powerpc/mm/pgtable_32.c >> +++ b/arch/powerpc/mm/pgtable_32.c >> @@ -33,8 +33,6 @@ >> #include <mm/mmu_decl.h> >> -extern char etext[], _stext[], _sinittext[], _einittext[]; >> - >> static u8 early_fixmap_pagetable[FIXMAP_PTE_SIZE] __page_aligned_data; >> notrace void __init early_ioremap_init(void) >> @@ -104,14 +102,13 @@ static void __init __mapin_ram_chunk(unsigned >> long offset, unsigned long top) >> { >> unsigned long v, s; >> phys_addr_t p; >> - int ktext; >> + bool ktext; >> s = offset; >> v = PAGE_OFFSET + s; >> p = memstart_addr + s; >> for (; s < top; s += PAGE_SIZE) { >> - ktext = ((char *)v >= _stext && (char *)v < etext) || >> - ((char *)v >= _sinittext && (char *)v < _einittext); >> + ktext = (is_kernel_text(v) || is_kernel_inittext(v)); > > I think we could use core_kernel_next() instead. Indead. oops, sorry for the build error, will update, thanks. > > Build failure on mpc885_ads_defconfig > > arch/powerpc/mm/pgtable_32.c: In function '__mapin_ram_chunk': > arch/powerpc/mm/pgtable_32.c:111:26: error: implicit declaration of > function 'is_kernel_text'; did you mean 'is_kernel_inittext'? > [-Werror=implicit-function-declaration] > 111 | ktext = (is_kernel_text(v) || > is_kernel_inittext(v)); > | ^~~~~~~~~~~~~~ > | is_kernel_inittext > cc1: all warnings being treated as errors > make[2]: *** [scripts/Makefile.build:277: arch/powerpc/mm/pgtable_32.o] > Error 1 > make[1]: *** [scripts/Makefile.build:540: arch/powerpc/mm] Error 2 > make: *** [Makefile:1868: arch/powerpc] Error 2 > > > .
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index dcf5ecca19d9..13c798308c2e 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c @@ -33,8 +33,6 @@ #include <mm/mmu_decl.h> -extern char etext[], _stext[], _sinittext[], _einittext[]; - static u8 early_fixmap_pagetable[FIXMAP_PTE_SIZE] __page_aligned_data; notrace void __init early_ioremap_init(void) @@ -104,14 +102,13 @@ static void __init __mapin_ram_chunk(unsigned long offset, unsigned long top) { unsigned long v, s; phys_addr_t p; - int ktext; + bool ktext; s = offset; v = PAGE_OFFSET + s; p = memstart_addr + s; for (; s < top; s += PAGE_SIZE) { - ktext = ((char *)v >= _stext && (char *)v < etext) || - ((char *)v >= _sinittext && (char *)v < _einittext); + ktext = (is_kernel_text(v) || is_kernel_inittext(v)); map_kernel_page(v, p, ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL); v += PAGE_SIZE; p += PAGE_SIZE;
Use is_kernel_text() and is_kernel_inittext() helper to simplify code, also drop etext, _stext, _sinittext, _einittext declaration which already declared in section.h. Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- arch/powerpc/mm/pgtable_32.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)