• C200, 712/80: strange sysfs issues with Linux 4.18.0-1-parisc

    From Frank Scheiner@21:1/5 to All on Wed Nov 28 16:30:01 2018
    Hi all,

    I'm experiencing some strange issues on both a C200 and a 712/80 with
    the current 32 bit SP kernel (4.18.0-2.parisc (4.18.10-2)). This does
    not happen when using the 64 bit MP kernel of the same version on a
    rp3440 for example.

    For every module loaded I get a message similar to the following example:

    C200:
    ```
    [...]
    [ 47.799100] sysfs: cannot create duplicate filename '/module/nfs/sections/.text'
    [ 47.887396] CPU: 0 PID: 98 Comm: modprobe Not tainted 4.18.0-2-parisc
    #1 Debian 4.18.10-2
    [ 47.984894] Backtrace:
    [ 48.013164] [<1017ce2c>] show_stack+0x3c/0x50
    [ 48.066177] [<107a7210>] dump_stack+0x28/0x38
    [ 48.119192] [<103f900c>] sysfs_warn_dup+0x88/0xac
    [ 48.176329] [<103f8b1c>] sysfs_add_file_mode_ns+0x164/0x1d0
    [ 48.243832] [<103f9e70>] internal_create_group+0x11c/0x304
    [ 48.310277] [<103fa0a0>] sysfs_create_group+0x48/0x60
    [ 48.371571] [<1022abe8>] load_module.constprop.35+0x1f9c/0x23b8
    [ 48.443200] [<1022b278>] sys_finit_module+0xd0/0x11c
    [ 48.503468] [<101831dc>] syscall_exit+0x0/0x14
    [...]
    ```

    Testing with older kernel versions, this seems to start with
    4.18.0-1-parisc (4.18.6-1). 4.17.0-1-parisc (4.17.8-1) is still OK.

    [1] is from 2011 and describes a similar case (on s390x though) and
    there are also other reports on the web from earlier (e.g. [2] for
    Debian on amd64, though the reason there looks different to [1]) and
    later that describe a similar behaviour.

    [1]: https://lore.kernel.org/patchwork/patch/244909/

    [2]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605472

    Did anyone with an on-disk installation notice something similar recently?

    Cheers,
    Frank

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John David Anglin@21:1/5 to Helge Deller on Wed Nov 28 18:40:01 2018
    On 2018-11-28 12:14 p.m., Helge Deller wrote:
      7 .text         00000c8c  00000000  00000000  00016910  2**2                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
      8 .text         00000000  00000000  00000000  0001759c  2**0                   CONTENTS, ALLOC, LOAD, READONLY, CODE

    As can be seen, we now get multiple sections all named ".text" which
    is what triggers the kernel warning.

    It seems we need to revert the patch, or find a way that the compiler
    doesn't produce multiple .text sections...?

    The linker should merge them.  It looks like some .text sections may be lacking a .align directive.  Maybe that's
    the problem.

    Dave

    --
    John David Anglin dave.anglin@bell.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helge Deller@21:1/5 to Frank Scheiner on Wed Nov 28 18:20:01 2018
    On 28.11.18 16:26, Frank Scheiner wrote:
    I'm experiencing some strange issues on both a C200 and a 712/80 with
    the current 32 bit SP kernel (4.18.0-2.parisc (4.18.10-2)). This does
    not happen when using the 64 bit MP kernel of the same version on a
    rp3440 for example.

    For every module loaded I get a message similar to the following example: [...]
    [   47.799100] sysfs: cannot create duplicate filename '/module/nfs/sections/.text'
    [   47.887396] CPU: 0 PID: 98 Comm: modprobe Not tainted 4.18.0-2-parisc #1 Debian 4.18.10-2
    [   47.984894] Backtrace:
    [   48.013164]  [<1017ce2c>] show_stack+0x3c/0x50
    [   48.066177]  [<107a7210>] dump_stack+0x28/0x38
    [   48.119192]  [<103f900c>] sysfs_warn_dup+0x88/0xac
    [   48.176329]  [<103f8b1c>] sysfs_add_file_mode_ns+0x164/0x1d0
    [   48.243832]  [<103f9e70>] internal_create_group+0x11c/0x304
    [   48.310277]  [<103fa0a0>] sysfs_create_group+0x48/0x60
    [   48.371571]  [<1022abe8>] load_module.constprop.35+0x1f9c/0x23b8
    [   48.443200]  [<1022b278>] sys_finit_module+0xd0/0x11c
    [   48.503468]  [<101831dc>] syscall_exit+0x0/0x14

    I think it happens because I disabled building the kernel with the "-ffunction-sections" compiler option.
    The relevant patch was included in kernel 4.18: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=24b6c22504a27210a8377e54d24d425ae414f2c1

    On kernel 4.17 I see:

    ./4.17.0-3-parisc-smp/kernel/drivers/net/ethernet/intel/e1000/e1000.ko: file format elf32-hppa-linux
    Sections:
    Idx Name Size VMA LMA File off Algn
    0 .note.gnu.build-id 00000024 00000000 00000000 00000034 2**2
    CONTENTS, ALLOC, LOAD, READONLY, DATA
    1 .text 00000000 00000000 00000000 00000058 2**0
    CONTENTS, ALLOC, LOAD, READONLY, CODE
    2 .text.e1000_alloc_dummy_rx_buffers 0000002c 00000000 00000000 00000058 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    3 .text.e1000_fix_features 00000074 00000000 00000000 00000084 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    4 .text.unlikely.e1000_regdump 0000049c 00000000 00000000 000000f8 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    5 .text.e1000_setup_rctl 00000144 00000000 00000000 00000594 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    6 .text.e1000_configure_rx 000002a0 00000000 00000000 000006d8 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE


    On kernel 4.18 I get: ./4.18.0-3-parisc-smp/kernel/drivers/net/ethernet/intel/e1000/e1000.ko: file format elf32-hppa-linux

    Sections:
    Idx Name Size VMA LMA File off Algn
    0 .note.gnu.build-id 00000024 00000000 00000000 00000034 2**2
    CONTENTS, ALLOC, LOAD, READONLY, DATA
    1 .text 0000a550 00000000 00000000 00000058 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    2 .text.unlikely 0000078c 00000000 00000000 0000a5a8 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    3 .init.text 000000cc 00000000 00000000 0000ad34 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    4 .exit.text 00000030 00000000 00000000 0000ae00 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    5 .text 00007848 00000000 00000000 0000ae30 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    6 .text 00004298 00000000 00000000 00012678 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    7 .text 00000c8c 00000000 00000000 00016910 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    8 .text 00000000 00000000 00000000 0001759c 2**0
    CONTENTS, ALLOC, LOAD, READONLY, CODE

    As can be seen, we now get multiple sections all named ".text" which is what triggers the kernel warning.

    It seems we need to revert the patch, or find a way that the compiler doesn't produce multiple .text sections...?

    Helge

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helge Deller@21:1/5 to All on Wed Nov 28 22:10:01 2018
    * John David Anglin <dave.anglin@bell.net>:
    On 2018-11-28 12:14 p.m., Helge Deller wrote:
      7 .text         00000c8c  00000000  00000000  00016910  2**2                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
      8 .text         00000000  00000000  00000000  0001759c  2**0                   CONTENTS, ALLOC, LOAD, READONLY, CODE

    As can be seen, we now get multiple sections all named ".text" which is what triggers the kernel warning.

    It seems we need to revert the patch, or find a way that the compiler doesn't produce multiple .text sections...?

    The linker should merge them.  It looks like some .text sections may
    be lacking a .align directive.  Maybe that's the problem.

    I only see one section with "2**0" alignment, and that one is even empty (length of 0 bytes).
    I tried the attached patch which adds a module linker script, but it doesn't help either.

    This is what I see now. Why aren't the last .text sections (#2-6 a
    least) merged? Are there any linker options I can try?

    Sections:
    Idx Name Size VMA LMA File off Algn
    ...
    2 .text 000004a4 00001000 00001000 00001000 2**12
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    3 .text 0000984c 00000000 00000000 000014a4 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    4 .text 00005cdc 00000000 00000000 0000acf0 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    5 .text 00003e20 00000000 00000000 000109cc 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    6 .text 00000b88 00000000 00000000 000147ec 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    7 .text 00000000 00000000 00000000 00015374 2**0
    CONTENTS, ALLOC, LOAD, READONLY, CODE

    But maybe we should revert to -ffunction-sections for modules anyway.
    If all .text sections get merged it may happen that we get too big
    modules again which fail to load because the distance for jumps are too
    far. Currently the module loader will insert jump tables between
    sections if necessary...

    Helge


    diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
    index d047a09d660f..111e2bf2fc20 100644
    --- a/arch/parisc/Makefile
    +++ b/arch/parisc/Makefile
    @@ -71,6 +71,8 @@ ifdef CONFIG_MLONGCALLS
    KBUILD_CFLAGS_KERNEL += -mlong-calls
    endif

    +KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/parisc/module.lds
    +
    # select which processor to optimise for
    cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100
    cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200
    diff --git a/arch/parisc/module.lds b/arch/parisc/module.lds
    new file mode 100644
    index 000000000000..b3573d3ce805
    --- /dev/null
    +++ b/arch/parisc/module.lds
    @@ -0,0 +1,16 @@
    +/* SPDX-License-Identifier: GPL-2.0 */
    +SECTIONS {
    + /* Group all text sections into a single section: */
    + .text : ALIGN(4096)
    + {
    + *(.text .text.* .fixup)
    + }
    + .init.text : ALIGN(4096)
    + {
    + *(.init.text .init.text.*)
    + }
    + .exit.text : ALIGN(4096)
    + {
    + *(.exit.text .exit.text.*)
    + }
    +}

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John David Anglin@21:1/5 to Helge Deller on Wed Nov 28 23:20:01 2018
    On 2018-11-28 4:07 p.m., Helge Deller wrote:
    This is what I see now. Why aren't the last .text sections (#2-6 a
    least) merged? Are there any linker options I can try?

    Sections:
    Idx Name Size VMA LMA File off Algn
    ...
    2 .text 000004a4 00001000 00001000 00001000 2**12
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    3 .text 0000984c 00000000 00000000 000014a4 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    4 .text 00005cdc 00000000 00000000 0000acf0 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    5 .text 00003e20 00000000 00000000 000109cc 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    6 .text 00000b88 00000000 00000000 000147ec 2**2
    CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
    7 .text 00000000 00000000 00000000 00015374 2**0
    CONTENTS, ALLOC, LOAD, READONLY, CODE

    But maybe we should revert to -ffunction-sections for modules anyway.
    If all .text sections get merged it may happen that we get too big
    modules again which fail to load because the distance for jumps are too
    far. Currently the module loader will insert jump tables between
    sections if necessary...
    If I remember correctly, section merging is controlled by linker script.

    It does seem unique section names are required for modules, so I think reverting to
    -ffunction-sections for modules is a good idea for the moment.

    In looking at some arm64 modules, I only see one .text section.

    Dave

    --
    John David Anglin dave.anglin@bell.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)