17 Mar, 2019

2 commits

  • Currently, every arch/*/include/uapi/asm/Kbuild explicitly includes
    the common Kbuild.asm file. Factor out the duplicated include directives
    to scripts/Makefile.asm-generic so that no architecture would opt out
    of the mandatory-y mechanism.

    um is not forced to include mandatory-y since it is a very exceptional
    case which does not support UAPI.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The generic-y is redundant under the following condition:

    - arch has its own implementation

    - the same header is added to generated-y

    - the same header is added to mandatory-y

    If a redundant generic-y is found, the warning like follows is displayed:

    scripts/Makefile.asm-generic:20: redundant generic-y found in arch/arm/include/asm/Kbuild: timex.h

    I fixed up arch Kbuild files found by this.

    Suggested-by: Sam Ravnborg
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

13 Mar, 2019

3 commits

  • Add check for the return value of memblock_alloc*() functions and call
    panic() in case of error. The panic message repeats the one used by
    panicing memblock allocators with adjustment of parameters to include
    only relevant ones.

    The replacement was mostly automated with semantic patches like the one
    below with manual massaging of format strings.

    @@
    expression ptr, size, align;
    @@
    ptr = memblock_alloc(size, align);
    + if (!ptr)
    + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, size, align);

    [anders.roxell@linaro.org: use '%pa' with 'phys_addr_t' type]
    Link: http://lkml.kernel.org/r/20190131161046.21886-1-anders.roxell@linaro.org
    [rppt@linux.ibm.com: fix format strings for panics after memblock_alloc]
    Link: http://lkml.kernel.org/r/1548950940-15145-1-git-send-email-rppt@linux.ibm.com
    [rppt@linux.ibm.com: don't panic if the allocation in sparse_buffer_init fails]
    Link: http://lkml.kernel.org/r/20190131074018.GD28876@rapoport-lnx
    [akpm@linux-foundation.org: fix xtensa printk warning]
    Link: http://lkml.kernel.org/r/1548057848-15136-20-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Signed-off-by: Anders Roxell
    Reviewed-by: Guo Ren [c-sky]
    Acked-by: Paul Burton [MIPS]
    Acked-by: Heiko Carstens [s390]
    Reviewed-by: Juergen Gross [Xen]
    Reviewed-by: Geert Uytterhoeven [m68k]
    Acked-by: Max Filippov [xtensa]
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Make the memblock_phys_alloc() function an inline wrapper for
    memblock_phys_alloc_range() and update the memblock_phys_alloc() callers
    to check the returned value and panic in case of error.

    Link: http://lkml.kernel.org/r/1548057848-15136-8-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Guo Ren [c-sky]
    Cc: Heiko Carstens
    Cc: Juergen Gross [Xen]
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Paul Burton
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • The calls to memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
    and memblock_phys_alloc(size, align) are equivalent as both try to
    allocate 'size' bytes with 'align' alignment anywhere in the memory and
    panic if hte allocation fails.

    The conversion is done using the following semantic patch:

    @@
    expression size, align;
    @@
    - memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
    + memblock_phys_alloc(size, align)

    Link: http://lkml.kernel.org/r/1548057848-15136-4-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Guo Ren [c-sky]
    Cc: Heiko Carstens
    Cc: Juergen Gross [Xen]
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Paul Burton
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

11 Mar, 2019

1 commit

  • Pull DMA mapping updates from Christoph Hellwig:

    - add debugfs support for dumping dma-debug information (Corentin
    Labbe)

    - Kconfig cleanups (Andy Shevchenko and me)

    - debugfs cleanups (Greg Kroah-Hartman)

    - improve dma_map_resource and use it in the media code

    - arch_setup_dma_ops / arch_teardown_dma_ops cleanups

    - various small cleanups and improvements for the per-device coherent
    allocator

    - make the DMA mask an upper bound and don't fail "too large" dma mask
    in the remaning two architectures - this will allow big driver
    cleanups in the following merge windows

    * tag 'dma-mapping-5.1' of git://git.infradead.org/users/hch/dma-mapping: (21 commits)
    Documentation/DMA-API-HOWTO: update dma_mask sections
    sparc64/pci_sun4v: allow large DMA masks
    sparc64/iommu: allow large DMA masks
    sparc64: refactor the ali DMA quirk
    ccio: allow large DMA masks
    dma-mapping: remove the DMA_MEMORY_EXCLUSIVE flag
    dma-mapping: remove dma_mark_declared_memory_occupied
    dma-mapping: move CONFIG_DMA_CMA to kernel/dma/Kconfig
    dma-mapping: improve selection of dma_declare_coherent availability
    dma-mapping: remove an incorrect __iommem annotation
    of: select OF_RESERVED_MEM automatically
    device.h: dma_mem is only needed for HAVE_GENERIC_DMA_COHERENT
    mfd/sm501: depend on HAS_DMA
    dma-mapping: add a kconfig symbol for arch_teardown_dma_ops availability
    dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability
    dma-mapping: move debug configuration options to kernel/dma
    dma-debug: add dumping facility via debugfs
    dma: debug: no need to check return value of debugfs_create functions
    videobuf2: replace a layering violation with dma_map_resource
    dma-mapping: don't BUG when calling dma_map_resource on RAM
    ...

    Linus Torvalds
     

08 Mar, 2019

1 commit

  • Pull xtensa updates from Max Filippov:

    - use generic spinlock/rwlock implementations

    - clean up IPI processing

    - document boot parameters passing to the kernel

    - fix get_wchan

    - various cleanups in time.c, process.c, traps.c and thread_info.h

    * tag 'xtensa-20190307' of git://github.com/jcmvbkbc/linux-xtensa:
    xtensa: simplify trap_init
    xtensa: drop unused definitions
    xtensa: fix get_wchan
    xtensa: use generic spinlock/rwlock implementation
    xtensa: provide xchg for sizes 1 and 2
    xtensa: clean up arch/xtensa/kernel/time.c
    xtensa: SMP: rework IPI processing
    xtensa: document boot parameter passing

    Linus Torvalds
     

07 Mar, 2019

1 commit

  • Pull asm-generic updates from Arnd Bergmann:
    "Only a few small changes this time:

    - Michael S. Tsirkin cleans up linux/mman.h

    - Mike Rapoport found a typo

    I had originally merged another cleanup series for I/O accessors from
    Hugo Lefeuvre as well, but dropped it after the discussion of the
    barrier semantics and some conflicts. I expect this series to get
    merged for a later release though"

    * tag 'asm-generic-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    asm-generic/page.h: fix typo in #error text requiring a real asm/page.h
    arch: move common mmap flags to linux/mman.h
    drm: tweak header name
    x86/mpx: tweak header name

    Linus Torvalds
     

06 Mar, 2019

2 commits

  • Pull year 2038 updates from Thomas Gleixner:
    "Another round of changes to make the kernel ready for 2038. After lots
    of preparatory work this is the first set of syscalls which are 2038
    safe:

    403 clock_gettime64
    404 clock_settime64
    405 clock_adjtime64
    406 clock_getres_time64
    407 clock_nanosleep_time64
    408 timer_gettime64
    409 timer_settime64
    410 timerfd_gettime64
    411 timerfd_settime64
    412 utimensat_time64
    413 pselect6_time64
    414 ppoll_time64
    416 io_pgetevents_time64
    417 recvmmsg_time64
    418 mq_timedsend_time64
    419 mq_timedreceiv_time64
    420 semtimedop_time64
    421 rt_sigtimedwait_time64
    422 futex_time64
    423 sched_rr_get_interval_time64

    The syscall numbers are identical all over the architectures"

    * 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    riscv: Use latest system call ABI
    checksyscalls: fix up mq_timedreceive and stat exceptions
    unicore32: Fix __ARCH_WANT_STAT64 definition
    asm-generic: Make time32 syscall numbers optional
    asm-generic: Drop getrlimit and setrlimit syscalls from default list
    32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option
    compat ABI: use non-compat openat and open_by_handle_at variants
    y2038: add 64-bit time_t syscalls to all 32-bit architectures
    y2038: rename old time and utime syscalls
    y2038: remove struct definition redirects
    y2038: use time32 syscall names on 32-bit
    syscalls: remove obsolete __IGNORE_ macros
    y2038: syscalls: rename y2038 compat syscalls
    x86/x32: use time64 versions of sigtimedwait and recvmmsg
    timex: change syscalls to use struct __kernel_timex
    timex: use __kernel_timex internally
    sparc64: add custom adjtimex/clock_adjtime functions
    time: fix sys_timer_settime prototype
    time: Add struct __kernel_timex
    time: make adjtime compat handling available for 32 bit
    ...

    Linus Torvalds
     
  • Pull networking updates from David Miller:
    "Here we go, another merge window full of networking and #ebpf changes:

    1) Snoop DHCPACKS in batman-adv to learn MAC/IP pairs in the DHCP
    range without dealing with floods of ARP traffic, from Linus
    Lüssing.

    2) Throttle buffered multicast packet transmission in mt76, from
    Felix Fietkau.

    3) Support adaptive interrupt moderation in ice, from Brett Creeley.

    4) A lot of struct_size conversions, from Gustavo A. R. Silva.

    5) Add peek/push/pop commands to bpftool, as well as bash completion,
    from Stanislav Fomichev.

    6) Optimize sk_msg_clone(), from Vakul Garg.

    7) Add SO_BINDTOIFINDEX, from David Herrmann.

    8) Be more conservative with local resends due to local congestion,
    from Yuchung Cheng.

    9) Allow vetoing of unsupported VXLAN FDBs, from Petr Machata.

    10) Add health buffer support to devlink, from Eran Ben Elisha.

    11) Add TXQ scheduling API to mac80211, from Toke Høiland-Jørgensen.

    12) Add statistics to basic packet scheduler filter, from Cong Wang.

    13) Add GRE tunnel support for mlxsw Spectrum-2, from Nir Dotan.

    14) Lots of new IP tunneling forwarding tests, also from Nir Dotan.

    15) Add 3ad stats to bonding, from Nikolay Aleksandrov.

    16) Lots of probing improvements for bpftool, from Quentin Monnet.

    17) Various nfp drive #ebpf JIT improvements from Jakub Kicinski.

    18) Allow #ebpf programs to access gso_segs from skb shared info, from
    Eric Dumazet.

    19) Add sock_diag support for AF_XDP sockets, from Björn Töpel.

    20) Support 22260 iwlwifi devices, from Luca Coelho.

    21) Use rbtree for ipv6 defragmentation, from Peter Oskolkov.

    22) Add JMP32 instruction class support to #ebpf, from Jiong Wang.

    23) Add spinlock support to #ebpf, from Alexei Starovoitov.

    24) Support 256-bit keys and TLS 1.3 in ktls, from Dave Watson.

    25) Add device infomation API to devlink, from Jakub Kicinski.

    26) Add new timestamping socket options which are y2038 safe, from
    Deepa Dinamani.

    27) Add RX checksum offloading for various sh_eth chips, from Sergei
    Shtylyov.

    28) Flow offload infrastructure, from Pablo Neira Ayuso.

    29) Numerous cleanups, improvements, and bug fixes to the PHY layer
    and many drivers from Heiner Kallweit.

    30) Lots of changes to try and make packet scheduler classifiers run
    lockless as much as possible, from Vlad Buslov.

    31) Support BCM957504 chip in bnxt_en driver, from Erik Burrows.

    32) Add concurrency tests to tc-tests infrastructure, from Vlad
    Buslov.

    33) Add hwmon support to aquantia, from Heiner Kallweit.

    34) Allow 64-bit values for SO_MAX_PACING_RATE, from Eric Dumazet.

    And I would be remiss if I didn't thank the various major networking
    subsystem maintainers for integrating much of this work before I even
    saw it. Alexei Starovoitov, Daniel Borkmann, Pablo Neira Ayuso,
    Johannes Berg, Kalle Valo, and many others. Thank you!"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2207 commits)
    net/sched: avoid unused-label warning
    net: ignore sysctl_devconf_inherit_init_net without SYSCTL
    phy: mdio-mux: fix Kconfig dependencies
    net: phy: use phy_modify_mmd_changed in genphy_c45_an_config_aneg
    net: dsa: mv88e6xxx: add call to mv88e6xxx_ports_cmode_init to probe for new DSA framework
    selftest/net: Remove duplicate header
    sky2: Disable MSI on Dell Inspiron 1545 and Gateway P-79
    net/mlx5e: Update tx reporter status in case channels were successfully opened
    devlink: Add support for direct reporter health state update
    devlink: Update reporter state to error even if recover aborted
    sctp: call iov_iter_revert() after sending ABORT
    team: Free BPF filter when unregistering netdev
    ip6mr: Do not call __IP6_INC_STATS() from preemptible context
    isdn: mISDN: Fix potential NULL pointer dereference of kzalloc
    net: dsa: mv88e6xxx: support in-band signalling on SGMII ports with external PHYs
    cxgb4/chtls: Prefix adapter flags with CXGB4
    net-sysfs: Switch to bitmap_zalloc()
    mellanox: Switch to bitmap_zalloc()
    bpf: add test cases for non-pointer sanitiation logic
    mlxsw: i2c: Extend initialization by querying resources data
    ...

    Linus Torvalds
     

05 Mar, 2019

1 commit

  • Every in-kernel use of this function defined it to KERNEL_DS (either as
    an actual define, or as an inline function). It's an entirely
    historical artifact, and long long long ago used to actually read the
    segment selector valueof '%ds' on x86.

    Which in the kernel is always KERNEL_DS.

    Inspired by a patch from Jann Horn that just did this for a very small
    subset of users (the ones in fs/), along with Al who suggested a script.
    I then just took it to the logical extreme and removed all the remaining
    gunk.

    Roughly scripted with

    git grep -l '(get_ds())' -- :^tools/ | xargs sed -i 's/(get_ds())/(KERNEL_DS)/'
    git grep -lw 'get_ds' -- :^tools/ | xargs sed -i '/^#define get_ds()/d'

    plus manual fixups to remove a few unusual usage patterns, the couple of
    inline function cases and to fix up a comment that had become stale.

    The 'get_ds()' function remains in an x86 kvm selftest, since in user
    space it actually does something relevant.

    Inspired-by: Jann Horn
    Inspired-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

28 Feb, 2019

1 commit

  • …rnd/playground into timers/2038

    Pull additional syscall ABI cleanup for y2038 from Arnd Bergmann:

    This is a follow-up to the y2038 syscall patches already merged in the tip
    tree. As the final 32-bit RISC-V syscall ABI is still being decided on,
    this is the last chance to make a few corrections to leave out interfaces
    based on 32-bit time_t along with the old off_t and rlimit types.

    The series achieves this in a few steps:

    - A couple of bug fixes for minor regressions I introduced
    in the original series

    - A couple of older patches from Yury Norov that I had never
    merged in the past, these fix up the openat/open_by_handle_at and
    getrlimit/setrlimit syscalls to disallow the old versions of off_t
    and rlimit.

    - Hiding the deprecated system calls behind an #ifdef in
    include/uapi/asm-generic/unistd.h

    - Change arch/riscv to drop all these ABIs.

    Originally, the plan was to also leave these out on C-Sky, but that now
    has a glibc port that uses the older interfaces, so we need to leave
    them in place.

    Thomas Gleixner
     

19 Feb, 2019

2 commits

  • All new 32-bit architectures should have 64-bit userspace off_t type, but
    existing architectures has 32-bit ones.

    To enforce the rule, new config option is added to arch/Kconfig that defaults
    ARCH_32BIT_OFF_T to be disabled for new 32-bit architectures. All existing
    32-bit architectures enable it explicitly.

    New option affects force_o_largefile() behaviour. Namely, if userspace
    off_t is 64-bits long, we have no reason to reject user to open big files.

    Note that even if architectures has only 64-bit off_t in the kernel
    (arc, c6x, h8300, hexagon, nios2, openrisc, and unicore32),
    a libc may use 32-bit off_t, and therefore want to limit the file size
    to 4GB unless specified differently in the open flags.

    Signed-off-by: Yury Norov
    Acked-by: Arnd Bergmann
    Signed-off-by: Yury Norov
    Signed-off-by: Arnd Bergmann

    Yury Norov
     
  • Now that we have 3 mmap flags shared by all architectures,
    let's move them into the common header.

    This will help discourage future architectures from duplicating code.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Arnd Bergmann

    Michael S. Tsirkin
     

14 Feb, 2019

1 commit

  • The OF_RESERVED_MEM can be used if we have either CMA or the generic
    declare coherent code built and we support the early flattened DT.

    So don't bother making it a user visible options that is selected
    by most configs that fit the above category, but just select it when
    the requirements are met.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Rob Herring

    Christoph Hellwig
     

11 Feb, 2019

2 commits

  • …/arnd/playground into timers/2038

    Pull y2038 - time64 system calls from Arnd Bergmann:

    This series finally gets us to the point of having system calls with 64-bit
    time_t on all architectures, after a long time of incremental preparation
    patches.

    There was actually one conversion that I missed during the summer,
    i.e. Deepa's timex series, which I now updated based the 5.0-rc1 changes
    and review comments.

    The following system calls are now added on all 32-bit architectures using
    the same system call numbers:

    403 clock_gettime64
    404 clock_settime64
    405 clock_adjtime64
    406 clock_getres_time64
    407 clock_nanosleep_time64
    408 timer_gettime64
    409 timer_settime64
    410 timerfd_gettime64
    411 timerfd_settime64
    412 utimensat_time64
    413 pselect6_time64
    414 ppoll_time64
    416 io_pgetevents_time64
    417 recvmmsg_time64
    418 mq_timedsend_time64
    419 mq_timedreceiv_time64
    420 semtimedop_time64
    421 rt_sigtimedwait_time64
    422 futex_time64
    423 sched_rr_get_interval_time64

    Each one of these corresponds directly to an existing system call that
    includes a 'struct timespec' argument, or a structure containing a timespec
    or (in case of clock_adjtime) timeval. Not included here are new versions
    of getitimer/setitimer and getrusage/waitid, which are planned for the
    future but only needed to make a consistent API rather than for correct
    operation beyond y2038. These four system calls are based on 'timeval', and
    it has not been finally decided what the replacement kernel interface will
    use instead.

    So far, I have done a lot of build testing across most architectures, which
    has found a number of bugs. Runtime testing so far included testing LTP on
    32-bit ARM with the existing system calls, to ensure we do not regress for
    existing binaries, and a test with a 32-bit x86 build of LTP against a
    modified version of the musl C library that has been adapted to the new
    system call interface [3]. This library can be used for testing on all
    architectures supported by musl-1.1.21, but it is not how the support is
    getting integrated into the official musl release. Official musl support is
    planned but will require more invasive changes to the library.

    Link: https://lore.kernel.org/lkml/20190110162435.309262-1-arnd@arndb.de/T/
    Link: https://lore.kernel.org/lkml/20190118161835.2259170-1-arnd@arndb.de/
    Link: https://git.linaro.org/people/arnd/musl-y2038.git/ [2]

    Thomas Gleixner
     
  • …git/arnd/playground into timers/2038

    Pull preparatory work for y2038 changes from Arnd Bergmann:

    System call unification and cleanup

    The system call tables have diverged a bit over the years, and a number of
    the recent additions never made it into all architectures, for one reason
    or another.

    This is an attempt to clean it up as far as we can without breaking
    compatibility, doing a number of steps:

    - Add system calls that have not yet been integrated into all architectures
    but that we definitely want there. This includes {,f}statfs64() and
    get{eg,eu,g,p,u,pp}id() on alpha, which have been missing traditionally.

    - The s390 compat syscall handling is cleaned up to be more like what we
    do on other architectures, while keeping the 31-bit pointer
    extension. This was merged as a shared branch by the s390 maintainers
    and is included here in order to base the other patches on top.

    - Add the separate ipc syscalls on all architectures that traditionally
    only had sys_ipc(). This version is done without support for IPC_OLD
    that is we have in sys_ipc. The new semtimedop_time64 syscall will only
    be added here, not in sys_ipc

    - Add syscall numbers for a couple of syscalls that we probably don't need
    everywhere, in particular pkey_* and rseq, for the purpose of symmetry:
    if it's in asm-generic/unistd.h, it makes sense to have it everywhere. I
    expect that any future system calls will get assigned on all platforms
    together, even when they appear to be specific to a single architecture.

    - Prepare for having the same system call numbers for any future calls. In
    combination with the generated tables, this hopefully makes it easier to
    add new calls across all architectures together.

    All of the above are technically separate from the y2038 work, but are done
    as preparation before we add the new 64-bit time_t system calls everywhere,
    providing a common baseline set of system calls.

    I expect that glibc and other libraries that want to use 64-bit time_t will
    require linux-5.1 kernel headers for building in the future, and at a much
    later point may also require linux-5.1 or a later version as the minimum
    kernel at runtime. Having a common baseline then allows the removal of many
    architecture or kernel version specific workarounds.

    Thomas Gleixner
     

09 Feb, 2019

1 commit


08 Feb, 2019

7 commits


07 Feb, 2019

4 commits

  • This adds 21 new system calls on each ABI that has 32-bit time_t
    today. All of these have the exact same semantics as their existing
    counterparts, and the new ones all have macro names that end in 'time64'
    for clarification.

    This gets us to the point of being able to safely use a C library
    that has 64-bit time_t in user space. There are still a couple of
    loose ends to tie up in various areas of the code, but this is the
    big one, and should be entirely uncontroversial at this point.

    In particular, there are four system calls (getitimer, setitimer,
    waitid, and getrusage) that don't have a 64-bit counterpart yet,
    but these can all be safely implemented in the C library by wrapping
    around the existing system calls because the 32-bit time_t they
    pass only counts elapsed time, not time since the epoch. They
    will be dealt with later.

    Signed-off-by: Arnd Bergmann
    Acked-by: Heiko Carstens
    Acked-by: Geert Uytterhoeven
    Acked-by: Catalin Marinas

    Arnd Bergmann
     
  • The time, stime, utime, utimes, and futimesat system calls are only
    used on older architectures, and we do not provide y2038 safe variants
    of them, as they are replaced by clock_gettime64, clock_settime64,
    and utimensat_time64.

    However, for consistency it seems better to have the 32-bit architectures
    that still use them call the "time32" entry points (leaving the
    traditional handlers for the 64-bit architectures), like we do for system
    calls that now require two versions.

    Note: We used to always define __ARCH_WANT_SYS_TIME and
    __ARCH_WANT_SYS_UTIME and only set __ARCH_WANT_COMPAT_SYS_TIME and
    __ARCH_WANT_SYS_UTIME32 for compat mode on 64-bit kernels. Now this is
    reversed: only 64-bit architectures set __ARCH_WANT_SYS_TIME/UTIME, while
    we need __ARCH_WANT_SYS_TIME32/UTIME32 for 32-bit architectures and compat
    mode. The resulting asm/unistd.h changes look a bit counterintuitive.

    This is only a cleanup patch and it should not change any behavior.

    Signed-off-by: Arnd Bergmann
    Acked-by: Geert Uytterhoeven
    Acked-by: Heiko Carstens

    Arnd Bergmann
     
  • This is the big flip, where all 32-bit architectures set COMPAT_32BIT_TIME
    and use the _time32 system calls from the former compat layer instead
    of the system calls that take __kernel_timespec and similar arguments.

    The temporary redirects for __kernel_timespec, __kernel_itimerspec
    and __kernel_timex can get removed with this.

    It would be easy to split this commit by architecture, but with the new
    generated system call tables, it's easy enough to do it all at once,
    which makes it a little easier to check that the changes are the same
    in each table.

    Acked-by: Geert Uytterhoeven
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • These are all for ignoring the lack of obsolete system calls,
    which have been marked the same way in scripts/checksyscall.sh,
    so these can be removed.

    Signed-off-by: Arnd Bergmann
    Acked-by: Heiko Carstens

    Arnd Bergmann
     

04 Feb, 2019

1 commit

  • Many architectures maintain an arch specific copy of the
    file even though there are no differences with the asm-generic
    one. Allow these architectures to use the generic one instead.

    Signed-off-by: Deepa Dinamani
    Acked-by: Max Filippov
    Acked-by: Heiko Carstens
    Acked-by: Willem de Bruijn
    Cc: chris@zankel.net
    Cc: fenghua.yu@intel.com
    Cc: tglx@linutronix.de
    Cc: schwidefsky@de.ibm.com
    Cc: linux-ia64@vger.kernel.org
    Cc: linux-xtensa@linux-xtensa.org
    Cc: linux-s390@vger.kernel.org
    Signed-off-by: David S. Miller

    Deepa Dinamani
     

28 Jan, 2019

1 commit

  • This fixes the following warning at boot when the kernel is booted on a
    board with more CPU cores than was configured in NR_CPUS:

    smp_init_cpus: Core Count = 8
    smp_init_cpus: Core Id = 0
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 0 at include/linux/cpumask.h:121 smp_init_cpus+0x54/0x74
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc3-00015-g1459333f88a0 #124
    Call Trace:
    __warn$part$3+0x6a/0x7c
    warn_slowpath_null+0x35/0x3c
    smp_init_cpus+0x54/0x74
    setup_arch+0x1c0/0x1d0
    start_kernel+0x44/0x310
    _startup+0x107/0x107

    Signed-off-by: Max Filippov

    Max Filippov
     

26 Jan, 2019

7 commits

  • When building some xtensa config, I hit the following warning:
    drivers/staging/mt7621-dts/Kconfig:4:warning: 'BUILTIN_DTB' has wrong type.
    'select' only accept arguments of bool and tristate type

    It is due to some arch use BUILTIN_DTB as a flag for the need to builtin
    dtb but xtensa use it as a string for which dtb to bulltin.
    But for this (which dtb to build), it is better to use
    BUILTIN_DTB_SOURCE like other arch do.

    Signed-off-by: Corentin Labbe
    Signed-off-by: Max Filippov

    Corentin Labbe
     
  • This patch fix a simple typo.

    Signed-off-by: Corentin Labbe
    Signed-off-by: Max Filippov

    Corentin Labbe
     
  • Otherwise it is impossible to enable CPUs after booting with 'maxcpus'
    parameter.

    Signed-off-by: Max Filippov

    Max Filippov
     
  • Secondary CPU reset vector overlaps part of the double exception handler
    code, resulting in weird crashes and hangups when running user code.
    Move exception vectors one page up so that they don't clash with the
    secondary CPU reset vector.

    Signed-off-by: Max Filippov

    Max Filippov
     
  • - add missing memory barriers to the secondary CPU synchronization spin
    loops; add comment to the matching memory barrier in the boot_secondary
    and __cpu_die functions;
    - use READ_ONCE/WRITE_ONCE to access cpu_start_id/cpu_start_ccount
    instead of reading/writing them directly;
    - re-initialize cpu_running every time before starting secondary CPU to
    flush possible previous CPU startup results.

    Signed-off-by: Max Filippov

    Max Filippov
     
  • Most architectures define system call numbers for the rseq and pkey system
    calls, even when they don't support the features, and perhaps never will.

    Only a few architectures are missing these, so just define them anyway
    for consistency. If we decide to add them later to one of these, the
    system call numbers won't get out of sync then.

    Signed-off-by: Arnd Bergmann
    Acked-by: Heiko Carstens
    Acked-by: Geert Uytterhoeven

    Arnd Bergmann
     
  • The behavior of these system calls is slightly different between
    architectures, as determined by the CONFIG_ARCH_WANT_IPC_PARSE_VERSION
    symbol. Most architectures that implement the split IPC syscalls don't set
    that symbol and only get the modern version, but alpha, arm, microblaze,
    mips-n32, mips-n64 and xtensa expect the caller to pass the IPC_64 flag.

    For the architectures that so far only implement sys_ipc(), i.e. m68k,
    mips-o32, powerpc, s390, sh, sparc, and x86-32, we want the new behavior
    when adding the split syscalls, so we need to distinguish between the
    two groups of architectures.

    The method I picked for this distinction is to have a separate system call
    entry point: sys_old_*ctl() now uses ipc_parse_version, while sys_*ctl()
    does not. The system call tables of the five architectures are changed
    accordingly.

    As an additional benefit, we no longer need the configuration specific
    definition for ipc_parse_version(), it always does the same thing now,
    but simply won't get called on architectures with the modern interface.

    A small downside is that on architectures that do set
    ARCH_WANT_IPC_PARSE_VERSION, we now have an extra set of entry points
    that are never called. They only add a few bytes of bloat, so it seems
    better to keep them compared to adding yet another Kconfig symbol.
    I considered adding new syscall numbers for the IPC_64 variants for
    consistency, but decided against that for now.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

25 Jan, 2019

1 commit

  • ccount_timer_shutdown is called from the atomic context in the
    secondary_start_kernel, resulting in the following BUG:

    BUG: sleeping function called from invalid context
    in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
    Preemption disabled at:
    secondary_start_kernel+0xa1/0x130
    Call Trace:
    ___might_sleep+0xe7/0xfc
    __might_sleep+0x41/0x44
    synchronize_irq+0x24/0x64
    disable_irq+0x11/0x14
    ccount_timer_shutdown+0x12/0x20
    clockevents_switch_state+0x82/0xb4
    clockevents_exchange_device+0x54/0x60
    tick_check_new_device+0x46/0x70
    clockevents_register_device+0x8c/0xc8
    clockevents_config_and_register+0x1d/0x2c
    local_timer_setup+0x75/0x7c
    secondary_start_kernel+0xb4/0x130
    should_never_return+0x32/0x35

    Use disable_irq_nosync instead of disable_irq to avoid it.
    This is safe because the ccount timer IRQ is per-CPU, and once IRQ is
    masked the ISR will not be called.

    Signed-off-by: Max Filippov

    Max Filippov
     

18 Jan, 2019

1 commit

  • This introduces a new generic SOL_SOCKET-level socket option called
    SO_BINDTOIFINDEX. It behaves similar to SO_BINDTODEVICE, but takes a
    network interface index as argument, rather than the network interface
    name.

    User-space often refers to network-interfaces via their index, but has
    to temporarily resolve it to a name for a call into SO_BINDTODEVICE.
    This might pose problems when the network-device is renamed
    asynchronously by other parts of the system. When this happens, the
    SO_BINDTODEVICE might either fail, or worse, it might bind to the wrong
    device.

    In most cases user-space only ever operates on devices which they
    either manage themselves, or otherwise have a guarantee that the device
    name will not change (e.g., devices that are UP cannot be renamed).
    However, particularly in libraries this guarantee is non-obvious and it
    would be nice if that race-condition would simply not exist. It would
    make it easier for those libraries to operate even in situations where
    the device-name might change under the hood.

    A real use-case that we recently hit is trying to start the network
    stack early in the initrd but make it survive into the real system.
    Existing distributions rename network-interfaces during the transition
    from initrd into the real system. This, obviously, cannot affect
    devices that are up and running (unless you also consider moving them
    between network-namespaces). However, the network manager now has to
    make sure its management engine for dormant devices will not run in
    parallel to these renames. Particularly, when you offload operations
    like DHCP into separate processes, these might setup their sockets
    early, and thus have to resolve the device-name possibly running into
    this race-condition.

    By avoiding a call to resolve the device-name, we no longer depend on
    the name and can run network setup of dormant devices in parallel to
    the transition off the initrd. The SO_BINDTOIFINDEX ioctl plugs this
    race.

    Reviewed-by: Tom Gundersen
    Signed-off-by: David Herrmann
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller

    David Herrmann